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;
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,y+k1);
k=(k1+k2)/2;
x=x+h,y=y+k;
}
printf("\n\nThe required value is %f\n\n",y);
}
Runga - Kutta Method of Order 2 in C
Posted by
LAHAUL SETH
~
Runga - Kutta Method of Order 2 in C
2012-01-03T10:05:00+05:30
LAHAUL SETH
Numerical Methods
|
Programming in C
|
Comments
Runga - Kutta Method of Order 2 in C
2012-01-03T10:05:00+05:30
LAHAUL SETH
Numerical Methods
|
Programming in C
|