program_1 - CE 335 Computer Assignment 1 An introduction to...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CE 335 Computer Assignment 1 An introduction to Matlab programming: A trigonometric function We will implement a Matlab program to calculate the cosine of a given angle, similar to the built-in function cos. The numerical method we will use is based on the Taylor series for the cosine function: 1 - x 2 /2! + x 4 /4! - x 6 /6! + x 8 /8! - . .. which converges to cos(x) for all real values of x . (a) Suppose that x is between 0 and π /2. How many terms in the Taylor series expression would we need to retain in order to compute cos( x ) with an absolute truncation error of at most 10 -10 ? (Invoking the Alternating Series Test may be useful here -- look it up.) (b) Write a Matlab subroutine that asks for a number and uses your findings from (a) to compute its cosine. Verify that it works by computing cos( π /4) and cos( π /3). (c) How many terms in the Taylor series would you need to retain in order to calculate cos(5) to the same accuracy using the approach you just implemented? (d) Given a means of computing cos(
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/30/2011 for the course CGN 3350 taught by Professor Lybas during the Spring '11 term at University of Florida.

Page1 / 2

program_1 - CE 335 Computer Assignment 1 An introduction to...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online