Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The cosine of an angle can be defined using the following infinite series: cos x = sigma_i = 0^infinity (-1)^i x^2i/(2i)! = 1 - x^2/2!
The cosine of an angle can be defined using the following infinite series: cos x = sigma_i = 0^infinity (-1)^i x^2i/(2i)! = 1 - x^2/2! + x^4/4! - x^6/6! + ... a) Write the definition of a C function named my_cos that uses this series to approximate the value of cos(x). It should sum the terms of the sequence until the value of the term is less than 10^-6. Since the computation of factorials may result in overflow, each new term should be computed from the previous term without computing any factorials directly. b) You would like to graph the function f(x) = 0.2x + 0.4 cos x for values of x between 0 and 20. Write a program that produces a csv file named graph.csv where each line of the file is of the form x, f(x) The values of x should range from 0 to 20 with increments of .001
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