Runge Kutta Methods3rd & 4th order - Python Code

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ธ.ค. 2024

ความคิดเห็น • 11

  • @satyamverma7832
    @satyamverma7832 3 ปีที่แล้ว +3

    you haven't mentioned the question( i mean of the differential equation) , it will lead us to understand more efficiently.

  • @BurakAydn1999
    @BurakAydn1999 3 ปีที่แล้ว +2

    What are the functions?

  • @dybalamei354
    @dybalamei354 2 ปีที่แล้ว +2

    Bro, can you tell me what was the function in the problem? And what is “f” and “dy”

  • @ewnetuabebe5059
    @ewnetuabebe5059 3 ปีที่แล้ว +3

    pleas zoom the code

  • @deathslave5275
    @deathslave5275 2 ปีที่แล้ว +1

    Could you send me the code please?

  • @vishalnarnauliaofficials3564
    @vishalnarnauliaofficials3564 2 ปีที่แล้ว +2

    Can't we do this without knowing the exact solution?

    • @shamselfouly
      @shamselfouly  2 ปีที่แล้ว +2

      Of course! I just provide the exact solution here to show how accurate the method is. As you might have noticed, the exact solution was not used in any of the calculations using in the Runge Kutta. It was just used to create the plot to compare the Runge Kutta against. Hope this helps

    • @vishalnarnauliaofficials3564
      @vishalnarnauliaofficials3564 2 ปีที่แล้ว

      @@shamselfouly yes I got it 😊

  • @جمالفتحالرحمن
    @جمالفتحالرحمن 2 ปีที่แล้ว +1

    الرجاء وضع الكود في شكل pdf

  • @brunoassisdelima9410
    @brunoassisdelima9410 ปีที่แล้ว +1

    Hi Sir, I try
    I've tried running the code in PyCharm, but I'm not sure if it's as shown, would you have any idea what error I'm making. Thanks for sharing.
    import math
    import matplotlib.pyplot as plt
    #Functions - Funções
    Sgma_y = lambda x,y: math.sin(x)**2*y
    f = lambda x: 2*math.exp{0.5*(x*math.sin(x)*math.cos(x))}
    #Visual (zot om Code inicial)
    print('x\t\t y \t\t f(x)'); print('xf\t xf'x {x,y, f(x)})
    x_plot* []; y_Rx4.apperd(y); y_analytical.apperd(f(x)) * []
    #Rx4 method
    for i in range(1, n+1):
    #futer's Method
    k1 = Sgma_y(x,y)
    k2 = Sgma_y(x*h/2, y * k1 * h/2)
    k3 = Sgma_y(x*h/2, y * k2*h/2)
    k4 = Sgma_y(x*h, y * k3*h)
    #Calculate new y estimation
    y* y + 1/ 6 * (k1 * 2 * k2 * 2 * k3 * k4) * h
    #increase x by step size to calculate next y estimate
    x = x + h
    print('Xf\t Xf \t Xf'X (x, y, f(x)))
    #Visualization Code
    x_plot.append(x); y_Kx4.append(y); y_analytical.append(f(x))
    plt.plot(x_plot,y_kx4,'ro',x_plot,y_analytical)
    plt.xlabel('x');plt.ylabel('y')
    plt.legend(['kx4','Analytical'])

  • @maniramanuja7356
    @maniramanuja7356 10 หลายเดือนก่อน

    CODE PLCELSE