Numerical Line Integrals with Python

preview_player
Показать описание
Let's find the work done moving in a force field F = x*xhat + y*yhat

Here is the code
Рекомендации по теме
Комментарии
Автор

I've taken my college courses wildly out of order as I changed degrees. I've taken calc 3, but am only just taking physics II (electricity and magnetism). I found calc 3 conceptually challenging, as it all felt very arbitrary. Now as I go through these topics in physics where multivariable/vector calculus is extremely useful, I find myself going back over calc 3 content and trying to apply it to physics problems beyond the bounds of this physics course. Doing so gives a very solid understanding of calc 3 material. It really makes you realize what you once thought was wizardry is really quite simple.

BradleyG
Автор

What a great way to illustrate this concept!

fizixx
Автор

If you're doing physics a useful aproach in this case is to parameterise your path as r(s) with some parameter s in the beginning, then calculate dr=(dr(s)/ds)ds and do a substitution in the work W. This also nicely generalises to your numerical integration scheme for arbitrary (not just circular) paths. You also don't run into the problem of terminating your while loop with this arduous query mass.pos.x>ptB.pos.x because you know the range of s in r(s). In addition you can then also specify the number of steps in your integral directly. Doing numerics in your way without first simplifying the equations can be quite difficult especially if your path is not just a circle centered at (0, 0) (or some other simple path that can be readily inserted 'by hand').

Blackmuhahah
Автор

Dude! In 20 seconds you already made a mistake?

doccore