Question

Setup a program that will solve for sin x using the Taylor series expansion of x. Make sure the number of terms is some type

0 0
Add a comment Improve this question Transcribed image text
Answer #1

IF YOU HAVE ANY DOUBTS COMMENT BELOW I WILL BE THERE TO HELP YOU ALL THE BEST

code:

% input from the user
fprintf('Taylor series for solving cos x \n');
nval = input('Provide number of terms required in the expansion: ');
x = input('Provide value of x for evaluating the function : ');

% solving taylor series
errapp = 0;
for i=0:nval-1
errapp = errapp + (-1)^i * x^(2*i) / factorial(2*i);
end

% Provides output
fprintf('Approximation : %.7g \n',errapp)
fprintf('Actual value of cos x after evaluation : %.7g \n',cos(x));
fprintf('Approximate Error : %.3g \n',errapp-cos(x));

I HOPE YOU UNDERSSTAND..

PLS ..RATE THUMBSUP IT HELPS ME ALOT

THANKS GOODLUCK

THANK YOU....!

Add a comment
Know the answer?
Add Answer to:
Setup a program that will solve for sin x using the Taylor series expansion of x. Make sure the number of terms is some type of input. Calculate approximate 1. error Setup a program that will so...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT