The algorithm for the cosine Taylor's series expansion is given as follows: (1)k+1 x(2k-2) (2k- 2)!...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The algorithm for the cosine Taylor's series expansion is given as follows: (1)k+1 x(2k-2) (2k- 2)! x x4 x6 2! 4! 6! cos(x) = 1- + + = 00 a) Create a user defined function to approximate the value of cosine (the algorithm above) using a while-loop to ensure that the algorithm runs until the relative error is below a given error tolerance (maxtol). A partially completed code has been provided (remove the "_part" from the function handle before running). b) Test the function created in part (a) by evaluating at x=5 and maxtol=1e-3. c) Modify (slightly) the MATLAB function cosine_taylorN so that the while-loop checks both the error tolerance and the maximum number of iterations (maxitr). In other words, the loop terminates when either the error is sufficiently small, or the maximum number of iterations is exceeded. The required inputs and outputs for the function are given below: function [y, N] = cosine_taylorN(x, maxtol, maxitr) d) Test the function again by evaluating at x=5, maxtol-1e-3, and maxitr=20. What happens if maxitr=10? The algorithm for the cosine Taylor's series expansion is given as follows: (1)k+1 x(2k-2) (2k- 2)! x x4 x6 2! 4! 6! cos(x) = 1- + + = 00 a) Create a user defined function to approximate the value of cosine (the algorithm above) using a while-loop to ensure that the algorithm runs until the relative error is below a given error tolerance (maxtol). A partially completed code has been provided (remove the "_part" from the function handle before running). b) Test the function created in part (a) by evaluating at x=5 and maxtol=1e-3. c) Modify (slightly) the MATLAB function cosine_taylorN so that the while-loop checks both the error tolerance and the maximum number of iterations (maxitr). In other words, the loop terminates when either the error is sufficiently small, or the maximum number of iterations is exceeded. The required inputs and outputs for the function are given below: function [y, N] = cosine_taylorN(x, maxtol, maxitr) d) Test the function again by evaluating at x=5, maxtol-1e-3, and maxitr=20. What happens if maxitr=10?
Expert Answer:
Related Book For
Posted Date:
Students also viewed these algorithms questions
-
QUIZ... Let D be a poset and let f : D D be a monotone function. (i) Give the definition of the least pre-fixed point, fix (f), of f. Show that fix (f) is a fixed point of f. [5 marks] (ii) Show that...
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
A chamber contains a mixture of CO2, CO and O2 is in equilibrium at a specified temperature and pressure. How will (a) Increasing the temperature (T) at constant pressure and (b) Increasing the...
-
What are some of the advantages and disadvantages of permitting auditors to provide nonaudit services (such as tax services) to clients?
-
What does project planning involve?
-
What structures increase the surface area available for nutrient absorption in the small intestine?
-
Valley Realty acts as an agent in buying, selling, renting, and managing real estate. The unadjusted trial balance on July 31, 2014, is shown below. The following business transactions were completed...
-
Consider the table below. Compute for the GDP deflator and the two means of computing the inflation rate. You may use Excel but do place your answers in the table below. GDP (current prices) GDP...
-
Assume Avaya contracted to provide a customer with Internet infrastructure for $2,910,000. The project began in 2024 and was completed in 2025. Data relating to the contract are summarized below:...
-
Rewrite this AI: This piece offers important perspectives on the elements that affect the choice to pursue AACSB accounting accreditation. It underscores the intricate interaction between perceived...
-
a CMAA is crating an encounter form for a patient's appointment upon check-in. Whcih of the following information should the assistnt include on the form? a) debit balance b) Credit balance c)...
-
Which information concerning periodic statements and coupon books is true? A. If the servicer uses periodic statements, each statement must be sent reasonably promptly after the previous payment date...
-
An example illustrating how the equity method can result in manipulation of financial results is the case of Sunbeam Corporation. Sunbeam employed various manipulative tactics, including the use of...
-
Under the temporal method of translation, a foreign entity Multiple choice question. can have a net asset or a net liability balance sheet exposure. always has a net liability balance sheet exposure....
-
Morgan and Sarah formed the Hi Kite Corporation (a calendar year C-corporation) in 2017 each investing $250,000 in cash in exchange for 100% of the corporations stock. The attorney that helped them...
-
Suppose the concentration of glucose inside a cell is 0.1 mm and the cell is suspended in a glucose solution of 0.01 mm. a. What would be the free energy change involved in transporting 10-o mole of...
-
Use the f plot command to plot the function f(x) = (sin2x+ cos25x)e-0.2x in the domain -6 < x < 6.
-
The relation between the tension T and the steady shortening velocity v in a muscle is given by the Hill equation: (T + a)(v + b) = (T0 + a)b where a and b are positive constants and T0 is the...
-
The deflection w of a clamped circular membrane of radius r d subjected to pressure P is given by (small deformation theory) where r is the radial coordinate, and K = Et3/12(1 v2), where E, t, and u...
-
Which part of the brain is responsible for reasoning, language, and the control of voluntary movement? (a) brainstem (b) cerebellum (c) cerebrum (d) thalamus
-
During an action potential, (a) the membrane potential becomes more negative until it hits threshold. (b) the membrane potential increases as potassium ions flow out. (c) the membrane potential...
-
What is homeostasis?
Study smarter with the SolutionInn App