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.
@@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.
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
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)
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 😎
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..😆😆😆😆
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 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.
@@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.
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
@@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.
Thanks! It really was helpful! I had no clue! I always thought it was LATEX as in the material...
6 лет назад+3
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
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.
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.
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.
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)
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!!!!!
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?
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
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.
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.
Andrew: "equation function"
Classes: am I a joke to you?
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.
I am actually planning to solve the Lorenz equations too and that's why I'm here!
how to solve nonlinear second order diff eqq Matlab or python?
@@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.
Python is free so Matlab is not an alternative for non students.
Can I see your code ? …. The one you used to solve Lorenz equations
I love these coding videos.Keep it up!
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
Short , simple and clear. great
Ryan Reynolds teaching python, can life get better than this
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)
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 😎
The explanation is very good. Do you have a video that explain how to solve the differential equation with initial conditions?
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..😆😆😆😆
Nice vid, easier to follow than my class is
Thanks a lot a very helpful and nicely made crisp video
Great videos! Helped me a lot. Could you please make a video about PDE's ? Thanks
This is literally magic.
Hey does someone know hot to plot the solutions, and how to define initial values to find c1 and c 2?
Cool! I like how simple it is.
What resource(s) did you use to learn how to code in python, just in general?
Mmm why do you use two lines of code to import the whole sympy library instead of just typing import sympy as sp?
Excellent video, thank you very much!
How can you solve for the constants in Python?
Can you please start a series on learning python
why did you write both "from sympy import *" and "import sympy as sp" ? Can I use import sympy as sp only?
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?
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.
@@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.
@@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.
I used python application and we're having the same result. I don't know how to fix it. 😭
@@piyomaru479 if you are using python instead of juypter u r gonna have to download the sympy package
Are there step-by-step solutions for this, like there are for Wolframalpha?
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
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
Well can we solve for special functions as well??
It was really helpful
I need to get the c1 and c2 values, how can I do that?, I already have the initial conditions.
Just insert initial conditions into the solution and solve for c1 and c2
@@sayanjitb how do we do that?
@@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.
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
Dear andrew, people are mostly interested in numerical solvers, do you have a video about that?
Please, can you teach us how to solve the finite difference method in python?
What about nonlinear differential equations?
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?
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
How do you account for initial conditions?
How can I solve n second order coupled differential equation (Fermi pasta ulam chain)
what does * signify in the third line of code where your are importing sympy?
@@AbhishekSharmaabolt9 Thanks. I had never seen that in the past so thought it was strange and now I know not recommended. thanks a bunch
If I want to solve some differential eqtn containing exponential terms. What should I write?
did you learn programming before or after starting grad school?
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.
so for example, if i want to set f(0)=1 to sovle C1, C2. plz tell me how to write that?
Hey Andrew! Nice vid! But just wondering, why do you call that format 'LATECH', isn't it LATEX? As in Latex the material?
Thanks! It really was helpful! I had no clue! I always thought it was LATEX as in the material...
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
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.
Don't care. I'll say LAHTEKS
Why bother importing sympy as sp if you already polluted the namespace?
What about the system of equations?
cool video~ Thanks
Pls How to use that solution to plot. Thnks
good one, thanks!
Sir can u show how to solve fourth order differential equation in two variables x,y
Love this
Sir, I want to use solution of differential Equation in other code of python how can I do this.
Hello Andrew why are you used "printing, latex=true" statement here. I can't understand the 2 nd line of programming. Explain me brother
Andrew, Can I ask you why are you not using Mathematica?
thank you so much
Great
Thanks man!!!
Is this pde or ode?
F
ode
Hello , please how can I plot this Equations ? please
How to define f?
please do a P.D.E video!
Did you get the stuff on how to solve PDE?
@@sajalagrawal3495 I did not
how to get C1?
Thank you Sir....
thank you!
Cool
Thanks
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.
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.
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)
U use sympy the same as what he did all u do is adjust the equation that he wrote to urs.
Can you please help me solving this non linear second ODE. i^2 = (m/Kt) * X'' + (K/Kt) X? TIA.
i need di/dt
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!!!!!
I was also thinking the same!
you're smart! :D
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?
this is magic
OMG Thank you!!!!!!!!!!
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
Hi Andrew. Do you tutor (Diff Equation) via Skype?
😧🤯🧠✨😎🖤
Why is Ben Affleck teaching me python?
Why use python when matlab can solve 2nd order dif eqs
Python is free, open source, and the standard in the scientific community
Ed van Bruggen however at least in engineering they care more about using matlab plus some universities have access to it for free
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.
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.
I gave it the equation for *forced damped oscillations* and 'he' (not assuming genders, sorry feminists) solved it beautifully 👏😂
Where's your beard
a better place.