- #1
peripatein
- 880
- 0
Hi,
I am asked to evaluate the following sum S=Sigma(n=0 to N) x^n/n! (namely, e^x as n->Inf) for N=10:10:100 and x=10, so that every element S(i) is a partial sum which approximates function e^x with different accuracy. Below is my code, which doesn't work.
x=10;
N=10;
i=0;
while (N<=100),
S(i)=double(symsum(x^n/sym('n!'), n, 0, N));
i=i+1;
N=N+10;
end
Would anyone please tell me where I am going wrong and how it may be corrected? I'd appreciate some guidance.
Homework Statement
I am asked to evaluate the following sum S=Sigma(n=0 to N) x^n/n! (namely, e^x as n->Inf) for N=10:10:100 and x=10, so that every element S(i) is a partial sum which approximates function e^x with different accuracy. Below is my code, which doesn't work.
Homework Equations
The Attempt at a Solution
x=10;
N=10;
i=0;
while (N<=100),
S(i)=double(symsum(x^n/sym('n!'), n, 0, N));
i=i+1;
N=N+10;
end
Would anyone please tell me where I am going wrong and how it may be corrected? I'd appreciate some guidance.