Question
Calculate the Cosine and Sine of this angle using the Taylor Series given below: Sine(x) = x x3/3! + x5/5! x7/7! + x9/9! x11/11! +
Calculate the Cosine and Sine of this angle using the Taylor Series given below:
Sine(x) = x x3/3! + x5/5! x7/7! + x9/9! x11/11! +
Cosine(x) = 1 x2/2! + x4/4! x6/6! + x8/8! x10/10! +
The variable x is in radians and not degrees.
Note: See the PI calculator example in the examples directory on blackboard to get you started with series calculations.
Other trigonometric functions can be calculated using:
Tangent(x) = Sine(x)/Cosine(x)
CoSecant(x) = 1.0/Cosine(x)
You should use a while loop for this series. You will terminate the loop when the difference between previous and current calculated values is equal to or less than 0.0001.
You should test your functions using radians
To calculate the factorial of a number use a function called factorial(x). This function should take a double as a parameter and return a double as value. The factorial should be calculated using a for loop. Do not use one of the many recursive versions of this function available from the internet.
Note: All function variables and functions return types should be doubles.
Given Code for Sine
#include
const double PRECISION = 0.00001;
// Function prototype double mySine(double angie_in_radians);
// Create your function using the above prototype as a guide.
int main() {
/* Type your test code here. */
return 0; }
Given code for Cosine
#include
const double PRECISION = 0.00001;
// Function prototype double myCosine(double angie_in_radians);
// Create your function using the above prototype as a guide.
int main() {
/* Type your test code here. */
return 0; }
Given Code for Cotangent
#include
// copy functions from previous lab here
// Function prototype double myCotangent(double angie_in_radians);
// Create your function using the above prototype as a guide.
int main() {
/* Type your test code here. */
return 0; }
Given Code for Secant
#include
// copy functions from previous lab here
// Function prototype double myCotangent(double angie_in_radians);
// Create your function using the above prototype as a guide.
int main() {
/* Type your test code here. */
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started