]> permondes.de Git - Analog_Engine.git/blame - scripts/TP1 03.08 Charge in em field.LACE
Further examples of harmonic oscillation
[Analog_Engine.git] / scripts / TP1 03.08 Charge in em field.LACE
CommitLineData
6d26a6bd
P
1#PROGRAM-ID ChargeInEMfield
2#VERSION 20240116
3# A mass m with charge q>0 is located in a static electro-magnetic field [0,0,E], [0,-B,0].
4# Find the trajetory
5# Differential equation (Lorentz force):
6# x'' = omega*z'
7# z'' = a*omega^2 - omega*x'
8# good start settings are omega=0,92, a*omega^2=0,05
9
10# coefficient definition
11alias coefficient.1 -> omega_x # -omega for x'
12coefficient.2 (+1) -> a*omega^2
13alias coefficient(3) -> omega_z # omega for z'
14
15# solving the DE
16iintegrate (x'') -> -x'
17iintegrate (-x') -> x
18
19coefficient.omega_x (-x') -> -omega*x'
20#cmultiply (-x', omega_x) -> omega*x'
21
22iintegrate (a*omega^2, -omega*x') -> -z' # input is z''
23iintegrate (-z') -> z
24invert (-z') -> z'
25
26coefficient.omega_z (z') -> omega*z'
27#cmultiply (z', omega_z) -> omega*z'
28assign omega*z' -> x''
29
30output(x) -> out.x
31output(z) -> out.z