 ZBRRJF The Asker · Computer Science

Objectives: Write a convergent algorithm using Taylor series and use global variables
For Taylor Series. Study the series to see how it converges. Note that
for these Trig functions, Taylor converges quickly. The number of terms will vary based on the size of the angle and the
size of epsilon.

For this program you will write a script and two functions, sine and cosine using Taylor series (NOTE: you can use any
name except the Matlab function names sin and cos for these functions). Refer to ME1101 Taylor Series DOC. The
purpose of this program is to test your sine and cosine function to insure it solves for sin and cos accurately.
CONCEPTS:
You are to use three global variables k, csine, and ccosine. k is to affect epsilon [epsilon (or e if you like) should equal
10^ - k.].
You will use k to improve the accuracy of your functions sine and cosine compared to Matlab’s sin and cos so that your
function’s results match closely the Matlab sin and cos functions.
You will use csine as a counter for your sine function and ccosine as a counter for your cosine function. the variables
csine and ccosine will be used to count how any cycles your sine and cosine functions require to converge to an accurate
answer. Your results of Sine and Cosine, k, and csine for Sine and ccosine for Cosine will be recorded in the Excel sheet
TEST TAYLOR.
Requirements:
1. Write a Script that cycles until user stops it.
2. Ask the user to input k a global variable in the script, k will then be used in both of your 2 functions. Epsilon in
each function will be 10^-k. So, by increasing k you will be improving the accuracy of your functions. 