Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi, I am trouble writing a \"pseudocode\" algorithm of this solution, based on t

ID: 3877502 • Letter: H

Question

Hi, I am trouble writing a "pseudocode" algorithm of this solution, based on the books methods. I can not find the solutions manual, so I am stuck.

Please help

2.4 The sine function can be evaluated by the following infinite series: Write an algorithm to implement this formula so that it computes and prints out the values of sin x as each term in the series is added. In other words, compute and print in sequence the values for up to the order term n of your choosing. For each of the preceding, compute and display the percent relative error as true series approximation % error 100% true

Explanation / Answer

ALGORITHM

Take input for n terms from the user

Assign a variable t=1

for i=1 to n

s=s+pow(-1,(i+1))* (power(x,t)) / ((float)factorial(t)); //to calculate the sum

print "x ^",t

if(i%2==0)

print "+"

else

print "-"

end if

t=t+2

end for

Print sum of series s

actual<- calculate the actual value of sin(n)

calculate error= actual - s/ actual *100

print error

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote