MATLAB Answers

0

Sum of a series?

Asked by John Mitchell on 15 Oct 2019
Latest activity Commented on by Matt J
on 15 Oct 2019
I'm having some trouble even finding somewhere to start with these problems, where I have to find the sum of these without using for loops:
1) 1/(1*2) + 1/(2*3)+ 1/(3*4)+ 1/(4*5)+....1/(99*100)
2) e^1-e^2+e^3-e^4....+e^99-e^100
3) x+ x^2/2 + x^3/3 + x^4/4 +.... x^10/10 for x = 0.5

  0 Comments

Sign in to comment.

Tags

1 Answer

Matt J
Answer by Matt J
on 15 Oct 2019

Hint:
>> 1./(1:5)
ans =
1.0000 0.5000 0.3333 0.2500 0.2000

  4 Comments

Show 1 older comment
Matt J
on 15 Oct 2019
Think of the variety of things that you can do with this concept, e.g.,
>> x=1:5;
>> 1./(x.*(x+2).^2)
ans =
0.1111 0.0313 0.0133 0.0069 0.0041
John Mitchell on 15 Oct 2019
Thank you so much! I got the first one to work now, and I think I have a idea of how to do the third one, but I am still clueless on how to do the changing signs of the second one
Matt J
on 15 Oct 2019
The second one is a geometric series with ratio r=-exp(1). It has a closed form formula.

Sign in to comment.