Question

1. What is the Maclaurin series for the function sin(x)? Please determine the minimum number of terms needed to compute sin(0.1) accurate to 12 decimal places (rounded), using a) Taylor’s theorem and b) alternating series theorem.

Show your work and justify your answers for the above problem.

2. Create two random matrices A and B each of size ? × ?. Write a computer program in Java or Matlab to compute

a) D(i, j) = A(i, j) * B(i, j) for i = 1 … n and j = 1 … n, and

b) D(i, j) = ∑ (A(i,k) ∗ B(k,j)) ? ?=1 for i= 1 … n and j = 1 … n.

Use a timing function to report the execution time for the two computations using single and then double precisions. Report on the execution time of each run. Try n = 100 and 1000.

c) repeat the calculations in (a) and (b) above using Matlab.

1. What is the Maclaurin series for the function sin(x)? Please determine the minimum number of terms needed to compute sin(0

0 0
Add a comment Improve this question Transcribed image text
Answer #1

2)

clc%clears screen
clear all%clears history
close all%closes all files
format long
n=10;
A=rand(n);
B=rand(n);
D=[];
tic;
for i=1:n
for j=1:n
D(i,j)=A(i,j)*B(i,j);
end
end
t1=toc;
D=[];
tic;
for i=1:n
for j=1:n
D(i,j)=0;
for k=1:n
D(i,j)=D(i,j)+A(i,k)*B(k,j);
end
end
end
t2=toc;
disp('part a time for double');
disp(t1)
disp('part b time for double');
disp(t2)
A=single(rand(n));
B=single(rand(n));
D=[];
tic;
for i=1:n
for j=1:n
D(i,j)=A(i,j)*B(i,j);
end
end
t1=toc;
D=[];
tic;
for i=1:n
for j=1:n
D(i,j)=single(0);
for k=1:n
D(i,j)=D(i,j)+A(i,k)*B(k,j);
end
end
end
t2=toc;
disp('part a time for single');
disp(t1)
disp('part b time for single');
disp(t2)

Add a comment
Know the answer?
Add Answer to:
1. What is the Maclaurin series for the function sin(x)? Please determine the minimum number of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Convince yourself that the Maclaurin Series for cos(x) is: A. Write a function script called cos...

    Convince yourself that the Maclaurin Series for cos(x) is: A. Write a function script called cos_series that takes that takes as its inputs, x and N and has output given by the sum in the N-term Maclaurin Series approximation for Cos(x). Hint: try a “for loop” and set “format long” in your code. You may use the MATLAB built-in function factorial() B. Check your code by finding the 2-terms, 3-terms, 4-terms, 5-terms and 6-terms Maclaurin Series approximations every 30 degrees...

  • 7. (a) Use the well known Maclaurin series expansion for the cosine function: f (x )...

    7. (a) Use the well known Maclaurin series expansion for the cosine function: f (x ) = cos x = 1 x? 2! + 4! х 6! + (-1)" (2n)! . * 8! 0 and a substitution to obtain the Maclaurin series expansion for g(x) = cos (x²). Express your formula using sigma notation. (b) Use the Term-by-Term Integration Theorem to obtain an infinite series which converges to: cos(x) dx . y = cos(x²) (c) Use the remainder theorem associated...

  • In MATLAB The value of cos(x) can be approximated using a Maclaurin series + +... cos(x)=1-1...

    In MATLAB The value of cos(x) can be approximated using a Maclaurin series + +... cos(x)=1-1 2! 4! 6! Which can be expressed compactly as cos(x) = {(-1)+7 (2(k-1))! 00 2(k-1) k-1 Write Matlab code using a while loop that calculates cos(2) with 5 terms of Maclaurin series. Compare the value with the one calculated with a built-in function cos (2) in Matlab. The following is an expected output from your code: Using the Maclaurin series cos( 2.0) with 5...

  • Which function has as its Maclaurin series (-1)k+1.24 k=1 Use it to find the sum of...

    Which function has as its Maclaurin series (-1)k+1.24 k=1 Use it to find the sum of the alternating harmonic series (-1)k+1 k k=1

  • Use a Maclaurin series in this table to obtain the Maclaurin series for the given function....

    Use a Maclaurin series in this table to obtain the Maclaurin series for the given function. f(x) = 7x cos(2x2) (c) Use part (b) to find a power series for AUX) - 1621) 1x) - -1) ( 2.6 +1 +3 What is the radius of convergence, R? R-6 Find the Maclourin series for FUX) using the definition of a Maclaurin series. Assume that f has a power series expansion. Do not show that Ra(x) +0.1 Rox) = sin( Find the...

  • 1. For each function: (a) Determine the first four nonzero terms of the Maclaurin series for...

    1. For each function: (a) Determine the first four nonzero terms of the Maclaurin series for f.). (b) Write the power series using summation notation. (c) Determine the interval of convergence of the series. (a) f(x) = In(+1) (b) f(x) = sin 3.0

  • The function g has derivatives of all orders, and the Maclaurin series for g is Question 1 (5 poi...

    The function g has derivatives of all orders, and the Maclaurin series for g is Question 1 (5 points) Using the ratio test, determine the interval of convergence of the Maclaurin series for . Question 2 (2 points) The Maclaurin series for g evaluated at Z-可is an alternating series whose terms decrease in absolute value to 0. The approximation for g ( using the first two nonzero terms of this series is 120 Show that this approximation differs from 9...

  • 1) What is the order of error in the series approximation of: Sin(x + h) -...

    1) What is the order of error in the series approximation of: Sin(x + h) - Sin(x) + hCos(x)-h’Sin(x)/2+h'Cos(x16 a) h2 b) h c) d) None of the above 2) For two conformable matrices a(m,n) and b(n,p), the product of the two matrices is given by the equation: a) c =ba b) (ij) Ekalt, k) (k.) c) c = -b'a d) None of the above 3) Regression analysis involves minimizing: a) The sum of the squares c) The sum of...

  • Matlab The power series for the sin(x) is approximated by: 5 x sin x = x...

    Matlab The power series for the sin(x) is approximated by: 5 x sin x = x (-1)**r 20-4 + + 3! 5! 7! 9! 2n-1! a) Calculate sin(f/2) for m= 100 using the expression above. b) Repeat the calculations for sin(A) for the two cases m= 5 and m-50. State which of the cases is closer to the exact value.

  • 1. Consider the power series nr3n 8Tn (a) Determine the radius of convergence of the series. (b) The series is the Maclaurin series for some function f(z). Give the Maclaurin seres for (r)dr, and fin...

    1. Consider the power series nr3n 8Tn (a) Determine the radius of convergence of the series. (b) The series is the Maclaurin series for some function f(z). Give the Maclaurin seres for (r)dr, and find the radius of convergence of that series. 10 marks 1. Consider the power series nr3n 8Tn (a) Determine the radius of convergence of the series. (b) The series is the Maclaurin series for some function f(z). Give the Maclaurin seres for (r)dr, and find the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT