I. Discussion Power Series Power Series is a function approximation method by which any non-polynomial function is represented by an infinite sum of polynomial terms. It can be used for linearization and as a solution for differential equations. 1. Taylor's Series ƒ(x) = f(n)(x₂), n! n=() 2. Maclaurin's Series f(x) = n=0) f(n) (0) n! II. Objectives 1. To evaluate functions using their Maclaurin's Series representation. 2. To visualize how adding more terms affect the accuracy of a power series. III. Instructions Develop a function pseval implementing a Maclaurin's Series calculator and visualizer. It must have the following features: 1. Calculator Mode ▪ It must take in a function handle f, in terms of x and n, containing the power series representation of a function, the number of terms n to be included in the computations, and a scalar value x that will be used to evaluate the function. The program must automatically execute this mode if there are exactly 3 input arguments. ▪ The output will be a scalar value y which is the value of the evaluated function. 2. Visualizer Mode ▪ It must take in a function handle f, in terms of x and n, containing the power series representation of a function, the number of terms n to be included in the computations, and the left and right boundaries x_1 and x_r that will be used in plotting the function. The program must automatically execute this mode if there are exactly 4 input arguments. ▪ Using the left boundary, the right boundary, and an increment of 0.01, generate the vector x. ▪ The output will be a vector y obtained when the function is evaluated using the vector x. Also, plot the resulting power series curve using the specified boundaries and number of terms. Take note to include the zeroth term when counting the number of terms. Label the x-axis as x and the y-axis as f(x). Also, provide a title indicating the number of terms used. ▪ Set the limit of the horizontal axis: x_1 to x_r. Toggle the grid on. IV. Sample Output 1. Calculator Mode f = @(x,n) (-1)^n.*x.^(2*n+1)./factorial (2*n+1); y = pseval(f,5,-5) y = Function > (x-xo)" -0.0896 2. Visualizer Mode f = @(x,n) (-1)^n.*x.^(2*n+1)./factorial (2*n+1); pseval (f, 2, -3,3); 1.5 1 0.5 Assessment: 0 -0.5 -1 Maclaurin's approximation of f(x) using 2 terms. 1 function y = pseval(f,n,varargin) Code to call your function > 1 f = @(x,n) (-1)^n.*x.^(2*n+1)./factorial(2*n+1); y = pseval(f,5,-5) 3 pseval(f, 2, -3,3); Is the Calculator Mode functioning correctly? Is the Visualizer Mode functioning correctly? Was the Symbolic Math Toolbox not used? Are the formatting and annotations of the plot correct? C Reset MATLAB Documentation C Reset ▶ Run Function

Oh no! Our experts couldn't answer your question.

Don't worry! We won't leave you hanging. Plus, we're giving you back one question for the inconvenience.

