Second Order Differential Equation Using Python

Sdílet
Vložit
  • čas přidán 24. 11. 2022
  • This video demonstrates how to solve a second order differential equation using python. The library used is odeint, which is available in scipy.integrate. This solve the equation numerically.
    Another way of solving a second order differential equation is using Sympy. This method gives analytical solution. The advantage is that you get the form of the solution. This allows us to know the function. This is of great values in science and mathematics. The video for this is given below.
    • Solving a Second Order...
  • Věda a technologie

Komentáře • 15

  • @lLuckM3412
    @lLuckM3412 Před 4 měsíci +1

    I didn´t quite understand why in sode we set z=y, could you give a little more insight please?

  • @moirangthemsanahal6695
    @moirangthemsanahal6695 Před 3 měsíci +1

    I cant understand the line no 2. What do you mean by y,z=y ???

  • @user-dy9ie1lj4c
    @user-dy9ie1lj4c Před 5 měsíci

    how can we solve the second-order heterogeneous ode? (form of y'' + y' + y = g)

    • @profarvind
      @profarvind  Před 5 měsíci

      Define dy/dx =z, from where we have, dz/dx-z+y-g=0. g is treated as a constant. You will have to assume a value of g, say 9, and run the code.

  • @yogirajput9459
    @yogirajput9459 Před rokem

    can we solve the differential equation using RK method of 2nd or 4th order in python?

    • @profarvind
      @profarvind  Před rokem

      Yes, look up for RK23 and RK45 methods in scripy.integrate.

  • @mohammadhamza232
    @mohammadhamza232 Před 8 měsíci

    plt.plot(x,sol[ ;,0], sir could you please tell me what does this blank space mean

    • @profarvind
      @profarvind  Před 8 měsíci

      watch, czcams.com/video/XO7nvpmAAnA/video.html

    • @profarvind
      @profarvind  Před 8 měsíci

      It reads all the rows from the first column of the sol array. The sol variable is an array. The rows are values of y and it has one column

  • @user-zv7vo9iw2n
    @user-zv7vo9iw2n Před měsícem

    Public listing please

  • @the_sophile
    @the_sophile Před rokem

    from scipy.integrate import odeint
    import matplotlib.pyplot as plt
    import numpy as np
    def sode(y,x):
    y,z=y
    dydx=[z,6*y-z]
    return dydx
    x=np.linspace(0,1,100)
    sol=odeint(sode,[5,-5],x)
    plt.plot(x,sol)
    Isn't this the complete code?
    For some reason, this is showing no result or error message or anything.
    Can you help?

    • @profarvind
      @profarvind  Před rokem

      I can't share the screenshot, but the program executes on my computer. It is perfectly okay.
      What is the error you are getting?

    • @profarvind
      @profarvind  Před rokem

      Works perfectly okay on my computer. Since you are not receiving any error or plot, I suggest you add an extra code plt.show at the end. Good luck.