1. Engineering
  2. Computer Science
  3. for this problem we will write two approximation functions and...

Question: for this problem we will write two approximation functions and...

Question details

For this problem we will write two approximation functions and we will evaluate their error (how close they come to the correct value). Write all code in a file called p3.c. sin (x)~x-x b Write a function a) An approximation formula for sin(x) when x is small (close to 0) is called sin_appr that takes a double x as argument and that returns the approximated value of sin(x) using this formula. Notice that x is expressed in radians. Write the function interface comment, with preconditions and postconditions b) The factorial of a natural number n is n^IIn.Stirlings approximation formula for 2πη n! when n is large (and positive) is input an integer n and returns the int value of Stirlings approximation for n. Use local variables to store Write a C function called fact appr that takes as intermediary expressions e and y2πη . Write the function interface comment, with preconditions and postconditions c) Write a function called display_error that takes as input an approximated value and the correct value and that computes the approximation error (the difference between the correct and the approximation) and then displays both values and the error to the terminal. For instance, one could use the display_error function like this: double sin c- sin(theta); I/ the correct value

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution