Matlab. I was able to do part B, but I\'m not sure how to simplify that further
ID: 3111518 • Letter: M
Question
Matlab. I was able to do part B, but I'm not sure how to simplify that further for part C or find the value of error.
This is the code I started with:
function y=nest(d,c,x,b)
If nargin<4, b=zeros (d,1); end
y=c(d+1);
for i=d: -1: 1
y=y.*(x-b(i))+c(i);
end
Explanation / Answer
The following code will give the sum of the series,
function [ sum ] = nest1( a,n )
sum=0;
for k=0:n
sum=sum+((1-a^(k+1))/(1-a));
end
For finding out the absolute error, just take the difference of the two computed sum, i.e,
sum by nest.m and sum by nest1.m, take the absolute difference. |value by nest.m-value by nest1.m|