Post Reply 
Programming Exercise (HP-15C, 15C LE - and others)
03-23-2014, 01:49 PM (This post was last modified: 03-23-2014 05:59 PM by Gerson W. Barbosa.)
Post: #28
RE: Programming Exercise (HP-15C, 15C LE - and others)
(03-23-2014 08:59 AM)Thomas Klemm Wrote:  
(03-22-2014 03:02 AM)Gerson W. Barbosa Wrote:  But we can easily break the 20-second barrier on the WP 34S

Yet another idea is to combine two terms: \(\frac{1}{n}-\frac{1}{n+1}=\frac{1}{n(n+1)}\)
Code:
LBL A
0
RCL Y
DEC Z
RCL* Z
1/x
+
DSZ Y
BACK 006
END
10000
XEQ A

Code:
LBL B
INC X
*
1/x
END
9999.00102
\(\sum\) B

We don't have to deal with the alternating sign and it should be both faster and more accurate.

Cheers
Thomas
You've moved the time barrier to the 10-second line! 10.8 seconds, perhaps a few milliseconds less. The summation now takes about half the previous time, but still disappointly long: 2 min 5 sec.

Cheers,

Gerson.

P.S.: Well, not item (b) of the exercise anymore, but if all we want is just computing the sum of the first ten thousand terms of the series then we can do it in one tenth of a second (one TICK) and eleven steps at most (LBL and END included), using information available in this thread. The result will be accurate to 20 digits in double precision mode.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Programming Exercise (HP-15C, 15C LE - and others) - Gerson W. Barbosa - 03-23-2014 01:49 PM



User(s) browsing this thread: 13 Guest(s)