Solving Differential Equations In Python In Less Than 5 Minutes (General Solution)

  Рет қаралды 98,563

Andrew Dotson

Andrew Dotson

Күн бұрын

Пікірлер: 117
@SmajdalfFrogi12
@SmajdalfFrogi12 5 жыл бұрын
Andrew: "equation function" Classes: am I a joke to you?
@mattRRgraham1996
@mattRRgraham1996 6 жыл бұрын
While I didn't use python for it, I used Matlab to solve for some interesting nonlinear differential equations in my Nonlinear Dynamics and Chaos Theory class. I used Matlab to play with the Lorenz equations and reproduce his results in his original paper which was SUPER cool. I'd be happy to send you my code if you'd want. That was probably my favorite thing I did in the class. Idk if I still have it or not, but there was also a general relativity equation that I used Matlab to help solve because it wasn't immediately obvious to me what to do on paper for the homework assignment, so I tried using Matlab instead. I love these Coding videos and hearing about what's going on with you and grad school, research internship, etc., it's inspiring! Keep up the good work man! I love this channel. It's a gem amongst the sea of youtubers. I'll be applying to math grad school this upcoming fall so it's nice to see somebody in similar shoes a bit further down the road from me.
@abhaspradhan1459
@abhaspradhan1459 5 жыл бұрын
I am actually planning to solve the Lorenz equations too and that's why I'm here!
@amangangwar2535
@amangangwar2535 4 жыл бұрын
how to solve nonlinear second order diff eqq Matlab or python?
@bilalhussein9730
@bilalhussein9730 4 жыл бұрын
@@amangangwar2535 I prefer Mathematica for DEs: reference.wolfram.com/language/tutorial/DSolveOrdinaryDifferentialEquations.html#6538. Matlab works fine too: www.mathworks.com/help/symbolic/solve-a-single-differential-equation.html#:~:text=Represent%20the%20derivative%20by%20creating,Solve%20ode%20for%20y%20 though.
@leonardocabrera9253
@leonardocabrera9253 3 жыл бұрын
Python is free so Matlab is not an alternative for non students.
@temiladeadeniran7811
@temiladeadeniran7811 7 ай бұрын
Can I see your code ? …. The one you used to solve Lorenz equations
@quahntasy
@quahntasy 6 жыл бұрын
I love these coding videos.Keep it up!
@amearaadan9214
@amearaadan9214 Жыл бұрын
THANK U!! I decided to do nothing for my coding module this entire semester thinking we had no work then he throws an individual project at us worth 50% of the module due in a few days so I have to learn everything I missed rlly quick:( this helped a lot
@danburstein1637
@danburstein1637 2 ай бұрын
The explanation is very good. Do you have a video that explain how to solve the differential equation with initial conditions?
@prashant.tiwariOO7
@prashant.tiwariOO7 2 жыл бұрын
Short , simple and clear. great
@ゾカリクゾ
@ゾカリクゾ 6 жыл бұрын
also do some numerical solution to a differential equation! (preferably one with no analytical solution, such as the pendulum one, or if you can do it, some crazy thing with pendulums, atwood machines and springs using lagrangians and stuff)
@miltonincsw
@miltonincsw 5 жыл бұрын
Ryan Reynolds teaching python, can life get better than this
@leonardocabrera9253
@leonardocabrera9253 3 жыл бұрын
Hey does someone know hot to plot the solutions, and how to define initial values to find c1 and c 2?
@xabiergarciaandrade2656
@xabiergarciaandrade2656 6 жыл бұрын
Mmm why do you use two lines of code to import the whole sympy library instead of just typing import sympy as sp?
@starship1701
@starship1701 6 жыл бұрын
Cool! I like how simple it is. What resource(s) did you use to learn how to code in python, just in general?
@Mark00747
@Mark00747 6 жыл бұрын
How can you solve for the constants in Python?
@thed_motivation4897
@thed_motivation4897 Жыл бұрын
I love the video. But, I am using Python 3.11.4 and it isn't running this particular code. I am using window 11, please do recommend site to check for download for this to work. Can this work for fourth differential equation
@AstroRoxy
@AstroRoxy 6 жыл бұрын
I'm too jus getting started in python, somewhere in the loops section, even though I didn't understood how u got the end result, I hav did the exact same in paper, looking forward to solve using python too. will come here, when I do that 😎
@malayapaul458
@malayapaul458 6 жыл бұрын
Can you please start a series on learning python
@shamsnoor7043
@shamsnoor7043 5 жыл бұрын
Eq(-5*f(x) + Derivative(f(x), (x, 2)), 0) This keeps appearing as my output instead of the clear d/dx form your output takes. Could you please point out what I'm doing wrong?
@tonynguyen8166
@tonynguyen8166 4 жыл бұрын
Im late to this but what did u use print instead of display? print just prints out what u wrote display shows the function in the correct form.
@shamsnoor7043
@shamsnoor7043 4 жыл бұрын
@@tonynguyen8166 Apparently I was missing a map file when I was using Pycharm. I started using Jupyter later on and the program itself prompted me to download the missing file. The issue got fixed by that.
@tonynguyen8166
@tonynguyen8166 4 жыл бұрын
@@shamsnoor7043 That also makes sense the program shouldnt run if you don't have the package for it. Just out of curiosity why were u using pycharm? I only use notebook since it has most of the packages i need and it's easier to read and view.
@piyomaru479
@piyomaru479 4 жыл бұрын
I used python application and we're having the same result. I don't know how to fix it. 😭
@tonynguyen8166
@tonynguyen8166 4 жыл бұрын
@@piyomaru479 if you are using python instead of juypter u r gonna have to download the sympy package
@kayeassy
@kayeassy 6 жыл бұрын
Well can we solve for special functions as well??
@parzival_zd_1156
@parzival_zd_1156 6 жыл бұрын
Nice..😄😄👍👍 I'm also Learning... Python..😅😅 I've started before a Week. 😆😆 This Journey of Learning Python is Going Good...😅 I hope I will learn All very Soon..😆😆😆😆
@DanielLima-bd8sv
@DanielLima-bd8sv 5 жыл бұрын
Great videos! Helped me a lot. Could you please make a video about PDE's ? Thanks
@hakulab920
@hakulab920 2 жыл бұрын
why did you write both "from sympy import *" and "import sympy as sp" ? Can I use import sympy as sp only?
@ashutoshsharma1640
@ashutoshsharma1640 4 жыл бұрын
Thanks a lot a very helpful and nicely made crisp video
@LeMon-ss3us
@LeMon-ss3us 2 жыл бұрын
How can i write cos and sin in this code cuz i have trying and it appears a error named cant convert expresstion to float
@nonamenoname2618
@nonamenoname2618 3 жыл бұрын
Are there step-by-step solutions for this, like there are for Wolframalpha?
@ahmadalghooneh2105
@ahmadalghooneh2105 5 жыл бұрын
Dear andrew, people are mostly interested in numerical solvers, do you have a video about that?
@Oakenhelm1
@Oakenhelm1 6 жыл бұрын
Nice vid, easier to follow than my class is
@aishwaryadas2859
@aishwaryadas2859 2 жыл бұрын
Thanks for this video, can you do the same for delayed differential equation using ddeint. I want to try it for multiple delays. Can you help me out?
@ywk7282
@ywk7282 2 жыл бұрын
Thank you fo rthe video!!:) Is there any way to put in values in x and get the output values form f? If there is it would be great to know
@googlegoogle1610
@googlegoogle1610 2 жыл бұрын
Please, can you teach us how to solve the finite difference method in python?
@Israel220500
@Israel220500 5 жыл бұрын
Why bother importing sympy as sp if you already polluted the namespace?
@sheikhakbar2067
@sheikhakbar2067 4 жыл бұрын
Excellent video, thank you very much!
@carloswayne8640
@carloswayne8640 3 жыл бұрын
Hi! I would like to know how to define a constant in the code. I ought to solve an equation with no number constants. I really liked your video
@MrZak-rf3vq
@MrZak-rf3vq 4 жыл бұрын
This is literally magic.
@Katabatic44
@Katabatic44 5 жыл бұрын
did you learn programming before or after starting grad school?
@charlesmarseille123
@charlesmarseille123 4 жыл бұрын
the first day you ask about coding should be the first day you start. Whatever your background, skills or grades. If you can google, you can code.
@unknown360ful
@unknown360ful 6 жыл бұрын
Hey Andrew! Nice vid! But just wondering, why do you call that format 'LATECH', isn't it LATEX? As in Latex the material?
@unknown360ful
@unknown360ful 6 жыл бұрын
Thanks! It really was helpful! I had no clue! I always thought it was LATEX as in the material...
6 жыл бұрын
Hey man don’t mention it, I thought so at first too, and had been using it for some time, then I told my friends if they had used it too, and when I said Lay Tex, they laughed at me lol. I had never read the “about” tab and had been out of the know of the true pronunciation. But now I know, we all make mistakes ;D
@heyredwhale
@heyredwhale 6 жыл бұрын
Actually that is just partially true. TeX, the typesetting sytem LaTeX is build on, is an abbreviation for the Greek "techne", so the letters are actually the Greek letters tau epsilon chi. Chi is pronounced differently than the English X and it is there the pronunciation of TeX comes from.
@carlosvargas2907
@carlosvargas2907 6 жыл бұрын
Don't care. I'll say LAHTEKS
@sauvikdas5932
@sauvikdas5932 5 жыл бұрын
If I want to solve some differential eqtn containing exponential terms. What should I write?
@abhisheksingh-xf8kb
@abhisheksingh-xf8kb 3 жыл бұрын
How can I solve n second order coupled differential equation (Fermi pasta ulam chain)
@ruffnck4637
@ruffnck4637 5 жыл бұрын
What about the system of equations?
@TheNewPhysics
@TheNewPhysics 3 жыл бұрын
What about nonlinear differential equations?
@VishalSingh-zs5tr
@VishalSingh-zs5tr 3 жыл бұрын
Sir can u show how to solve fourth order differential equation in two variables x,y
@rickandelon9374
@rickandelon9374 5 жыл бұрын
Andrew, Can I ask you why are you not using Mathematica?
@raulrios5748
@raulrios5748 4 жыл бұрын
I need to get the c1 and c2 values, how can I do that?, I already have the initial conditions.
@sayanjitb
@sayanjitb 4 жыл бұрын
Just insert initial conditions into the solution and solve for c1 and c2
@dracula2227
@dracula2227 4 жыл бұрын
@@sayanjitb how do we do that?
@sayanjitb
@sayanjitb 4 жыл бұрын
@@dracula2227general solution of a second-order diff equation contains two arbitrary constants, and in order to fix those just insert two initial values or boundary values that are already provided to you.
@oanmachi2629
@oanmachi2629 5 жыл бұрын
so for example, if i want to set f(0)=1 to sovle C1, C2. plz tell me how to write that?
@sayansagar6868
@sayansagar6868 4 жыл бұрын
Hello Andrew why are you used "printing, latex=true" statement here. I can't understand the 2 nd line of programming. Explain me brother
@ejinduyoung5046
@ejinduyoung5046 4 жыл бұрын
How do you account for initial conditions?
@hamidouhrir4910
@hamidouhrir4910 4 жыл бұрын
Pls How to use that solution to plot. Thnks
@jacobkammer2843
@jacobkammer2843 4 жыл бұрын
what does * signify in the third line of code where your are importing sympy?
@jacobkammer2843
@jacobkammer2843 4 жыл бұрын
@@AbhishekSharmaabolt9 Thanks. I had never seen that in the past so thought it was strange and now I know not recommended. thanks a bunch
@anuragmishra6262
@anuragmishra6262 4 жыл бұрын
It was really helpful
@abhisheksingh-xf8kb
@abhisheksingh-xf8kb 4 жыл бұрын
Sir, I want to use solution of differential Equation in other code of python how can I do this.
@teben2622
@teben2622 4 жыл бұрын
Is this pde or ode?
@dracula2227
@dracula2227 4 жыл бұрын
F
@dracula2227
@dracula2227 4 жыл бұрын
ode
@yinyl
@yinyl 4 жыл бұрын
cool video~ Thanks
@AdityaKumar-ij5ok
@AdityaKumar-ij5ok 6 жыл бұрын
I came across this differential equation while studying damped oscillation can you please tell how to solve it? M x'' + B x' + K x = 0 The derivatives of position are, of course, with respect to time.
@gagers78
@gagers78 6 жыл бұрын
use an auxiliary equation method. let x = e^kt and differentiate to get x' and x''. then you should get a quadratic in terms of k and the constants of the differential equation all multiplied by e^kt. You can then divide through by e^kt to get a quadratic you can solve in k. This gives you 2 solutions. The general solution is then x=c1e^k1t+c2e^k2t. It will look nicer when you write it out. If the values are complex it will still work just the constants c1,c2 are different. you could expand the equation out using Euler's formula to get a function in sin and cos. Alternatively if k1,k2 are complex rework the question but with x=c1sin(k1t)+c2cos(k2t) as your function to differentiate.
@prateekyadav7679
@prateekyadav7679 2 жыл бұрын
How to define f?
@SO-dl2pv
@SO-dl2pv 6 жыл бұрын
if you have already imported everything from sympy then why do bother yourself using sp prefix? or if you have imported sympy as sp then why you import everything from sympy!!!!!
@bladerunner005
@bladerunner005 6 жыл бұрын
I was also thinking the same!
@MosPol1698
@MosPol1698 3 жыл бұрын
Hello , please how can I plot this Equations ? please
@elafmoataz6051
@elafmoataz6051 4 жыл бұрын
Can you please help me solving this non linear second ODE. i^2 = (m/Kt) * X'' + (K/Kt) X? TIA.
@elafmoataz6051
@elafmoataz6051 4 жыл бұрын
i need di/dt
@Felipe-53
@Felipe-53 4 жыл бұрын
good one, thanks!
@khanrabbi5465
@khanrabbi5465 6 жыл бұрын
Hello Andrew. Thank you for your wonderful video. I want to know how I can use Python to solve 3rd order non-linear homogenous ODE like below: d3y/dx3 = (dy/dx)^2 - y*(d2y/dx2)
@tonynguyen8166
@tonynguyen8166 4 жыл бұрын
U use sympy the same as what he did all u do is adjust the equation that he wrote to urs.
@loconino5498
@loconino5498 Жыл бұрын
thank you so much
@santiagobrouardmartin965
@santiagobrouardmartin965 4 жыл бұрын
Thank you for the video, Andrew. I tried to solve something like {dy/dt +b*x+a*y= 0, dx/dt- b*y-a*x=0}, with a and b being arbitrary constants, and get into trouble with dsolve. Could you help me with that, please?
@oulimatatall5567
@oulimatatall5567 4 жыл бұрын
how to get C1?
@MathPhysicsFunwithGus
@MathPhysicsFunwithGus 4 жыл бұрын
please do a P.D.E video!
@sajalagrawal3495
@sajalagrawal3495 3 жыл бұрын
Did you get the stuff on how to solve PDE?
@MathPhysicsFunwithGus
@MathPhysicsFunwithGus 3 жыл бұрын
@@sajalagrawal3495 I did not
@saibharath5510
@saibharath5510 4 жыл бұрын
Thanks man!!!
@mrinalrajak5526
@mrinalrajak5526 5 жыл бұрын
Thank you Sir....
@engineering_chaos2749
@engineering_chaos2749 3 жыл бұрын
Love this
@mther123
@mther123 6 жыл бұрын
Great
@NTC
@NTC 2 жыл бұрын
you're smart! :D
@begatbegat7273
@begatbegat7273 5 жыл бұрын
thank you!
@nurudeennajeem6605
@nurudeennajeem6605 Жыл бұрын
Thanks
@vijayyadav3673
@vijayyadav3673 2 жыл бұрын
Dear Andrew can you please solve the equation dG/dt=G_in-f_2 (G(t))-f_3 (G(t)) f_4 (I(t-τ_2))+c dI/dt=f_1 (G(t-τ_1)) (k_0 I(t-τ_2))/(e^cI(t-τ_2 ) -1)-d_i (t) also plot plot the solution. thanks
@lisaroy.588
@lisaroy.588 Жыл бұрын
Cool
@darchcruise
@darchcruise 6 жыл бұрын
Hi Andrew. Do you tutor (Diff Equation) via Skype?
@GojoSenpai25
@GojoSenpai25 6 жыл бұрын
Why use python when matlab can solve 2nd order dif eqs
@edvanbruggen550
@edvanbruggen550 6 жыл бұрын
Python is free, open source, and the standard in the scientific community
@GojoSenpai25
@GojoSenpai25 6 жыл бұрын
Ed van Bruggen however at least in engineering they care more about using matlab plus some universities have access to it for free
@edvanbruggen550
@edvanbruggen550 6 жыл бұрын
DocAlex yeah I true Matlab is more common in engineering circles compared to the scientific world, in my experience in research there seems to be a slow shift away from matlab. I go to a large research university and while a lot of our applied math classes are in matlab we do not get it free. From what I can tell most no physicists use matlab and it is completely unheard of in astronomy, both using mainly python, and some C++ or even fortan. While I can tell it is definitely much more common in engineering most engineerings I have worked with prefer to use python when possible.
@edgardparra6497
@edgardparra6497 6 жыл бұрын
If your job is to make software, then you need to do differential equations in python, C, or whatever the environment that you require. Since your asking why use python, then you're obviously not a software developer. Stick to Matlab if that's what you know.
@abhinaba__saha
@abhinaba__saha 4 жыл бұрын
this is magic
@annie_munoz
@annie_munoz 5 жыл бұрын
OMG Thank you!!!!!!!!!!
@fraktasticful
@fraktasticful 5 жыл бұрын
Why is Ben Affleck teaching me python?
@chadurdy7555
@chadurdy7555 3 жыл бұрын
😧🤯🧠✨😎🖤
@jake_runs_the_world
@jake_runs_the_world 6 жыл бұрын
Where's your beard
@andrewtran6669
@andrewtran6669 6 жыл бұрын
a better place.
@prateek2849
@prateek2849 6 жыл бұрын
I gave it the equation for *forced damped oscillations* and 'he' (not assuming genders, sorry feminists) solved it beautifully 👏😂
How to Solve Differential Equations in PYTHON
23:37
Mr. P Solver
Рет қаралды 114 М.
Naming Things in Code
7:25
CodeAesthetic
Рет қаралды 2,3 МЛН
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
Tuna 🍣 ​⁠@patrickzeinali ​⁠@ChefRush
00:48
albert_cancook
Рет қаралды 148 МЛН
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41
5 Useful F-String Tricks In Python
10:02
Indently
Рет қаралды 342 М.
Ordinary Differential Equations - SymPy Tutorial 10
12:42
TM Quest
Рет қаралды 17 М.
Physics Students Need to Know These 5 Methods for Differential Equations
30:36
Physics with Elliot
Рет қаралды 1,1 МЛН
Please Master These 10 Python Functions…
22:17
Tech With Tim
Рет қаралды 261 М.
Solving PDEs with the FFT [Python]
14:56
Steve Brunton
Рет қаралды 52 М.
What does the second derivative actually do in math and physics?
15:19
How to Solve Coupled Differential Equations ODEs in Python
10:12
Vincent Stevenson
Рет қаралды 54 М.
This is why you're learning differential equations
18:36
Zach Star
Рет қаралды 3,6 МЛН
Maps in C++ (std::map and std::unordered_map)
30:00
The Cherno
Рет қаралды 230 М.
Eigenstates of ANY 1D Potential in PYTHON
19:41
Mr. P Solver
Рет қаралды 38 М.
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН