Question: For questions below, write small Python (or C, or C++, ...) functions. The functions should have no side-effects; i.e., the input is the argument of

For questions below, write small Python (or C, or C++, ...) functions. The functions should have no side-effects; i.e., the input is the argument of the function, and the output is the return value (in particular, the functions should not contain print commands). The arguments of the trigonometric functions are angles expressed in radians.

1 How could we compute (cos(x) 1)/x2 with good precision, for values of x that are very close to 0? Use the Taylor formula of cos(x) near 0.

2 Compare the Taylor formula method with the direct evaluation of the formula (cos(x) 1)/x2 (in Python, or C, etc.), when |x| is small: use the values 10-6, 10-10, 10-16, 0 for x.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!