Runga Kutta

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Runga Kutta as PDF for free.

More details

  • Words: 125
  • Pages: 3
Er.puneet kumar tyagi

AIM :- Write a program for RUNGA KUTTA METHOD #include<stdio.h> #include #include<math.h> float f(float x,float y) { return(y); } void main() { clrscr(); float x0,y0,h,xg,yg,k1,k2,k3,k4,k,i,n; printf("\ enter the initial value of x0"); scanf("%f", & x0); printf("\ enter the initial value of y0"); scanf("%f", & y0); printf("\ enter the given value of xg"); scanf("%f", & xg); printf("\ enter the value of step size h"); scanf("%f", & h); n=(xg-x0)/h; for(i=1;i<=n;i++) { k1=h*f(x0,y0);

Er.puneet kumar tyagi

k2=h*f(x0+(h/2),y0+(k1/2)); k3=h*f(x0+(h/2),y0+(k2/2)); k4=h*f(x0+h,y0+k3); k=(k1+2*k2+2*k3+k4)/6; yg=y0+k; y0=y0; } printf("the final value of yg=%f", y0); getch(); }

Er.puneet kumar tyagi

OUTPUT: Enter the initial value of x0=0 Enter the initial value of y0=2 Enter the given value of xg=0.2 Enter the value of step size h=0.1 The final value of yg=2.000000

Related Documents