Biot Savart Law in Python: Any wire you want, no paper required

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 ม.ค. 2025

ความคิดเห็น • 45

  • @Nobuhara
    @Nobuhara 3 ปีที่แล้ว +10

    Dude, please, never stop teaching our minds and touching our hearts.

  • @amsal1998
    @amsal1998 3 ปีที่แล้ว +15

    I have found a gem of a channel. I really hope you grow, your work is amazing. Keep it up!

  • @Smart_ASMR
    @Smart_ASMR 3 ปีที่แล้ว +4

    Wow I'm very impressed I saw the Reddit post, decided to give it a go since I'm learning phyton and electrical engineering at college. My favorite thing of all was the visual representation, love it! Keep up the good work.

  • @agustinbrusco7173
    @agustinbrusco7173 3 ปีที่แล้ว +3

    this is amazing. I also discovered plotly while doing my introductory course on electrodynamics and looking for something better than matplot at 3D. Finding this video a few months ago would have saved me hours. keep it going!

  • @JonathonRiddell
    @JonathonRiddell 3 ปีที่แล้ว +35

    I love it. Computational physics should be a lot more "present" throughout undergrad, awesome example :).

  • @ericberlo3981
    @ericberlo3981 3 ปีที่แล้ว +4

    That Plotly software is so cool my calc3 and E&M professors would love to use something like that when explaining 3D fields like this. Great job

  • @ezbeanss
    @ezbeanss 7 หลายเดือนก่อน

    as soon as he featured griffiths in the intro i subscribed that was fire

  • @matteopiccioni196
    @matteopiccioni196 3 ปีที่แล้ว +3

    Nice code, but taken the parameterization of the petal-curve is even faster to use a FEA simulator to solve this kind of problems. However the code is great and is very interesting to understand how everything works writing down formulas in this way.

  • @samsonblack
    @samsonblack 3 ปีที่แล้ว +7

    That intro 😎🎸⚡

  • @chinaskarina698
    @chinaskarina698 3 ปีที่แล้ว +1

    This is absolutely awesome!!! Thank you for the time and extremely clear explanation. :D

  • @marian.k
    @marian.k 3 ปีที่แล้ว +2

    great Video, thank you so much.
    in your code on Github, y and z is switched in the first diagram, so that it just shows a straight line instead of the 2d wire

  • @frankkoslowski6917
    @frankkoslowski6917 2 ปีที่แล้ว

    For the display to work at all, IPython's `display.py' had to be imported. After that `display.display_html(fig)` rendered the expected result.
    When inspecting the code inside the `display.py' module it will quickly become evident why this was shown to be true.
    Enjoyed working through the project. Thx.

  • @aliexpress.official
    @aliexpress.official 3 ปีที่แล้ว +1

    I think a cool next step is to also draw the trajectory of an incident charged particle in the presence of that field / other weird arbitrary B-field

  • @andreasbahmer3179
    @andreasbahmer3179 2 ปีที่แล้ว

    I am very impressed! You should be a lecturer!

  • @invincibledeath
    @invincibledeath 3 ปีที่แล้ว +3

    love this content. so educational. thank you for this :)

  • @aidanphillips6584
    @aidanphillips6584 ปีที่แล้ว +1

    Awesome video, is it possible to implement the line that the current is flowing through with piecewise functions?
    I'm also wondering if we can then define a second loop and solve for mutual inductance

  • @fiNitEarth
    @fiNitEarth 3 ปีที่แล้ว +7

    Your videos are so fucking amazing... I didn't know about the tools python provides you with in order to do mathematics.. It's amazing! Just a random thought: wouldn't it be cool if you could just draw a cable and your script would tell you the magnatic field? Like it converts the doodling into a mathematical function and processes it to what you've shown in this video? That'd be fun y!

    • @MrPSolver
      @MrPSolver  3 ปีที่แล้ว +4

      Now this, I like

    • @velocity834
      @velocity834 2 ปีที่แล้ว

      U should be able to just np.hypot(Bx,By,Bz) and make a function that depends on x y z (and maybe some other stuff). So that way u can get the field for any x y and z

  • @griffgruff1
    @griffgruff1 2 ปีที่แล้ว +1

    Interesting problem with nice python solution.
    However, I had a problem with final cell when the html plot did not show.
    Solution that worked for me:
    Replace:
    HTML(fig.to_html())
    With:
    fig.show()
    html = fig.to_html(full_html=True, include_plotlyjs=True)
    print(html)
    😄

  • @Slibemaskine
    @Slibemaskine 3 ปีที่แล้ว +2

    Very helpful video! I have one problem, when I try to run the code in Jupyterlab, the final plot returns just an empty cell. Any clue what I might be doing wrong?

  • @kkkanishkkk
    @kkkanishkkk 3 ปีที่แล้ว +3

    it would be really cool to actually visualize the displacement current somehow !!!!

  • @sumitmamoria
    @sumitmamoria 3 ปีที่แล้ว +2

    I dont know if its possible, but it would be very cool if those "cones" were in motion along the field lines. :)

  • @jaahnvitoolsidas3933
    @jaahnvitoolsidas3933 5 หลายเดือนก่อน

    to those struggling to open the last plot, after HTML(fig.to_html()), i put fig.write_html(‘first_figure.html’, auto_open=True)
    and then it worked! good luck

  • @thanoscar9195
    @thanoscar9195 3 ปีที่แล้ว +3

    Do you think it would be possible to approximate field lines? I imagine it would be pretty difficult, but would probably look cool if it worked.

  • @et4493
    @et4493 2 ปีที่แล้ว

    This is GREAT! BTW the intros are majestic 🤣 I only have a question, how do you take into consideration real dimensions (meters etc)? I don't quite understand how to take it into account

  • @sumukhabharadwaj
    @sumukhabharadwaj 2 ปีที่แล้ว +1

    All the codes are getting executed, but there is a problem with the last part. There are no errors in the code, but there is no output too. I don't know why there isn't any output.🙄

    • @jamesmacrae7730
      @jamesmacrae7730 9 หลายเดือนก่อน

      Did you ever fix it? I have the same problem.

  • @killerxdkajs
    @killerxdkajs 3 ปีที่แล้ว +1

    Great video! Just a question tho, performance wise, is there a way to vectorize the function (not to use np.vectorize, since its just a for loop)? Using the function on large inputs slows the program too much sadly.

    • @AJ-et3vf
      @AJ-et3vf 3 ปีที่แล้ว

      Unfortunately, there's no way to vectorize the function in Python. There's also no way to "broadcast" the function in Python over an array of values, which you can do in Julia and makes things faster.
      The only alternative I can think of to make things faster is to use numba's njit function and write the for loops yourself. Numba actually has a vectorize function numba.pydata.org/numba-doc/latest/user/vectorize.html
      Unfortunately though, you won't be able to use scipy's quad function since numba doesn't work with scipy functions as of now. You would have to use your own numerical integrator function. The best I can think of is a user-defined romberg integrator decorated with the njit numba function so it could be passed into the function.

  • @antoom.677
    @antoom.677 ปีที่แล้ว

    This has been very helpful! I just have one question, I've noticed that when I change the number of grid points the magnitude of the "cones" and therefore the magnetic field changes quite drastically which confuses me because although the magnetic field is now evaluated at different points, its range of magnitude should be pretty similar right? does anybody know why this happens?

  • @tajpa100
    @tajpa100 2 ปีที่แล้ว

    Please, what editor do you use?

  • @aavashsubedi4656
    @aavashsubedi4656 3 ปีที่แล้ว +1

    how would you alter this for a straight line wire?

    • @bingodeagle
      @bingodeagle 3 ปีที่แล้ว +2

      assuming you haven't studied Maxwell's equations in too much mathematical detail, the Biot-Savart law follows from Ampere's Law curl(B) = J, subject to the (roughly put) condition that the integral of J/r converges when integrated over all space, so infact the law does not apply for an infinite charge distribution like the straight line wire, since J remains constant over the wire and so the integral will diverge.

  • @MrRObot-bin
    @MrRObot-bin 3 หลายเดือนก่อน

    Can You please help us now and plot a EM Wave?

  • @skypickle29
    @skypickle29 3 ปีที่แล้ว +1

    Tom Cruise at 1:00

  • @1.2.3.4..5
    @1.2.3.4..5 3 ปีที่แล้ว +2

    Sick video

  • @arpitgaur4310
    @arpitgaur4310 10 หลายเดือนก่อน

    I learned biot savart's law 2 days ago in physics

  • @vishalkumar040393
    @vishalkumar040393 3 ปีที่แล้ว

    Nice tutorial.

  • @janmejaypant4181
    @janmejaypant4181 3 ปีที่แล้ว +3

    Came from Reddit

  • @jdcrunchman999
    @jdcrunchman999 3 ปีที่แล้ว

    .