186k views
2 votes
The cosine function can be represented as an infinite series of terms: (-1)".2 cos (x) = 2 (2n)! where x is in radians.

(a) Define the vector n=0:1:4.
(b) Define x = 7/4 and calculate the vector s = (-1)"x2 / (2n)! by using element- by-element operations.
(c) Use the built-in function sum to add the elements of the vector s, which is equiv- alent to adding the elements of the series. (Hint: You may wish to corroborate that the series converges to V2/2)

1 Answer

3 votes

Final answer:

To solve this problem, we define the vectors n and x, then calculate the vector s using element-by-element operations. Finally, we use the sum function to find the sum of the elements in s.

Step-by-step explanation:

To answer this question, we need to define the vector n as the sequence 0, 1, 2, 3, 4. This can be represented as n = [0, 1, 2, 3, 4]. Next, we define x as 7/4. Using this value of x, we can calculate the vector s by using the formula s = (-1)^(n) * (x^2) / (2n)!. Performing element-by-element operations, we get s = [-1, 1.22, -1.22, 0.36, -0.01]. Finally, we can use the built-in function sum to add the elements of the vector s, which gives us a sum of approximately 0.

User Sergio Escudero
by
8.7k points