Python Tutorial 3 - Graphing (Computational Physics for Absolute Beginners)

preview_player
Показать описание
This series helps absolute beginners learn what they need to start doing computational physics assignments at the undergraduate level.

This series is supported by the Partnership for Integration of Computation into Undergraduate Physics.

Thank you, patrons! Fan Xinyu, Don Williams, Tripp Bishiop, Aaron Stevens, Jean-Manuel Izaret, Hugo Granström

This episode is brought to you in part by the University of North Florida Department of Physics
Рекомендации по теме
Комментарии
Автор

Have you worked on the motion of a charge inside a uniform magnetic field? (in Vpython or similar). This is a topic I have started to read about and I wanted to see how it behaves in python.

Let
V = (Vx, Vy, Vz) be the velocity vector
A = (Ax, Ay, Az) be the acceleration vector

From newton's F=ma
F = qV ☓ B = mA
Given that B is uniform and along the z-axis
V ☓ B = (Vy B, - Vx B, 0)

Which yields, when separating the equation into each dimension:
m Ax = q Vy B
m Ay = -q Vx B
Az = 0
A system of coupled differential equations!

I tried to use the usual methods for simulations but I get a spiral! (And not circular motion in the xy-plane)
By usual I mean: dt=0.01
Vx += Ax*dt,
pos.x += Vx*dt,
update position

I do know there's a method using complex numbers to solve the problem, but it's weird that such a result is happening. Perhaps I'm missing something.

fernandogarciacortez
visit shbcf.ru