Problem 3: The Taylor Series approximation for inverse tangent could be approxim
ID: 3567583 • Letter: P
Question
Problem 3: The Taylor Series approximation for inverse tangent could be approximated as: Building off of what you have learned in problem #1 and #2: (a) Create the function taninv that would perform the approximation using a forloop. There will be two inputs, x (as seen in equation above) and n (total munber of terms to use). There will also be two outputs, vec 1 ( a row vector where each individual tenu is stored) and approx (the final approximation). (b) Create a function whiletaninv that would compute the approximation using a whileloop until the approximation reaches .0001 for the error. This time, your only input should be x, and your output should be the same as in (a) with vec 1 and approx. Hint: Error = abs((exact - approx)/exact)Explanation / Answer
1)
function [vec1,approx] = taninv(x,n)
approx=0.0;
for i=1:n
vec1(i)=((-1)^(i-1))*(x^(2*i-1))/(2*i-1);
approx=approx+vec1(i);
end;
end
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.