HP35s Programming Help
#1

I'm not the most efficient programmer in the box. I've written a little program to calculate the partial sums of the function stored in F, iterated as K goes from A to B. Is this about as efficient (minimal steps) the program can get?

Partial Sums

F001 LBL F
F002 1 ÷ K^2
F003 RTN
A001 LBL A
A002 0
A003 STO S
A004 INPUT A
A005 INPUT B
A006 1000
A007 ÷
A008 STO+ A
A009 RCL A
A010 INTG
A011 STO K
A012 XEQ F001
A013 STO+ S
A014 ISG A
A015 GTO A009
A016 VIEW S
A017 RTN

Thanks for any suggestions,
CHUCK
#2

Hi Chuck,

nobody is willing to comment on this? Let me try!

It looks like your loop is perfectly ok. You can save some steps if you redefine F to use the stack instead of K:

F001	LBL F
F002 X^2 ' RPN instead of an equation
F003 1/X
F003 RTN
A001 LBL A
A002 0
A003 STO S
A004 INPUT A
A005 INPUT B
A006 1E3 ' shorter than 1000 (may use the same memory, though)
A007 ÷
A008 STO+ A
A009 RCL A
A010 INTG ' value on stack, not in register
A011 XEQ F002 ' no need to execute the label
A012 STO+ S
A013 ISG A
A014 GTO A009
A015 VIEW S
A016 RTN
I replaced 1000 by 1E3 which might save a byte but need not (I didn't check it).

Marcus



Possibly Related Threads…
Thread Author Replies Views Last Post
  HP35s Program Four Slings Lift Calculation Jean-Marc Biram (Australia) 2 2,130 12-16-2013, 07:21 PM
Last Post: Jean-Marc Biram (Australia)
  HP35s Calculator Max Rope Tension Program Jean-Marc Biram (Australia) 10 4,259 12-12-2013, 12:03 AM
Last Post: Jean-Marc Biram (Australia)
  Trouble entering a HP35s program line Arno 2 1,497 04-05-2013, 06:28 PM
Last Post: Arno
  HP35s scientific calculator GREG W THOMAS 4 1,860 03-22-2013, 06:49 AM
Last Post: Thomas Radtke
  HP35s "MEMORY CLEAR" flashes Mark Paris 1 1,448 08-31-2012, 07:35 PM
Last Post: Bart (UK)
  HP35S keyboard Nick R 8 2,730 08-01-2012, 01:27 PM
Last Post: Dave Shaffer (Arizona)
  Where should I post new HP35s bugs Andres Capdevila 33 9,061 03-13-2012, 01:00 PM
Last Post: Jeff O.
  HP35s Internal Investigations - new processor? stefan 5 2,002 03-08-2012, 04:48 AM
Last Post: Paul Dale
  Is the HP35s reliable? Chris Smith 26 6,803 02-24-2012, 11:38 AM
Last Post: Jeff Johnson
  HP35S solve problem Alessandro Castellani (Italy) 5 2,341 01-02-2012, 03:06 PM
Last Post: Dieter

Forum Jump: