Presentation is loading. Please wait.

Presentation is loading. Please wait.

TNPL JoongJin-Cho Runge-kutta’s method of order 4.

Similar presentations


Presentation on theme: "TNPL JoongJin-Cho Runge-kutta’s method of order 4."— Presentation transcript:

1 TNPL JoongJin-Cho Runge-kutta’s method of order 4

2 TNPL JoongJin-Cho This routine solve the initial value problem at equidistant points Here the function f(x,t) is continuous the at equidistant points Here the function f(x,t) is continuous theinterval Algorithm

3 TNPL JoongJin-Cho Algorithm

4 TNPL JoongJin-Cho Runge-Kutta ’ s method of order 4 to solve a first-order differential equation Algorithm

5 TNPL JoongJin-Cho public static void main(String args[]){ int i; double t,ti,h,x,xi, N=5; double f; //Differential equation dx/dt=f(x,t)=x+t double t0,x0,f1,f2,f3,f4; x=xi; t=ti; f=x+t; for(i=0;i

6 TNPL JoongJin-Cho import java.io.*; public class RungeKutta2{ static BufferedReader bf = new BufferedReader (new InputStreamReader(System.in)); //4th order Runge-Kutta method, need derivative f public static void main(String args[])throws IOException { int i; double t,ti,h,x,xi,N=5; double f; double t0,x0,f1,f2,f3,f4; String str; System.out.print("Input initial value ti = >"); str=bf.readLine(); ti=Double.parseDouble(str); System.out.print("Input initial value xi = >"); str=bf.readLine(); xi=Double.parseDouble(str); System.out.print("step size h = >"); str=bf.readLine(); h=Double.parseDouble(str);

7 TNPL JoongJin-Cho x=xi; t=ti; f=x+t; for(i=0;i


Download ppt "TNPL JoongJin-Cho Runge-kutta’s method of order 4."

Similar presentations


Ads by Google