Question

Consider the following differential equation: dydx=x+y With initial condition: y = 1 when x = 0...

Consider the following differential equation: dydx=x+y

With initial condition: y = 1 when x = 0

  1. Using the Euler forward method, solve this differential equation for the range x = 0 to x = 0.5 in increments (step) of 0.1
  2. Check that the theoretical solution is y(x) = - x -1 , Find the error between the theoretical solution and the solution given by Euler method at x = 0.1 and x = 0.5 , correct to three decimal places

Homework Answers

Answer #1

a)

code:

#include<stdio.h>
float fun(float x,float y)
{
float f;
f=x+y;
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:

b)

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Given the second-order differential equation y''(x) − xy'(x) + x^2 y(x) = 0 with initial conditions...
Given the second-order differential equation y''(x) − xy'(x) + x^2 y(x) = 0 with initial conditions y(0) = 0, y'(0) = 1. (a) Write this equation as a system of 2 first order differential equations. (b) Approximate its solution by using the forward Euler method.
(1 point) A Bernoulli differential equation is one of the form dydx+P(x)y=Q(x)yn     (∗) Observe that, if n=0...
(1 point) A Bernoulli differential equation is one of the form dydx+P(x)y=Q(x)yn     (∗) Observe that, if n=0 or 1, the Bernoulli equation is linear. For other values of n, the substitution u=y1−n transforms the Bernoulli equation into the linear equation dudx+(1−n)P(x)u=(1−n)Q(x).dudx+(1−n)P(x)u=(1−n)Q(x). Consider the initial value problem y′=−y(1+9xy3),   y(0)=−3. (a) This differential equation can be written in the form (∗) with P(x)= , Q(x)= , and n=. (b) The substitution u= will transform it into the linear equation dudx+ u= . (c) Using...
Consider the differential equation x2 dy + y ( x + y) dx = 0 with...
Consider the differential equation x2 dy + y ( x + y) dx = 0 with the initial condition y(1) = 1. (2a) Determine the type of the differential equation. Explain why? (2b) Find the particular solution of the initial value problem.
1) Basic Euler’s Method: y'+xysin/y+1 y(0)=1 a) What is the initial condition? b) What order is...
1) Basic Euler’s Method: y'+xysin/y+1 y(0)=1 a) What is the initial condition? b) What order is this differential equation? c) Is this an autonomous differential equation? d) Is this a separable differential equation? e) Find the general solution to the given differential equation, by hand. You will not be able to completely solve for y(x) – that’s ok. Write out all your work and attach it to your Questions tab. f) Using the initial condition, solve the initial value problem...
Solve the differential equation : 4 x y y' = y2 + x2 with initial condition...
Solve the differential equation : 4 x y y' = y2 + x2 with initial condition y(1)=1
Consider the differential equation:  . Let y = f(x) be the particular solution to the differential equation...
Consider the differential equation:  . Let y = f(x) be the particular solution to the differential equation with initial condition, f(0) = -1. Part (a) Find  . Show or explain your work, do not just give an answer.
Determine the numerical solution of the differential equation y'+y-x=0 using the Euler and the Runge-Kutta method...
Determine the numerical solution of the differential equation y'+y-x=0 using the Euler and the Runge-Kutta method until n = 5. The step size is 0.2, y(0) = 1. No need to show calculations, I just need the summary of results of both methods with their percent absolute error from the exact value per yn. Abs. error will be (Exact-Approx)/Exact * 100
Solve the Initial Value Problem: a) dydx+2y=9, y(0)=0 y(x)=_______________ b) dydx+ycosx=5cosx,        y(0)=7d y(x)=______________ c) Find the...
Solve the Initial Value Problem: a) dydx+2y=9, y(0)=0 y(x)=_______________ b) dydx+ycosx=5cosx,        y(0)=7d y(x)=______________ c) Find the general solution, y(t), which solves the problem below, by the method of integrating factors. 8t dy/dt +y=t^3, t>0 Put the problem in standard form. Then find the integrating factor, μ(t)= ,__________ and finally find y(t)= __________ . (use C as the unkown constant.) d) Solve the following initial value problem: t dy/dt+6y=7t with y(1)=2 Put the problem in standard form. Then find the integrating...
Consider the differential equation x′=[2 −2 4 −2], with x(0)=[1 1] Solve the differential equation wherex=[x(t)y(t)]...
Consider the differential equation x′=[2 −2 4 −2], with x(0)=[1 1] Solve the differential equation wherex=[x(t)y(t)] please write as neat as possible better if typed and explain clearly with step by step work
Solve the Homogeneous differential equation (7 y^2 + 1 xy)dx - 1 x^2 dy = 0...
Solve the Homogeneous differential equation (7 y^2 + 1 xy)dx - 1 x^2 dy = 0 (a) A one-parameter family of solution of the equation is y(x) = (b) The particular solution of the equation subject to the initial condition y(1) =1/7.
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT