Question: Consider the Taylor expansion of the sin function sin(x) ~ x - x^3/3! + x^5/5! - x^7/7! + .. As you can see, it is

Consider the Taylor expansion of the sin function sin(x) ~ x - x^3/3! + x^5/5! - x^7/7! + .. As you can see, it is also a sum of terms with a couple of twists. First, the signs alternate, second and the terms for even numbers are missing. The formula in sigma notation is sin(x) ~ sigma_t = 0^n (-1)^1/(2 middot i + 1)! middot x^2 middot 1 + 1 where the order-n summation contains the first n + 1 terms of the expansion. Write a linear time ML function sinappx that, given a value n, computes in linear time in n, the Taylor expansion up to order n. As you surely realized, computing (for instance) factorials from scratch for each term would not deliver the desired complexity. fun sinappx n x =
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
