
Student Support Forum: 'It seems really really easy, but I cant' topicStudent Support Forum > General > "It seems really really easy, but I cant"
| Author |
Comment/Response |
Ha
|
12/29/05 09:24am
Let f(k)=1/k
To get the list
{f(1),f(1)+f(2),f(1)+f(2)+f(3), ... ,f(1)+f(2)+f(3)+...f(100)}}, Mathematica calculate almost 1+2+3+...+99=4950 times. (Count the number of symbol + used in the list.)
Suppose we calculate this manually. We calculate f(1)+f(2), than we add f(3)to f(1)+f(2), so we get f(1)+f(2)+f(3), then we add f(4) to get f(1)+f(2)+f(3)+f(4)... by doing this, we only calculate 99 times to get the list. This is 50 times faster than the former way.
How can I command mathematica to calculate in the latter way ??
URL: , |
|
| | | |
 | |
|