Numerical Integration with Variable Limits in Python

Поділитися
Вставка
  • Опубліковано 26 вер 2024
  • Today we go over how to numerically integrate a function f(x,y,z;a) using Scipy, where x, y and z are variables to be integrated over, and a is parameter. We do this for 2 cases:
    1) when the limits of integration are constant
    2) when the limits are functions of x, and y, themselves.
    Check the Flexispot Amazon store and get your setup! Apply code 'COMHARDESK' to get an EXTRA 5% discount on my model: amzn.to/3s5BiF2 (Comhar) US site: amzn.to/3OLQKPB Canada site: amzn.to/3KtSZVg

КОМЕНТАРІ • 119

  • @xsetklickc3252
    @xsetklickc3252 7 місяців тому +14

    this man is so unpredictable, been watching this guy since my sophomore year in high school now im a freshman in college. Swear I binge every 6 months LOL

  • @jhawar-ji
    @jhawar-ji Рік тому +200

    Andrew putting up a video after so long and still have guts to start the video with a promotional message.

    • @AndrewDotsonvideos
      @AndrewDotsonvideos  Рік тому +98

      It was very stunning and brave

    • @seanogary1205
      @seanogary1205 Рік тому +6

      What are you trying to say? Money is good. And grad school is hard. Go away.

    • @firstnamelastname492
      @firstnamelastname492 11 місяців тому +18

      @@seanogary1205stop taking everything you read on the internet so seriously.

    • @seanogary1205
      @seanogary1205 11 місяців тому

      That is good advice. I have a tendency to take people very seriously.@@firstnamelastname492

    • @atomgutan8064
      @atomgutan8064 22 дні тому

      ​@@AndrewDotsonvideos Yeah it was very sudden.

  • @PapaFlammy69
    @PapaFlammy69 Рік тому +8

    he bacc

  • @SerHergen
    @SerHergen Рік тому +16

    It is crazy to think I started watching you as a Freshman and now I'm an employeed optical engineer (i went to the dark side because of money).

    • @AndrewDotsonvideos
      @AndrewDotsonvideos  Рік тому +9

      That sounds really cool! Engineerings not the dark side lol, ya'll keep the lights on🤣

  • @LavenderTown40
    @LavenderTown40 Рік тому +11

    WE ARE SO BACK. Hey man, the timing of this was awesome. My hero of academia was a exp amo physicist. Damn near 30 years of teaching. Taught modern/lasers/qm.
    Passing through my school on my way back to get my guns for a Precision Rifle course. Also passed through LC on my way from San Diego to Missouri. Thought of you.
    If you ever want to get after it and shoot, im down brother!
    Probably going to Gunsmiff School at Colorado School of Trades and getting my private pilot cert. I love physics and was planning to do an amo grad degree but life happened.
    Ill always have my old profs, my textbooks, my sps FAMILY, and my favorite tensor boi.
    Much love.

    • @AndrewDotsonvideos
      @AndrewDotsonvideos  Рік тому +5

      If you're ever in Las Cruces again, you've gotta check out butterfield range! All outdoors, got a little rifle area as well. Life happens, sounds like you're in for a fun alternate route, though!

    • @LavenderTown40
      @LavenderTown40 Рік тому

      @@AndrewDotsonvideos you a regular? I'll find a way to shoot with ya lol. I know you have a 30-30 from community. If you want to shoot my nice Bolty-boy I'd be more than happy to have you get behind and and slap steel

    • @LavenderTown40
      @LavenderTown40 Рік тому

      @@AndrewDotsonvideos it's a 9 hour drive from the DANGAAAA ZOOONNNE to the range. I'll make it happen. We're going shooting. Don't tell Kelly, but I'm stealing you for a day.

    • @LavenderTown40
      @LavenderTown40 Рік тому

      I'm Zach's friend whose signed Christmas present I haven't been sleeping with under my pillow. Maybe that's why I'm still kinda dumb lol.

  • @RC32Smiths01
    @RC32Smiths01 Рік тому +36

    Firmly appreciate this. Always great to see you shed some light on valuable information.

    • @AndrewDotsonvideos
      @AndrewDotsonvideos  Рік тому +6

      Thanks a lot! I was having to do this a lot for research so I figured might as well make a video on it for future reference 😅

    • @RC32Smiths01
      @RC32Smiths01 Рік тому +4

      @@AndrewDotsonvideos It goes a long way for sure! Props man

  • @ytpanda398
    @ytpanda398 Рік тому +36

    Hey Andrew, obligatory comment about how I loved your videos in school and now love them even more that I'm studying for my master's in physics. I'll do my best to try and understand whatever you publish in your grad position lol. Hope you're having a good day

    • @AndrewDotsonvideos
      @AndrewDotsonvideos  Рік тому +10

      Wow that’s awesome, what is your masters on?

    • @ytpanda398
      @ytpanda398 Рік тому +8

      @@AndrewDotsonvideos Oops, I didn't mean to give that impression. I'm on the 2nd year of a 4 year masters course. But if you're still putting out content by the time I get to doing cool stuff I'll be sure to let you know!

    • @lello.4925
      @lello.4925 Рік тому

      ​@@AndrewDotsonvideosthis comment reminds me of Jese Kyle

    • @lifeofphyraprun7601
      @lifeofphyraprun7601 Рік тому +1

      ​@@lello.4925I miss Jesse Kyle. Glad I'm not the only one 😭😂.

  • @Harmonicaoscillator
    @Harmonicaoscillator Рік тому +1

    I haven’t watched much UA-cam lately because I’ve been busy with research and friends this summer but I finally do and you’re advertising a standing desk which I was just talking to my girl about getting. Crazy

  • @atomgutan8064
    @atomgutan8064 22 дні тому

    You are a vampire, not using dark mode.
    Everytime I see light mode I hear the CS:GO "Deploying a flashbang!" in my head.

  • @notdru5467
    @notdru5467 Рік тому +7

    Im very happy your back man i watched your last video as a senior in highschool now im a freshman physics major starting my first class on monday!

  • @kaidenschmidt157
    @kaidenschmidt157 Рік тому +2

    Always a pleasure to see you've uploaded, Andrew. I'm always impressed by the community you've got here too

  • @ozymandias3303
    @ozymandias3303 Рік тому +1

    Andrew, we need more videos. I started watching your videos when I was doing my bachelors. And now I am 1st year PhD in particle physics. Your videos inspire me)

  • @mathemmanuel
    @mathemmanuel Рік тому +2

    Finally after 4 months he's back 🔥
    Love ur vids

  • @anindyaguria6615
    @anindyaguria6615 Рік тому +47

    I watched your old tensor videos when I took GR last semester😊. I was thinking of the old days when I was in high school and would watch all your videos and pretend to understand everything 😂. We all have come such a long way mann! I miss those times a lot! So glad you are posting videos again... All the best for your PhD ❤

    • @AndrewDotsonvideos
      @AndrewDotsonvideos  Рік тому +15

      I hope they were helpful! I used to spend so much time reading/watching physics that I could only absorb ~1% of at the time, time well spent🤣

    • @anindyaguria6615
      @anindyaguria6615 Рік тому +3

      @@AndrewDotsonvideos Can't believe I got a reply for the Tensorboi... but yeah that's 100% relatable 😂

    • @MRF77
      @MRF77 Рік тому +6

      ​@@anindyaguria6615Dude, that's literally me! I started watching him during highschool, now in gradschool doing experimental CMP. (and remembering how Andrew used make fun of experimentalists). 😅

    • @mrsupermaster69xxoo6
      @mrsupermaster69xxoo6 10 місяців тому

      Literally me rn

  • @Rosalies_
    @Rosalies_ Рік тому +11

    I was just watching your Monte Carlo integration basics! Incredible timing as always. Wb :)
    Edit: I work IT at a Uni now, and am contemplating enrolling in their MS Applied Physics program.

    • @AndrewDotsonvideos
      @AndrewDotsonvideos  Рік тому +4

      Right on! Maybe see if they have a pgso and reach out to see if anyone is in that particular program.

  • @CassieAngelica
    @CassieAngelica Рік тому +3

    He’s back! LET’S GOOO!🔥

  • @andrewtran6669
    @andrewtran6669 Рік тому +3

    Haven't seen a Python video in so long!

    • @AndrewDotsonvideos
      @AndrewDotsonvideos  Рік тому +1

      Haven’t seen a comment from you in so long! Hope all is well🙌🏻

  • @yasploofyh8358
    @yasploofyh8358 Рік тому +1

    I've been watching your channel for years, and in a few days I start with my first year of university physics ( and astrophysics ), i'm rlly thankful for your videos along the years motivating me to pursue this path :)

  • @tridivsharma2342
    @tridivsharma2342 Рік тому +2

    you love it when Andrew uploads, also it's nice to see that you moved out of papa's basement. Great vid as always (even though I haven't watched it yet).

  • @noamtzriker4137
    @noamtzriker4137 Рік тому +10

    Great video(I didn't watch it yet)

  • @EccentricTuber
    @EccentricTuber Рік тому +7

    This is great timing (I'm bad at code)

  • @arjunsinha4015
    @arjunsinha4015 Рік тому +1

    Welcome back after 4 months

  • @g.o.sstudyofouruniverse.5373
    @g.o.sstudyofouruniverse.5373 Рік тому +2

    Hey I glad you finally posted a new vedio i was waiting for it so long PISsss upload vedio's more and soon don't delay this much

  • @K24_ej1
    @K24_ej1 Рік тому

    Glad to see you uploading again man. This is Brandon, I got your message and responded to you through your gmail around a month ago or so. 👍🏻 hope all is well!

  • @henryginn7490
    @henryginn7490 Рік тому +3

    Nice video! Just a tiny nitpick, the PEP8 style guide suggests not putting spaces around the equals sign when passing in keyword arguments. You would do plt.plot(x, y, linestyle=".", color="k") for example.

  • @xentarch
    @xentarch Рік тому +2

    Numerical Integration: Return of the King

    • @atomgutan8064
      @atomgutan8064 22 дні тому

      Definitely cannot surpass E&M2: Electric Boogaloo

  • @GeoffryGifari
    @GeoffryGifari Рік тому +2

    oh wow i used scipy's dblquad for *my* hadron physics research. who would've thought...
    baking numerical algorithms from scratch can be a pain in the rear though, my system of equations were so nonlinear, the integration limit is the output observable lmao

  • @n0mad385
    @n0mad385 Рік тому +1

    THE KING RETURNS AGAIN!

  • @angielabrie11
    @angielabrie11 Рік тому +7

    Mathematica has entered the chat...

    • @AndrewDotsonvideos
      @AndrewDotsonvideos  Рік тому +8

      Yeah seriously. Until that “enter activation key” hits when you least expect it

  • @austynhughes134
    @austynhughes134 Рік тому

    Loved the video! I wish I could convince my boss to let me play around with Python more.

  • @EmissaryOfSmeagol
    @EmissaryOfSmeagol Рік тому +1

    Thanks Andrew, very epic

  • @speedspeed121
    @speedspeed121 11 місяців тому +1

    So this is your fifth year at grad school? I have been watching since you were a Junior undergrad. You motivated me to get my undergrad physics degree. Thanks

  • @TranquilSeaOfMath
    @TranquilSeaOfMath Рік тому

    Great video of code to solve integrals. I hope your degree and research continues to go well.

  • @LaithMMA
    @LaithMMA Рік тому +1

    Thanks for the video!

  • @HalluFinance
    @HalluFinance 9 місяців тому +1

    Please,Solve jee advance physics question 😊

  • @tealdodo904
    @tealdodo904 Рік тому +8

    Does anyone know how to plot 3d spherical coordinates in Python? I've been trying to plot solutions to Schrödinger's equation for a one electron hydrogen atom

    • @AndrewDotsonvideos
      @AndrewDotsonvideos  Рік тому +6

      There’s some stuff on stack exchange stackoverflow.com/questions/36816537/spherical-coordinates-plot , not sure if that helps without knowing a little more.

    • @tealdodo904
      @tealdodo904 Рік тому +1

      @@AndrewDotsonvideos
      Thank you so much for your reply it is greatly appreciated.
      I have seen that post and a few others and am attemping to use matlib, however I am struggling with syntax and are unaware if it is even possible to use in this way (my math is very weak), although I have not spent a long time fighting the issues.
      I will spend more time researching this after my exam season ends.
      Do not feel you need to solve this issue for me, your content is enough. I was merely asking in case you had experience completing a similar task, and had to know how off the top of your head.

  • @devamjani9423
    @devamjani9423 Рік тому +1

    7:34 mah boi Jon do be enjoying that desktop!
    (Why am I here? J̶u̶s̶t̶ t̶o̶ s̶u̶f̶f̶e̶r̶?̶ I don't even know python... Heck, not even anything close to math or phys 🤦.... Guess I'll stay for Andyroo boi 🙂)

  • @nino---
    @nino--- Рік тому

    YAY! new dotson vid. I love you so much for inspiring that physics>engineering jk but not really i love physics and your explanations XD. I've been having lots of trouble finding a college but once I'm there I get sailing. I'm also interested in coding and math but physics is my main interest over everything

  • @jennette1992
    @jennette1992 Рік тому

    Nuclear phd fellow here :)) an experimentahatelist ❤

  • @lifeofphyraprun7601
    @lifeofphyraprun7601 Рік тому

    Just asking...when will you do the last video on Moments? It was a simple to follow,well structured,yet beautiful little series. Did you drop it or something 😅?
    Also,when the last Moments video was posted (you hearted and responded to one of the comments I made on it 😂),I was waiting for my final college entrance exams,and now I am in the second year of a Physics major. Your videos have been a real help and made me very enthusiastic as well! Thank you for that. Currently,I am looking to understand how I can figure out what specific fields I could be interested in, because currently I kinda like everything,so I can't explore deeply enough into something to understand how to pick a research project in it,and I think waiting for all the courses,I'll be too late. I just wanna know how an undergraduate goes about the process in general,because they have very limited exposure and information. Thanks in advance!

  • @SimicChameleon
    @SimicChameleon 11 місяців тому

    Good job in python andrew and i hope you doing good

  • @ajbulich
    @ajbulich Рік тому

    missed you Andrew my homie

  • @oni8337
    @oni8337 10 місяців тому

    Please derive the Pauli Equation

  • @swissengineer8453
    @swissengineer8453 10 місяців тому

    Would be matlab a better choice?

  • @titansxk8007
    @titansxk8007 10 місяців тому

    Yo Andrew...... still waiting for that qft series

  • @lalitasharma6687
    @lalitasharma6687 11 місяців тому +1

    Are you using espresso??

  • @multifan9671
    @multifan9671 Рік тому

    Im not from the US, and I want to study physics there, but I don't understand your university system. Can u explain it to me? Do you start with undergrad and then specialise in grad? Is it a bachelor? How many years do I study in physics?

  • @meinbuch9458
    @meinbuch9458 Рік тому

    Hey Andrew, did you happen to post that QnA video from HUGS 2023 somewhere?

  • @Stoic_Persistence
    @Stoic_Persistence 11 місяців тому

    Have you played the new game starfield. It's great for those interested in science and space exploration.

  • @princekhadka5481
    @princekhadka5481 11 місяців тому

    Andrew ! Please do one meme review.
    I like when are you fun things😅😮

  • @kingarth0r
    @kingarth0r Рік тому +1

    ANDREW DOTSON IS THE GOAT

  • @hillwin10
    @hillwin10 Рік тому +2

    Just do it numerically lol. 😉

  • @karnvirbhangu334
    @karnvirbhangu334 11 місяців тому

    How is your PhD going? Have you begun thesis writing?

  • @korakatk318
    @korakatk318 Рік тому

    I don’t know if you’ll see this but I was wondering did you learn to program from undergrad programming courses or from reading through docs when you began research?

    • @AndrewDotsonvideos
      @AndrewDotsonvideos  Рік тому +1

      I took a couple coding classes in undergrad but had to learn basic python before hand during my first internship kind of on the fly.

    • @korakatk318
      @korakatk318 Рік тому

      @@AndrewDotsonvideos Thank you! Hopefully I’ll be able to do the same haha

    • @ytpanda398
      @ytpanda398 Рік тому +1

      @@korakatk318 you'll be fine, you'd be surprised how quickly you can pick things up with UA-cam videos, stack, and a focused question to ask

  • @youtubegaming3281
    @youtubegaming3281 Рік тому

    I am currently btech 1st year at IIT H engineering science. I also want to be in research .

  • @dylansamuel206
    @dylansamuel206 Рік тому

    Where’s your response to Oppenheimer Dotson we’re all waiting

  • @MapleProf
    @MapleProf 6 місяців тому

    The presentation is fine. Your humor is appreciated. But using Python to solve a problem like this is like using your hand to pound a nail into a board. It works, but it is so painful that you wonder if it is worth it. Others and I have pointed out that tools such as Maple or Mathematica make the process far easier. That is why I offered an _unsponsored_ video response. The numerical integral is one line. The plot is another. Would you appreciate a shorter and less academic video?

    • @AndrewDotsonvideos
      @AndrewDotsonvideos  6 місяців тому

      I agree that I would prefer to do this type of integral in a language like Mathematica or maple. I haven't used maple personally, I'm sure it's great, especially if you already know maple. If python is what you know, I don't see any issue with doing it this way. Especially since it's a free alternative to proprietary languages like Mathematica and (I think) maple, which not all institutions provide the licensing for.
      The best language is the language you know how to solve the problem in! I'll refer people to your videos next time someone asks me about maple!

    • @MapleProf
      @MapleProf 6 місяців тому

      @@AndrewDotsonvideos Fair enough if the institution does not provide a site license. However, a student's edition for Maple is $150 for the time the person is in school. And I believe Mathematica has a similar licensing system. Thanks for the referral. It was your humorous videos that I have shown in class that caused me to look up your channel again. I empathize with you on your experience of retaking the qualifiers and wish you well in completing your Ph.D.

  • @watcher8582
    @watcher8582 Рік тому

    sounds volume and zoom slightly off

  • @nathanieljefferies5491
    @nathanieljefferies5491 Рік тому

    As of now, seeing a seeing a surface integral just gives me a panic attack hahaha…Literally two weeks starting my sem first year physics degree and I self studied calculus over the summer but hit a literal roadblock (face first into concrete btw bloody nose) the moment I had to integrate by parts…non-polynomial Integrals just feels like the same giant leap you make from arithmetic to basic algebra when you see a letter in the place of a number😂😂😂

  • @andrew-ub4ku
    @andrew-ub4ku Рік тому

    W video :D

  • @Aycore2011
    @Aycore2011 Рік тому +1

    5th

  • @Hippienolic2
    @Hippienolic2 Рік тому +6

    Embarrassing, didn’t write perfect code the first time. Must be a theoretical physicist

    • @AndrewDotsonvideos
      @AndrewDotsonvideos  Рік тому +3

      😂 I can count on one finger how many of my codes have worked right out of the box

  • @jennette1992
    @jennette1992 Рік тому

    How are youuuu?

  • @mzubuki
    @mzubuki 8 місяців тому

    A story from the book of 1 Kings, where a prophet by the name of Elijah when he beheld 400 false prophets of the false object of worship called Baal said to them if you think you're God to be the answer then assemble yourselves and call me fire down from heaven; Elijah said to them likewise shall I do the same as the story goes the 400 false prophets of the false being made themselves a bunch of ruckus calling out to the lie they believed.
    Elijah surely used scripture from the word of God the Old Testament or Old Covenant or Agreement and fire did fall from heaven.
    The more you get right about God the more he shows up.
    God is a spirit those that worship him must do so in spirit and in truth. John 4:24
    Don't just have faith, have faith in God, and his word. There is surely a type of extreme unpleasantness already in the Earth, have you seen it, are you delivered from it?
    Job 38:17 "Have the gates of death been opened unto thee? or hast thou seen the doors of the shadow of death?"
    Job 38:33 "33 Knowest thou the ordinances of heaven? canst thou set the dominion thereof in the earth?"
    As a child, I would have dreams in be in many nightmares where underground tentacle monsters could sense my slightest movement and impel me,
    wars, dreams of persecution, the grim Reaper, things would get wild. I remember calling on the Old Testament name of God Jehovah, and I remember things
    did not end well for me when I was being assaulted by a witch. However, ever since I was a child the name of Jesus has never failed me, when I began to call on his name
    Even recently, a spider demon with a human face around the size a 42" TV was crawling on my wall when I awoke from my sleep.
    I spoke the name of Jesus quite a few times and I attained Mercy unto myself, for that because Jesus has the authority for this reason.
    John 3:35 " He that believeth on the Son hath everlasting life: and he that believeth not the Son shall not see life; but the wrath of God abideth on him."
    1 John 2:23 "Whosoever denieth the Son, the same hath not the Father: (but) he that acknowledgeth the Son hath the Father also."
    I believe that God cares for his creation and doesn't want to lose them, because I believed in Jesus and had the humility to honor his name many times throughout my life.
    I attained mercy through the New Covenant, agreement, or Testament. Only parts of the old still apply. The old prepared place for the New.
    I believe Love is many things, and is doing many things read 1 Corinthians 13:4-8 (KJV) and study the language of the time (Middle English), saying an agreement to do some things all the time, and some things so long as it is not provoked which is not easily accomplished. Look at the Greek interlinear and see what to it says. Love is kind while not provoked and is out to to preserve and protect you not always for your short-term satiation but your long-term health, wealth, and viability.
    John 1:1 "In the beginning was the Word, and the Word was with God, and the Word was God."
    John 1:14 "And the Word:λόγος(in ancient Greek) message, expression of God's ideas), was made flesh, and dwelt among us, (and we beheld his glory, the glory as of the only begotten of the Father,) full of grace and truth."
    For if I read James 1:5 (KJV), do not leave out James 1:6,7, and 8 (KJV),
    and while we at it live by every word that proceedeth out of the mouth of God.~Matthew 4:4
    If there are 18000+ religions in the world I know to whom I say go to save me trouble, the name and the ideas that I will confess as Lord to be serving of and to call my friend.
    Proverbs 4:19 “The way of the wicked is as darkness: they know not at what they stumble.”
    A concept of the word is the idea that is behind it or what should pop into your head by what the author is meaning. If you do not have the idea of the word correct you have a misconception and it changes the whole story.
    Read the KJV, pray for wisdom, pray without ceasing: don't go a day without it.
    Genesis 18:14 "14 Is any thing too hard for the Lord? At the time appointed I will return unto thee, according to the time of life, and Sarah shall have a son."
    El Shaddai, is one of God's names: meaning, the Almighty. The deductions you can make with your eyes are not as important to me as the decisions you can make with your heart.
    I believe God set the stage before we got to the play. God putting bones in the ground isn't him being deceptive, he wants to know if we will be presumptuous.
    The keys to the Kingdom of Heaven are for everyone who becomes apart of the Citizenry of the Eternal Goverment. I think much of Catholicism is Apostate from the original intent of Jesus.
    See. Revelations 3:7-8

  • @aliqui756
    @aliqui756 Рік тому +1

    Man.

  • @stephendaedalus7841
    @stephendaedalus7841 Рік тому

    A standup product, huh?

  • @mrbot1954
    @mrbot1954 Рік тому

    Bro doesn't own a shaver

  • @Gbzildo
    @Gbzildo Рік тому

    So you started dating Taylor Swift right?

  • @dyer308
    @dyer308 Рік тому

    I think it looks a bit cleaner to add @np.vectorize decorator over the function you want vectorize.

  • @itstomis
    @itstomis Рік тому +15

    Confession: in university any time our profs allowed us to do numerical integrations to arrive at final solutions for homework problems, I just plugged them into Wolfram Alpha. Then I drew an arrow from the integral to the result and wrote "MATLAB" beside the arrow.

  • @maureendotson4634
    @maureendotson4634 Рік тому +7

    #5! Closest I’ve been in a long time. Hehe 🙃

  • @boltez6507
    @boltez6507 10 місяців тому +1

    can you answer a question(unrelated to this video)??
    In the traditional way of deriving intensity distribution in case of single slit(fraunhofer diffraction)using phasors why do we assume that the scalar summation of Electric fields of wavelets reaching any point is equal to the summation of electric field at the central maxima?(does this imply that same number of wavelets reach every point on screen)

  • @drover7476
    @drover7476 Рік тому

    Jesse Kyle is moving up in the world