0.1 0.02 2 0.4 0.030022207 0.5 0.055112341 0.6 0.091416078 0.7 0.141251768 0.8 0
ID: 3348444 • Letter: 0
Question
0.1 0.02 2 0.4 0.030022207 0.5 0.055112341 0.6 0.091416078 0.7 0.141251768 0.8 0.207246974 0.9 0.292542105 0.3 0.002800021 0.4 0.006000178 0.5 0.011000898 0.6 0.018203318 0.7 0.028009945 0.8 0.040825636 0.9 0.057058971 1 0.077124086 1.1 0.101443048 1.2 0.130448862 0.8 0.008160205 0.9 0.011400471 1.1 0,538188329 1.2 0.711152997 1.3 0.930726856 1.4 1.213352104 1.5 1.585574436 1.6 2.092979066 1.7 2.820035203 1.8 3.939295057 1.9 5.852099612 2 9.676806599 1.4 0.204330992 1.5 0.250166015 1.6 0.302617676 1.7 0.362249225 1.8 0.429673715 1.9 0.505566105 2 0.590678047 1.1 0.02024194 1.2 0.026003579 1.3 0.032766284 1.4 0.040610578 1.5 0.049617175 1.6 0.059867023 1.7 0.071441359 1.8 0.084421774 1.9 0.098890282 1.5 0.009920137 1.6 0.011968216 1.7 0.014280331 1.8 0.016872494Explanation / Answer
The given table in the image shows the Euler's approximation of differential equation.
With a given initial value problem
f(y) = dy/dx = y' = x^2+y^2
y(0) = 0
We will form an approximate solution by taking lots of little steps. We will call the distance between the steps h, and the various points (xi,yi). To get from one step to the next, we will form the linear approximation at ti. The derivative at this point is given by the differential equation: f(yi) = xi^2+yi^2. The linear approximation is then
l(x) = yi + f(yi)(x-xi)
so that
y_{i+1} = l(x_{i+1}) = y_i + f(y_i)*h
This technique is called Euler's Method. I have written a MATLAB code for the above method
MATLAB CODE:
function output = eulerApproximation(h,y0)
%%%%
%
%Input: h: Step size
% y0: Value of y(0)
%Output: [x,y] pair of values for differential equation solution using
%Euler method
%Differential equation
%f = x^2 + y^2;
%
%
x = 0:0.1:2; % X values
x = x';
y(1,1) = y0; %Storing value of y(0)
for i = 1:length(x)
y(i+1,1) = y(i,1)+ h*(x(i,1)^2 + y(i,1)^2); % Euler y1 = y0+h*f0
end
output = [x,y(2:end,:)];%output x y pair
end
OUTPUT:
>> y = eulerApproximation(0.1,0)
y =
0 0
0.1000 0.0010
0.2000 0.0050
0.3000 0.0140
0.4000 0.0300
0.5000 0.0551
0.6000 0.0914
0.7000 0.1413
0.8000 0.2072
0.9000 0.2925
1.0000 0.4011
1.1000 0.5382
1.2000 0.7112
1.3000 0.9307
1.4000 1.2134
1.5000 1.5856
1.6000 2.0930
1.7000 2.8200
1.8000 3.9393
1.9000 5.8521
2.0000 9.6768
>> y = eulerApproximation(0.02,0)
y =
0 0
0.1000 0.0002
0.2000 0.0010
0.3000 0.0028
0.4000 0.0060
0.5000 0.0110
0.6000 0.0182
0.7000 0.0280
0.8000 0.0408
0.9000 0.0571
1.0000 0.0771
1.1000 0.1014
1.2000 0.1304
1.3000 0.1646
1.4000 0.2043
1.5000 0.2502
1.6000 0.3026
1.7000 0.3622
1.8000 0.4297
1.9000 0.5056
2.0000 0.5907
>>
>> y = eulerApproximation(0.004,0)
y =
0 0
0.1000 0.0000
0.2000 0.0002
0.3000 0.0006
0.4000 0.0012
0.5000 0.0022
0.6000 0.0036
0.7000 0.0056
0.8000 0.0082
0.9000 0.0114
1.0000 0.0154
1.1000 0.0202
1.2000 0.0260
1.3000 0.0328
1.4000 0.0406
1.5000 0.0496
1.6000 0.0599
1.7000 0.0714
1.8000 0.0844
1.9000 0.0989
2.0000 0.1149
>> y = eulerApproximation(0.0008,0)
y =
0 0
0.1000 0.0000
0.2000 0.0000
0.3000 0.0001
0.4000 0.0002
0.5000 0.0004
0.6000 0.0007
0.7000 0.0011
0.8000 0.0016
0.9000 0.0023
1.0000 0.0031
1.1000 0.0040
1.2000 0.0052
1.3000 0.0066
1.4000 0.0081
1.5000 0.0099
1.6000 0.0120
1.7000 0.0143
1.8000 0.0169
1.9000 0.0198
2.0000 0.0230
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.