Question

Write a script file called Some Sums which finds the sum of the positive integers from 1 to 100 using the following three methods:\ 1. calculating the sum using a

FOR loop, 2. calculating the sum using a WHILE loop, 3. calculating the sum using the 'Sum of Positive Integers' formula. Write a script file called MatrixEven which creates a 3 x 3 matrix A of random integers between 1 and 20 using the command randi (20, [3,3]) andIncorporates what you have learned from the isEven function to check whether each element of the matrix is even or not. I want you to use an inner FORloop for the columns and an outer FOR loop for the rows when you are specifying the element index inside the matrix. The firal result should be a matrix of 1'sand 0's corresponding whether the element was even or not. Note that the trigonometric functions (and other transcendentals) are continous and take an infinite number of values. So, when early programmers wanted to program such functions, they relied on Taylor Series approximations to evaluate these functions. In fact, there are about 30 lines of code which the programmers for the Apollo 11 mission used a Taylor Series approximation to calculate a value for sine. Recall that the Taylor Series expansion for a differentiable function f centered at a number a is given by f(x)=f(a)+\frac{f^{\prime}(a)}{1 !}(x-a)+\frac{f^{\prime \prime}(a)}{2 !}(x-a)^{2}+\cdots+\frac{f^{(n)}(a)}{n !}(x-a)^{n}+\cdots=\sum_{k=0}^{\infty} \frac{f^{(k)}(a)}{k !}(x-a)^{k} The special case of the Taylor Series, called a Maclaurin Series, arises when we set a = 0. Rewriting our equation of the Taylor Series we get the following form for a Maclaurin Series. f(x)=\sum_{k=0}^{\infty} \frac{f^{(k)}(0)}{k !} x^{k} Write a function called Maclaurin Sine which takes in two positive numbers x and n and calculates the Maclaurin Series approximation for the sin(x) using n terms in the sum. The output of your function should be the value given by your approximation. Using n = 4, compare the results from your function and the sine function built into MATLABO for x =32 16 12' 8',and4.. What do you noticeabout your approximation when the value you are evaluating at is close to zero? What happens as the value of x gets farther away from zero? Now, increase the number n of terms in your approximation. What happens to your approximation? How many terms do you have to take to get an "exact"solution for

Fig: 1

Fig: 2

Fig: 3

Fig: 4

Fig: 5

Fig: 6

Fig: 7

Fig: 8

Fig: 9

Fig: 10

Fig: 11

Fig: 12