Your objective in Problem 2 is to employ Euler's Method to
determine what goes wrong when the interval is [ 0, 1 ]. To this
end, I want you to create another new
script, EulerMethod3, which is intended to approximate the
"solution" to the IVP given below.
dy/dx =
(1/9)*(y^10) where. y(0)
=
1. over
the interval. [ 0, 1 ]
I was given the code below for a different question, but I don't know how to modify it to solve this problem. Can someone help me modify this code to solve this problem and also state why this IVP has no solution on the interval [0,1].
function EulerMethod2 (n)
X=0:1/n:.5;
Y=zeros(1, n+1);
Y(1)=1;
for k=1:n
m=y(k);
Y(k+1)=Y(k)+m*(X(k+1)-X(k));
end
clf
plot(X,Y)
#include<stdio.h>
#include<math.h>
float fun(float x,float y)
{
float f;
f=pow(y,10)/9.0;
return f;
}
main()
{
float a,b,x,y,h,t,k;
printf("\nEnter x0,y0,h,xn: ");
scanf("%f%f%f%f",&a,&b,&h,&t);
x=a;
y=b;
printf("\n x\t y\n");
while(x<t)
{
k=h*fun(x,y);
y=y+k;
x=x+h;
printf("%0.3f\t%0.3f\n",x,y);
}
}
//result :
Get Answers For Free
Most questions answered within 1 hours.