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
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
Andrew putting up a video after so long and still have guts to start the video with a promotional message.
It was very stunning and brave
What are you trying to say? Money is good. And grad school is hard. Go away.
@@seanogary1205stop taking everything you read on the internet so seriously.
That is good advice. I have a tendency to take people very seriously.@@firstnamelastname492
@@AndrewDotsonvideos Yeah it was very sudden.
he bacc
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).
That sounds really cool! Engineerings not the dark side lol, ya'll keep the lights on🤣
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.
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!
@@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
@@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.
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.
Firmly appreciate this. Always great to see you shed some light on valuable information.
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 😅
@@AndrewDotsonvideos It goes a long way for sure! Props man
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
Wow that’s awesome, what is your masters on?
@@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!
@@AndrewDotsonvideosthis comment reminds me of Jese Kyle
@@lello.4925I miss Jesse Kyle. Glad I'm not the only one 😭😂.
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
You are a vampire, not using dark mode.
Everytime I see light mode I hear the CS:GO "Deploying a flashbang!" in my head.
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!
Godspeed
Godspeed
Yo bro
Same pfp
Always a pleasure to see you've uploaded, Andrew. I'm always impressed by the community you've got here too
Thanks a lot!
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)
Finally after 4 months he's back 🔥
Love ur vids
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 ❤
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🤣
@@AndrewDotsonvideos Can't believe I got a reply for the Tensorboi... but yeah that's 100% relatable 😂
@@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). 😅
Literally me rn
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.
Right on! Maybe see if they have a pgso and reach out to see if anyone is in that particular program.
He’s back! LET’S GOOO!🔥
Haven't seen a Python video in so long!
Haven’t seen a comment from you in so long! Hope all is well🙌🏻
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 :)
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).
Great video(I didn't watch it yet)
😂
This is great timing (I'm bad at code)
(Me 2)
Welcome back after 4 months
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
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!
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.
Ah Thanks!
Just use a PEP8 code fomatter like "black"
I like putting spaces tho, makes it look neater :(
Numerical Integration: Return of the King
Definitely cannot surpass E&M2: Electric Boogaloo
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
THE KING RETURNS AGAIN!
Mathematica has entered the chat...
Yeah seriously. Until that “enter activation key” hits when you least expect it
Loved the video! I wish I could convince my boss to let me play around with Python more.
Thanks Andrew, very epic
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
Great video of code to solve integrals. I hope your degree and research continues to go well.
Thanks for the video!
Please,Solve jee advance physics question 😊
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
There’s some stuff on stack exchange stackoverflow.com/questions/36816537/spherical-coordinates-plot , not sure if that helps without knowing a little more.
@@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.
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 🙂)
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
Nuclear phd fellow here :)) an experimentahatelist ❤
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!
Good job in python andrew and i hope you doing good
missed you Andrew my homie
Please derive the Pauli Equation
Would be matlab a better choice?
Yo Andrew...... still waiting for that qft series
Are you using espresso??
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?
Hey Andrew, did you happen to post that QnA video from HUGS 2023 somewhere?
Have you played the new game starfield. It's great for those interested in science and space exploration.
Andrew ! Please do one meme review.
I like when are you fun things😅😮
ANDREW DOTSON IS THE GOAT
Just do it numerically lol. 😉
How is your PhD going? Have you begun thesis writing?
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?
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.
@@AndrewDotsonvideos Thank you! Hopefully I’ll be able to do the same haha
@@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
I am currently btech 1st year at IIT H engineering science. I also want to be in research .
Where’s your response to Oppenheimer Dotson we’re all waiting
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?
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!
@@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.
sounds volume and zoom slightly off
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😂😂😂
W video :D
5th
Embarrassing, didn’t write perfect code the first time. Must be a theoretical physicist
😂 I can count on one finger how many of my codes have worked right out of the box
How are youuuu?
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
Man.
A standup product, huh?
;)
Bro doesn't own a shaver
So you started dating Taylor Swift right?
I think it looks a bit cleaner to add @np.vectorize decorator over the function you want vectorize.
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.
🤣 love it
#5! Closest I’ve been in a long time. Hehe 🙃
You must be the most supportive parent on UA-cam
@@ytpanda398^upvote
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)
Jesse Kyle is moving up in the world