Tweet
#include<stdio.h>
#include<math.h>
float f(float x,float y)
{
return (x*x+y*y);
}
main()
{
printf("\nProgram to implement Runga Kutta Method (x-y) : \n");
int i,n;
float x0,y0,x,y,h,k,k1,k2,k3,k4;
printf("\nEnter the values of x0,y0,h,x : ");
scanf("%f%f%f%f",&x0,&y0,&h,&x);
n=(x-x0)/h;
x=x0,y=y0;
for(i=0;i<=n;i++)
{
k1=h*f(x,y);
k2=h*f(x+h/2,y+k1/2);
k3=h*f(x+h/2,y+k2/2);
k4=h*f(x+h,y+k3);
k=(k1+(k2+k3)*2+k4)/6;
x=x+h;y=y+k;
}
printf("\n\nThe required value is %f\n\n",y);
}
Runga Kutta Method of Order 4 in C
Posted by
LAHAUL SETH
~
Runga Kutta Method of Order 4 in C
2012-01-03T10:20:00+05:30
LAHAUL SETH
Numerical Methods
|
Programming in C
|
Comments
Runga Kutta Method of Order 4 in C
2012-01-03T10:20:00+05:30
LAHAUL SETH
Numerical Methods
|
Programming in C
|