Question: Develop a C-code to meet the requirements below: **Using X-Code on Mac, or CodeBlocks** 1)Find the solution of the differential equation below by using Eulers
Develop a C-code to meet the requirements below:
**Using X-Code on Mac, or CodeBlocks**
1)Find the solution of the differential equation below by using Eulers method. The range of x is 3 to 4.dy/dx=x^2+2x with y=3 at x=3
2)Find the appropriate step size for this specific problem
3)Print allthe y values within the range of x=3to x=4.
4)Solve the differential equation analytically and compare with the Eulers method
5)Obtain a linear regression y=ax+b and show the r2value
Your C-code must contain the following features: (1) use of arrays, (2) use of pointers, (3) use of structure,(4) use of union, (5) use of functions and function calls, (6) formatted output onscreen and (7) saving ofthe same output on a file.
Code:
#include
#include
#include
//dy/dx = xy#define F(x,y) (x)*(x)-(6*x)
int main()
{
FILE *f = fopen("file.txt", "w");
if (f == NULL)
{
printf("Error opening file! ");
exit(1);
}
}
double yy,y2,xx,a,n,h;
int j;
clrscr();
printf(" Enter the value of range: ");
scanf("%lf %lf",&a,&n);
printf(" Enter the value of yy: ");
scanf("%lf",&y1);
printf(" Enter the h: ");
scanf("%lf",&h);
printf(" yy = %.3lf ",yy);
for(x1=a,j=2; x1
{
y2= yy + h * F(xx,yy);
printf(" x = %.3lf => y%d = %.3lf ",xx,j,y2);
fprintf(f," x = %.3lf => y%d = %.3lf ",xx,j,y2);
y1=y2;
}
Errors:

26 printf("nEnter the value of range: "); 27 28 scanf("%1f %lf",&a,&n); 29 30 printf(" Enter the value of yy: "); 31 32 scanf (-%lf",&y1); 740 Conflicting types for 'printf 4 4 Expected') Conflicting types for 'printf 20 Conflicting types for 'scantf 440 Conflicting types for 'printf 5 4 Conflicting types for 'scanf 34 printf("nnEnter the h: "); 35 36 scanf("%lf",&h ) ; 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
