The following infinite series can be used to approximate e^x:
Use the Taylor series to estimate f(x) = e^(-x) at xi+1 = 1 for xi = 0.2. Employ the zero- , first-, second-, and third- order versions.
(a) This Maclaurin series expansion is a special case of the taylor series when a = 0 because the Taylor series is the same as the Maclaurin series if a = 0, which in this case is x_i.
(b) This code prints out the first four iterations of e^(-x):
Output:
0.8187 0.1637 0.4257 0.3559
-122.5417 55.4917 -15.7217 3.2686
Matlab:
%f(x) = exp(-x)
%(i+1) = 1
%(i) = 0.2
xi = 0.2;
xi1 = 1;
true = 0.3679;
sol(1) = exp(-xi);
sol(2) = sol(1) - exp(-xi)*(xi1-xi);
sol(3) = sol(2) + (exp(-xi))/(factorial(2))*(xi1-xi)^2;
sol(4) = sol(3) - (exp(-xi))/(factorial(3))*(xi1-xi)^3;
for iter = 1:4
error(iter) = ((true - sol(iter)) / true) * 100;
end
sol()
error()
4.5
Use zero- through third- order Taylor series expansions to predict f(3) for:
using a base point at x = 1. Compute the true percent relative error for each approximation.
For this Problem I used the taylor series to expand out the function f(x) and found the true result after the third order approximation
Output:
(Error) 111.1913 85.9206 36.1011 0
Matlab:
%f(x) = 25x^3 - 6x^2 + 7x -88
true = 25*(3)^3 - 6*(3)^2 +7*(3) -88;
x = 3;
a = 1;
sol(1) = 25*a^3 - 6*a^2 + 7*a -88;
sol(2) = 75*a^2 - 12*a +7;
sol(3) = 6*(25*a - 2);
sol(4) = 150;
%sol(1) + sol(2)*(x-a) + (sol(3)/factorial(2))*(x-a)^2 + (sol(4)/factorial(3))*(x-a)^3
Solution = sol(1);
Error(1) = ((true - Solution)/true)*100;
for iter = 2:4
Solution = Solution + (sol(iter)/factorial(iter-1))*(x-a)^(iter-1);
Error(iter) = ((true - Solution)/true)*100;
end
Solution
Error()
4.8
To solve this problem I simply used the values given and solved the equation to get the two error values
Output:
Error range 20 : 1.2058 1.5425
Error range 40 : 1.0598 1.7351
Matlab:
A = 0.15;
e = 0.90;
T = 650;
errt= 20;
errt2 = 40;
sigma = 5.67 * 10^(-8);
Sol = A*e*sigma*(T-errt)^4
Sol = A*e*sigma*(T+errt)^4
Sol2 = A*e*sigma*(T-errt2)^4
Sol2 = A*e*sigma*(T+errt2)^4
4.12
For these problems I used the formula:
and derived each formula to get the condition numbers for each equation.
(a)
= 158.115
(b)
= -10
(c)
= 0
(d)
= -0.000499917....
(e)
= -10001
4.17
This Problem was fairly simple, I just plugged in the values given and computed the angle values based of the two error values
OutPut :
33.3081 34.6676
Matlab:
%v_e/v_0 = 2;
%alpha = 0.25
%asind = arc sin in degrees
angle = asind((1 + 0.25)*sqrt(1-(0.25/(1+0.25))*(2)^2));
% range =
Solution = angle-(angle*.02)
Solution = angle+(angle*.02)
No comments:
Post a Comment