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...
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 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 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...
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.
Consider the following initial value problems and solve by hand.              y' = 2x-3y+1              y(1)...
Consider the following initial value problems and solve by hand.              y' = 2x-3y+1              y(1) = 5 Let the step size 0.1. Then find the approximate value of y(1.2) by using Euler Method and Improved Euler Method. (Please show your work for both the Euler Method and the Improved Euler Method.)
y’ – y = 2x -1 y(0) = 1 , 0 ≤ x ≤ 0.2   ...
y’ – y = 2x -1 y(0) = 1 , 0 ≤ x ≤ 0.2    Use the Euler method to solve the following initial value problem (a) Check whether the function y = 2 ex -2x- 1 is the analytical solution ; (b) Find the errors by comparing the exact values you’re your numerical results (h = 0.05 and h = 0.1) and  Discuss the issue of numerical stability.
Consider the differential equation y′′+ 9y′= 0.( a) Let u=y′=dy/dt. Rewrite the differential equation as a...
Consider the differential equation y′′+ 9y′= 0.( a) Let u=y′=dy/dt. Rewrite the differential equation as a first-order differential equation in terms of the variables u. Solve the first-order differential equation for u (using either separation of variables or an integrating factor) and integrate u to find y. (b) Write out the auxiliary equation for the differential equation and use the methods of Section 4.2/4.3 to find the general solution. (c) Find the solution to the initial value problem y′′+ 9y′=...