physics

Is there a method in Java that can do integration?

点点圈 提交于 2020-08-05 07:29:08
问题 I am writing a program in java that models a carnot engine and I want to calculate the work done and I need to use integration. I have been looking around on google and haven't found quite what I am looking for, have any suggestions? 回答1: You have to use an external library, like this one or this other one. You cannot do that with just native methods (well, unless you implement the integration algorithm yourself like the others answers suggest, which I think it's not what you want - otherwise

Detect programmatically if iPhone is dropped using CoreMotion/Accelerometer

不想你离开。 提交于 2020-08-01 08:58:06
问题 So I am writing a piece of code where I have to detect different movement gestures using Accelerometer and gyroscope in iOS 4.3 above. Q1: Is there any existing opensource code which has achieved any movement/gesture detection? If not Q2: For now I want to detect if the iPhone is dropped. What I have achieved so far: CoreMotion API gives userAcceleration , which (afaik) is the acceleration that the user is giving to the device or the acceleration of device in some direction (x, y or z) with

Modelling a quantum harmonic oscillator/SHM

旧城冷巷雨未停 提交于 2020-06-25 21:41:30
问题 I need help to figure out why my ground state graph for b) looks wrong, here's the question in full: (I thought posting it in full would give context to the method I'm trying to use) (a) Consider a square potential well with 𝑉(𝑥)=0 in between two infinitely high walls separated by a distance 𝐿 equal to the Bohr radius, i.e. for all x in the interval [0,𝐿] . Write a function solve(energy, func) which takes the parameter energy and a python function 𝑓𝑢𝑛𝑐 . This function should solve the

Modelling a quantum harmonic oscillator/SHM

我怕爱的太早我们不能终老 提交于 2020-06-25 21:41:16
问题 I need help to figure out why my ground state graph for b) looks wrong, here's the question in full: (I thought posting it in full would give context to the method I'm trying to use) (a) Consider a square potential well with 𝑉(𝑥)=0 in between two infinitely high walls separated by a distance 𝐿 equal to the Bohr radius, i.e. for all x in the interval [0,𝐿] . Write a function solve(energy, func) which takes the parameter energy and a python function 𝑓𝑢𝑛𝑐 . This function should solve the

Python Euler Method implementation in Two Body Problem not working

夙愿已清 提交于 2020-06-22 03:54:10
问题 I am currently trying to get a two body problem to work, that I can then upgrade to more planets, but it is not working. It is outputting me impossible positions. Does anyone know what is causing that? This is the code I use: day = 60*60*24 # Constants G = 6.67408e-11 dt = 0.1*day au = 1.496e11 t = 0 class CelBody: def __init__(self, id, name, x0, y0, z0, vx0, vy0, vz0, mass, vector, ax0, ay0, az0, totalforcex, totalforcey, totalforcez): self.ax0 = ax0 self.ay0 = ay0 self.az0 = az0 self.ax =

Plotting Idealized Blackbody Spectra

天涯浪子 提交于 2020-06-01 06:44:46
问题 So I am getting a couple errors RuntimeWarning: overflow encountered in exp intensity = a/ ( (wav**5) * (np.exp(b) - 1.0) ) and RuntimeWarning: invalid value encountered in multiply intensity = a/ ( (wav**5) * (np.exp(b) - 1.0) ) Even with these errors (and one more about dividing by zero that I ignore lol) my graph gets produced correctly either way. I am just wondering if anyone can help me clear up these errors? Please and thanks. Here is the full code: import numpy as np import matplotlib