0% found this document useful (0 votes)
117 views

Programme For Picards Method

This C program uses Picard's method to solve the differential equation dy/dx = 1 + xy. It defines functions Y1, Y2, and Y3 to calculate successive approximations. It takes user input for the initial value x0, final value xn, and step size h. It then calculates and prints the values of Y1, Y2, and Y3 at each step from x0 to xn.

Uploaded by

Mrinmoy Pramanik
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
117 views

Programme For Picards Method

This C program uses Picard's method to solve the differential equation dy/dx = 1 + xy. It defines functions Y1, Y2, and Y3 to calculate successive approximations. It takes user input for the initial value x0, final value xn, and step size h. It then calculates and prints the values of Y1, Y2, and Y3 at each step from x0 to xn.

Uploaded by

Mrinmoy Pramanik
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

/*Programme for Picards Method*/

/*NAME: MR GOBINDO ROLL NUMBER 129*/

#include<stdio.h>

#include <math.h>

#include<conio.h>

// dy/dx = 1 + xy

#define Y1(x) (1 + (x) + pow(x,2)/2)

#define Y2(x) (1 + (x) + pow(x,2)/2 + pow(x,3)/3 + pow(x,4)/8)

#define Y3(x) (1 + (x) + pow(x,2)/2 + pow(x,3)/3 + pow(x,4)/8 + pow(x,5)/15 + pow(x,6)/48)

main()

double y1[20],y2[20],y3[20],x0, xn,h,i;

int j;

printf("\n Enter the value of range x0 and xn: ");

scanf("%lf %lf",&x0,&xn);

printf("\n\n Enter the step length h: ");

scanf("%lf",&h);

for(i=x0,j=0;i<=xn;i=i+h,j++)

y1[j]=Y1(i);

y2[j]=Y2(i);

y3[j]=Y3(i);

printf("\nX |");

for(i=x0;i<=xn;i=i+h)

printf(" %.3lf",i);

printf("\n--------------------------------------------------------------------------------");

printf("\n\nY1|");

for(i=x0,j=0;i<=xn;i=i+h,j++)
printf(" %.3lf",y1[j]);

printf("\n\nY2|");

for(i=x0,j=0;i<=xn;i=i+h,j++)

printf(" %.3lf",y2[j]);

printf("\n\nY3|");

for(i=x0,j=0;i<=xn;i=i+h,j++)

printf(" %.3lf",y3[j]);

getch();

You might also like