Submit your question and receive a step-by-step explanation from our experts in as fast as 30 minutes.
You have no more questions left.
Message from our expert:
Your question does not match the subject you selected. Please ask a question in one of the 30+ subjects available. We've credited a question to your account.
Your Question:
I. Discussion
Power Series
Power Series is a function approximation method by which any non-polynomial function is represented by an infinite sum of polynomial terms. It can be used for linearization and as a solution for differential equations.
1. Taylor's Series
ƒ(x) = f(n)(x₂),
n!
n=()
2. Maclaurin's Series
f(x) =
n=0)
f(n) (0)
n!
II. Objectives
1. To evaluate functions using their Maclaurin's Series representation.
2. To visualize how adding more terms affect the accuracy of a power series.
III. Instructions
Develop a function pseval implementing a Maclaurin's Series calculator and visualizer. It must have the following features:
1. Calculator Mode
▪ It must take in a function handle f, in terms of x and n, containing the power series representation of a function, the number of terms n to be included in the computations, and a scalar value x that will be used to evaluate the function. The
program must automatically execute this mode if there are exactly 3 input arguments.
▪ The output will be a scalar value y which is the value of the evaluated function.
2. Visualizer Mode
▪ It must take in a function handle f, in terms of x and n, containing the power series representation of a function, the number of terms n to be included in the computations, and the left and right boundaries x_1 and x_r that will be used in
plotting the function. The program must automatically execute this mode if there are exactly 4 input arguments.
▪ Using the left boundary, the right boundary, and an increment of 0.01, generate the vector x.
▪ The output will be a vector y obtained when the function is evaluated using the vector x. Also, plot the resulting power series curve using the specified boundaries and number of terms. Take note to include the zeroth term when counting the
number of terms.
Label the x-axis as x and the y-axis as f(x). Also, provide a title indicating the number of terms used.
▪ Set the limit of the horizontal axis: x_1 to x_r. Toggle the grid on.
IV. Sample Output
1. Calculator Mode
f = @(x,n) (-1)^n.*x.^(2*n+1)./factorial (2*n+1);
y = pseval(f,5,-5)
y =
Function >
(x-xo)"
-0.0896
2. Visualizer Mode
f = @(x,n) (-1)^n.*x.^(2*n+1)./factorial (2*n+1);
pseval (f, 2, -3,3);
1.5
1
0.5
Assessment:
0
-0.5
-1
Maclaurin's approximation of f(x) using 2 terms.
1 function y = pseval(f,n,varargin)
Code to call your function >
1 f = @(x,n) (-1)^n.*x.^(2*n+1)./factorial(2*n+1);
y = pseval(f,5,-5)
3 pseval(f, 2, -3,3);
Is the Calculator Mode functioning correctly?
Is the Visualizer Mode functioning correctly?
Was the Symbolic Math Toolbox not used?
Are the formatting and annotations of the plot correct?
C Reset
MATLAB Documentation
C Reset
▶ Run Function
Transcribed Image Text:I. Discussion Power Series Power Series is a function approximation method by which any non-polynomial function is represented by an infinite sum of polynomial terms. It can be used for linearization and as a solution for differential equations. 1. Taylor's Series ƒ(x) = f(n)(x₂), n! n=() 2. Maclaurin's Series f(x) = n=0) f(n) (0) n! II. Objectives 1. To evaluate functions using their Maclaurin's Series representation. 2. To visualize how adding more terms affect the accuracy of a power series. III. Instructions Develop a function pseval implementing a Maclaurin's Series calculator and visualizer. It must have the following features: 1. Calculator Mode ▪ It must take in a function handle f, in terms of x and n, containing the power series representation of a function, the number of terms n to be included in the computations, and a scalar value x that will be used to evaluate the function. The program must automatically execute this mode if there are exactly 3 input arguments. ▪ The output will be a scalar value y which is the value of the evaluated function. 2. Visualizer Mode ▪ It must take in a function handle f, in terms of x and n, containing the power series representation of a function, the number of terms n to be included in the computations, and the left and right boundaries x_1 and x_r that will be used in plotting the function. The program must automatically execute this mode if there are exactly 4 input arguments. ▪ Using the left boundary, the right boundary, and an increment of 0.01, generate the vector x. ▪ The output will be a vector y obtained when the function is evaluated using the vector x. Also, plot the resulting power series curve using the specified boundaries and number of terms. Take note to include the zeroth term when counting the number of terms. Label the x-axis as x and the y-axis as f(x). Also, provide a title indicating the number of terms used. ▪ Set the limit of the horizontal axis: x_1 to x_r. Toggle the grid on. IV. Sample Output 1. Calculator Mode f = @(x,n) (-1)^n.*x.^(2*n+1)./factorial (2*n+1); y = pseval(f,5,-5) y = Function > (x-xo)" -0.0896 2. Visualizer Mode f = @(x,n) (-1)^n.*x.^(2*n+1)./factorial (2*n+1); pseval (f, 2, -3,3); 1.5 1 0.5 Assessment: 0 -0.5 -1 Maclaurin's approximation of f(x) using 2 terms. 1 function y = pseval(f,n,varargin) Code to call your function > 1 f = @(x,n) (-1)^n.*x.^(2*n+1)./factorial(2*n+1); y = pseval(f,5,-5) 3 pseval(f, 2, -3,3); Is the Calculator Mode functioning correctly? Is the Visualizer Mode functioning correctly? Was the Symbolic Math Toolbox not used? Are the formatting and annotations of the plot correct? C Reset MATLAB Documentation C Reset ▶ Run Function
Recommended textbooks for you
Algebra & Trigonometry with Analytic Geometry
Algebra & Trigonometry with Analytic Geometry
Algebra
ISBN:
9781133382119
Author:
Swokowski
Publisher:
Cengage