Question

In: Computer Science

Program a calculator or computer to use Euler's method to compute y(1), where y(x) is the...

Program a calculator or computer to use Euler's method to compute y(1), where y(x) is the solution of the given initial-value problem. (Give all answers to four decimal places.)

dy/dx+ 3x2y = 12x2,

y(0) = 5

h = 1     y(1) =
h = 0.1     y(1) =
h = 0.01     y(1) =
h = 0.001     y(1) =

Solutions

Expert Solution

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

clc
clear all
close all
f=@(x,y) 12*x^2-3*x^2*y;
for h=[1,0.1,0.01,0.001]
[x,y]=eulerSystem(f,[0,1],5,h);
fprintf('For h=%f, y(1)=%.4f\n',h,y(end));
end
function [t,y]=eulerSystem(Func,Tspan,Y0,h)
t0=Tspan(1);
tf=Tspan(2);
N=(tf-t0)/h;
y=zeros(length(Y0),N+1);
y(:,1)=Y0;
t=t0:h:tf;
for i=1:N
y(:,i+1)=y(:,i)+h*Func(t(i),y(:,i));
end
end

For h=1.000000, y(1)=5.0000
For h=0.100000, y(1)=4.3928
For h=0.010000, y(1)=4.3701
For h=0.001000, y(1)=4.3681

Kindly revert for any queries

Thanks.


Related Solutions

(1 point) Use Euler's method with step size 0.1 to estimate y(2), where y(x) is the...
(1 point) Use Euler's method with step size 0.1 to estimate y(2), where y(x) is the solution of the initial-value problem y′=−5x+sin(y), y(0)=−1.
Use Euler's method with step size 0.2 to estimate y(0.4), where  y(x) is the solution of the...
Use Euler's method with step size 0.2 to estimate y(0.4), where  y(x) is the solution of the initial-value problem y' = 3x − 4xy, y(0) = 0. (Round your answer to four decimal places.) y(0.4) = (b) Repeat part (a) with step size 0.1. (Round your answer to four decimal places.) y(0.4) =
Use Euler's method with the given step size to estimate y(1.4) where y(x) is the solution...
Use Euler's method with the given step size to estimate y(1.4) where y(x) is the solution of the initial-value problem y′=x−xy ,y(1)=3.
1. Use Euler's method with step size 0.50.5 to compute the approximate yy-values y1≈y(0.5), y2≈y(1),y3≈y(1.5), and...
1. Use Euler's method with step size 0.50.5 to compute the approximate yy-values y1≈y(0.5), y2≈y(1),y3≈y(1.5), and y4≈y(2) of the solution of the initial-value problem y′=1+3x−2y,   y(0)=2. y1= y2= y3= y4= 2.   Consider the differential equation dy/dx=6x, with initial condition y(0)=3 A. Use Euler's method with two steps to estimate y when x=1: y(1)≈ (Be sure not to round your calculations at each step!) Now use four steps: y(1)≈ B. What is the solution to this differential equation (with the given initial...
Use Euler's method with step size 0.5 to compute the approximate y-values y1, y2, y3 and...
Use Euler's method with step size 0.5 to compute the approximate y-values y1, y2, y3 and y4 of the solution of the initial-value problem. y' = y − 5x, y(3) = 1. y1 = ______ y2 =______ y3 =_______ y4=________ Please show all work, neatly, line by line and justify steps so that I can learn. Thank you!
Use Euler's Method with step size 0.11 to approximate y (0.55) for the solution of the...
Use Euler's Method with step size 0.11 to approximate y (0.55) for the solution of the initial value problem    y ′ = x − y, and y (0)= 1.2 What is y (0.55)? (Keep four decimal places.)
Consider the initial value problem given below. y'=x+4cos(xy), Y(0)=0 Use the improved​ Euler's method subroutine with...
Consider the initial value problem given below. y'=x+4cos(xy), Y(0)=0 Use the improved​ Euler's method subroutine with step size h=0.3 to approximate the solution to the initial value problem at points x= 0.0,0.3,0.6.....3.0
Use Euler's method with each of the following step sizes to estimate the value of y(0.8),...
Use Euler's method with each of the following step sizes to estimate the value of y(0.8), where y is the solution of the initial-value problem: y' = y, y(0) = 5. (i)    h = 0.8 y(0.8) = 9 (ii) h = 0.4 y(0.8) = 9.8 (iii)     h = 0.2 y(0.8) = ? The error in Euler's method is the difference between the exact value and the approximate value. Find the errors made in part (a) in using Euler's method to estimate...
Let y′=y(4−ty) and y(0)=0.85. Use Euler's method to find approximate values of the solution of the...
Let y′=y(4−ty) and y(0)=0.85. Use Euler's method to find approximate values of the solution of the given initial value problem at t=0.5,1,1.5,2,2.5, and 3 with h=0.05. Carry out all calculations exactly and round the final answers to six decimal places.
Compute the area under y = √x between x = a and x = b where...
Compute the area under y = √x between x = a and x = b where a and b are user specified values obtained via cin. Account for invalid user input cases of a < 0 and a > b. For each case of invalid input, immediately output to the user what the error was. Allow the user a total of three chances to enter valid input for each input request. If the user enters incorrect input three times in...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT