Question: Program 3.3 Building a sin calculator key, attempt #1 %Approximates sin curve with degree 3 polynomial (Caution: do not use to build bridges at least


Program 3.3 Building a sin calculator key, attempt #1 %Approximates sin curve with degree 3 polynomial (Caution: do not use to build bridges at least until we have discussed accuracy.) Input : Output: approximation for sin (x) function y=sin1 (x) %First calculate the interpolating polynomial and store coefficients b-pi* (0:3)/6.yb sin(b); b holds base points c-newtdd (b,yb, 4) %For each input x, move x to the fundamental domain and evaluate the interpolating polynomial &Correct the sign of sin x1-mod (x,2*pi) if xl>p.i x12 pi-xl end if xl > pi/2 xl -pi-xl; end ys*nest (3,c, xl,b) Program 3.3 Building a sin calculator key, attempt #1 %Approximates sin curve with degree 3 polynomial (Caution: do not use to build bridges at least until we have discussed accuracy.) Input : Output: approximation for sin (x) function y=sin1 (x) %First calculate the interpolating polynomial and store coefficients b-pi* (0:3)/6.yb sin(b); b holds base points c-newtdd (b,yb, 4) %For each input x, move x to the fundamental domain and evaluate the interpolating polynomial &Correct the sign of sin x1-mod (x,2*pi) if xl>p.i x12 pi-xl end if xl > pi/2 xl -pi-xl; end ys*nest (3,c, xl,b)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
