Question: [Python in Jupyter] The goal is to look at a problem and solve it using ordinary differential equations. The problem is the motion of a

[Python in Jupyter]

The goal is to look at a problem and solve it using ordinary differential equations. The problem is the motion of a charged particle through a set of helmholtz coils.

The function is *supposed* to return the time derivative of the state of the system, which it doesn't. I'm not sure I'm using the right equations either. My thought was to use the magnetic field on an axis through loops of wire and the magnetic force. It's not doing anything close to what it should and I'm not sure how to fix it.

[Python in Jupyter] The goal is to look at a problem and

Motion of charged particle through a set of Helmholtz Coils def func(s, t): vx, vy, vz, x, y, z = s #initialize variables q = 1.602e-19 #C mue_const = le-7 I = 10 #Amps n = 100 #turns of wire in each coil R = .1 v = s[0:3] z = S(3:6] dBdt = mue_const * (2*pi*R**2*I)/(2**2 + R**2) ** (3/2) dFdt = q*(np.cross(v, dBdt)) #print(dBdt) #print(dFdt) return concatenate ([dFdt, dBdt]) S0 = np.array ([1, 1,1,0,0,.1 ]) ts = linspace(0,500,300) ans = odeint(func, so, ts) plot(ans[:,3], ans[:,4]) print(ans) [[1.00000000e+00 1.00000000e+00 1.00000000e+00 0.000000002+00 0.00000000e+00 1.00000000-01] [1.00000000e+00 1.00000000e+00 1.00000000e+00 1.05069882e-04 1.05069882e-04 1.00037138e-01] [1.00000000e+00 1.00000000e+00 1.00000000e+00 2.10139423e-04 2. 10139423e-04 1.00074254e-01] [1.00000000e+00 1.00000000e+00 1.00000000e+00 2.98573927e-02 2.98573927e-02 1.10210268e-01] [1.00000000e+00 1.00000000e+00 1.00000000e+00 2.99497952e-02 2.99497952e-02 1.10242141e-01] [1.00000000e+00 1.00000000e+00 1.00000000e+00 3.00421274e-02 3.00421274e-02 1.10273999e-01]] Motion of charged particle through a set of Helmholtz Coils def func(s, t): vx, vy, vz, x, y, z = s #initialize variables q = 1.602e-19 #C mue_const = le-7 I = 10 #Amps n = 100 #turns of wire in each coil R = .1 v = s[0:3] z = S(3:6] dBdt = mue_const * (2*pi*R**2*I)/(2**2 + R**2) ** (3/2) dFdt = q*(np.cross(v, dBdt)) #print(dBdt) #print(dFdt) return concatenate ([dFdt, dBdt]) S0 = np.array ([1, 1,1,0,0,.1 ]) ts = linspace(0,500,300) ans = odeint(func, so, ts) plot(ans[:,3], ans[:,4]) print(ans) [[1.00000000e+00 1.00000000e+00 1.00000000e+00 0.000000002+00 0.00000000e+00 1.00000000-01] [1.00000000e+00 1.00000000e+00 1.00000000e+00 1.05069882e-04 1.05069882e-04 1.00037138e-01] [1.00000000e+00 1.00000000e+00 1.00000000e+00 2.10139423e-04 2. 10139423e-04 1.00074254e-01] [1.00000000e+00 1.00000000e+00 1.00000000e+00 2.98573927e-02 2.98573927e-02 1.10210268e-01] [1.00000000e+00 1.00000000e+00 1.00000000e+00 2.99497952e-02 2.99497952e-02 1.10242141e-01] [1.00000000e+00 1.00000000e+00 1.00000000e+00 3.00421274e-02 3.00421274e-02 1.10273999e-01]]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!