Programs for 15C and 35S



#27

HP 15C: Julian Date

HP 35S Horizontal Curve: Radius, Chord Length, Arc Length given Tangent Length and Radius

HP 35S Vertical Curve: Point of Peak and Elevation at Peak Point and Length

HP 35S: Distance to Horizon

HP 35S Air Density and Density Altitude

HP 35S: Approximate Length of Sunlight


#28

Thank you, very useful!


#29

+1.

BTW, is anybody collecting such programs in a program library of some kind? The collective knowledge of RPN programmers shouldn't vanish in time IMHO. I know the RPL folks have their place at hpcalc.org. Is there anything alike for RPN? If true, where?

d:-)


#30

#31

I have some programs on my HP-15C simulator page and some of Eddie's programs are part of the simulator distributions.

I am looking forward to receiving more HP-15C programs to be published and included with the simulator. Preferably already as .15c program file with the documentation included.


#32

The listings that your simulator creates are very nice! Congratulations! Just had a glimpse at Little Gauss. Here's a third variant:

LBL C
1
+
2
Cy,x
RTN

In the article
Effective Computer-aided Calculator Programming - Part 1 - Voyager you can find a compiler that could probably be adjusted to produce the format you need for your simulator as well. Just thought you might be interested.

Kind regards

Thomas

Edited: 20 May 2013, 6:34 p.m.


#33

Quote:
Here's a third variant:
LBL C
1
+
2
Cy,x
RTN

More computational effort, I think, but a record for conciseness! Increasing the constants by one will give the sum of the first n triangular numbers. Increasing them by one again will give the sum of the latter, and so on it appears.

Cheers,

Gerson.


#34

If you define as the
forward difference operator defined as an = an+1 - an and the summation operator as an = Sum[ai, {i, 0, n-1}], you can verify the following:

  • = 1 (identity)
  • Cn,k = Cn,k-1
  • Cn,k = Cn,k+1
Thus these two operators are shifting the index k of the binomial coefficient up and down.

This is similar to how differentiation and integration operate upon the functions fk(x) = xk/k!. Hence the similarity of Newton's Forward Difference Formula with the Taylor series expansion.

Cheers

Thomas

#35

On the HP-42S Little Gauss can be made the same size in bytes without using COMB. One step longer, however:

00 { 13-Byte Prgm }
01 LBL "LG"
02 1
03 +
04 2
05 COMB
06 END

00 { 13-Byte Prgm }
01 LBL "LG"
02 X^2
03 RCL+ ST L
05 2
06 /
07 END

Since we're at it, here is Gauss Little (Inverse Little Gauss :-)

00 { 21-Byte Prgm }
01 LBL "GL"
02 8
03 *
04 1
05 +
06 SQRT
07 0.5
08 *
09 RCL- ST L
10 END

Cheers,

Gerson.


#36

Very nice! Do you still remember that thread: Short Quadratic Solver (HP-42S)

This solution is based on it:

00 { 17-Byte Prgm }
01 LBL "GL"
02 STO+ ST X
03 SQRT
04 ENTER
05 STO+ ST X
06 1/X
07 ASINH
08 E^X
09 /
10 END

Best regards

Thomas


The port to HP-15C is straight forward:
001 - 42,21,11  LBL A      
002 - 36 ENTER
003 - 40 +
004 - 11 SQRT
005 - 36 ENTER
006 - 36 ENTER
007 - 40 +
008 - 15 1/x
009 - 43,22,23 ASINH
010 - 12 e^x
011 - 10 /
012 - 43 32 RTN


Edited: 4 June 2013, 4:27 a.m.


#37

Quote:
00 { 17-Byte Prgm }

Great saving, more than I expected!

Just an interesting result:

2 SQRT 23 + XEQ GL XEQ GL

Cheers,

Gerson.

[sub]Edited to fix a typo per Thomas's observation below[/pre]

Edited: 4 June 2013, 12:03 p.m. after one or more responses were posted


#38

How on earth did you stumble upon this? That's amazing! But it took me a while to figure out that XL is probably a typo.

Best regards

Thomas


#39

Okay, I guess I figured it out:

#!/usr/bin/python
from math import pi
x = pi
for i in range(10):
x = x*(x + 1)/2
print "%.12f" % x

6.505598527340
24.414205363131
310.233814438138
48277.626717637635
1165388759.557138442993
679065481033757312.000000000000
230564963765804121415221078080356352.000000000000
2.65801012582e+70
3.53250891447e+140
6.23930961541e+280

I'm still impressed.

Cheers

Thomas


#40

Quote:
679065481033757312.000000000000

How accurate should that be? On the WP34S I get
     679065481033757541.1897711439112775

Another interesting near-integer, not related to the above:

pi^34 = 8.00010471505e16
or
pi^34*10-16 - pi/3*10-4 = 7.99999999529

Yet another one involving sqrt(2) and pi:

1/2*pi^34 = 141422281.793

Whether these are a coincidence or not, I don't know.

Best regards,

Gerson

Edited: 4 June 2013, 12:49 p.m.


#41

e to the pi Minus pi

Also, I hear the 4th root of (9^2 + 19^2/22) is pi.


#42

Quote:
e to the pi Minus pi

http://jsmarkovitch.files.wordpress.com/2009/11/coincidence-data-compression-and-mach_s-concept-of-economy-of-thought-j-s-markovitch.pdf

Quote:
Also, I hear the 4th root of (9^2 + 19^2/22) is pi

This is a bit closer, but still too far away:


Edited: 4 June 2013, 9:41 p.m.


#43

That's an interesting paper. Both cases are handled. Thanks a lot for posting the link.

Kind regards

Thomas

#44

Quote:
How on earth did you stumble upon this?

PI XEQ LG XEQ LG 2 SQRT -     -->    22.9999918008
Cheers,

Gerson.

#45

For those interested in the math behind it:

Quadratic equation:

Solution:

Logarithmic representation of inverse hyperbolic function:

This implies:

Try to bring the solution of the quadratic equation to this form:

Substitution:

Move the negative sign through sinh-1:

Use e-x=1/ex:

#46

Quote:
Examples 
Uphill curve:
I = 1,000 ft
G = 7% = .07
H = -4% = -.04
L = 1,368 ft

Point at peak elevation is 870.545 ft into the curve at 1,030.469 ft.
The elevation at the end of the curve is 1,020.520 ft.



Given your solution I get:

G = (1,030.469 - 1,000) / 870.545 = 0.035
H = (1,020.520 - 1,030.469) / (1,368 - 870.545) = -0.02

So it seems a factor 2 is missing somewhere.


As I'm not an engineer I wonder why the length L is divided into two parts similar to G:H (or rather |G|:|H|) to determine the peak. Why would somebody want to do that? What's the real world application of it?

Kind regards

Thomas


#47

Quote:

Given your solution I get:

G = (1,030.469 - 1,000) / 870.545 = 0.035
H = (1,020.520 - 1,030.469) / (1,368 - 870.545) = -0.02

So it seems a factor 2 is missing somewhere.


As I'm not an engineer I wonder why the length L is divided into two parts similar to G:H (or rather |G|:|H|) to determine the peak. Why would somebody want to do that? What's the real world application of it?

Kind regards

Thomas


I am looking into this. I got the formulas from the Fundamental of Engineering Handbook reference book, if it helps.

You determination for G and H are straight forward.

Update: It seems to be a factor of 2 at peak point. Vertical curves, to my understanding, are symmetrical in a sense of tangent lines: one created from the beginning of the curve and on at the end of the curve. If a line is drawn at the intersection of the tangent line perpendicular to the base, that line bisects the length of the base.

The grade is determined from where the tangent lines meet. In a perfectly symmetrical vertical curves the tangent lines meet at the curve's peak elevation. For this case:

G = (y0 - I)/(L/2) and H = (I - y0)/(L/2) where y0 is the peak elevation.

Some more information is provided here:

http://www.wsdot.wa.gov/publications/manuals/fulltext/M22-23/Vertical.pdf

http://www.iowadot.gov/design/dmanual/02b-01.pdf

I am not an engineer either, I just have an interest in the subject. Hope this helps, Eddie

Edited: 23 May 2013, 10:09 p.m.


#48

I completely mixed up the peak point of the curve and the Vertical Point of Intersection. But I didn't realize that we're dealing with a curve (a parabola to be more specific) because it's missing in your sketch. I assumed the two intersecting lines, that's the curve.

Thanks for providing the links to the papers. It clarified a lot.

Cheers

Thomas


#49

Quote:
I completely mixed up the peak point of the curve and the Vertical Point of Intersection. But I didn't realize that we're dealing with a curve (a parabola to be more specific) because it's missing in your sketch. I assumed the two intersecting lines, that's the curve.

Thanks for providing the links to the papers. It clarified a lot.

Cheers

Thomas


Thomas,

Thanks for posting the question - you helped me become clearer on the subject. Much appreciated.


#50

Just compare these two images:

VERTICAL CURVE EQUATIONS


HP35S Vertical Curve: Elevation at Peak and at End Point


LEGEND


    g1 = Approach gradient in %
A = Algebraic difference in gradients
L = Length of vertical curve stations

B.V.C. = Beginning of Vertical Curve
V.P.I. = Vertical Point of Intersection
E.V.C. = End of Vertical Curve
X = Distance from the B.V.C. to the low or high point in stations.

EQUATIONS


X = g1{L/A}

Your sketch suggest that (x0, y(x0)) is the Vertical Point of Intersection where instead it is the peak of the curve. I recommend to change the sketch.

Kind regards

Thomas

#51

Eddie, I tried the Julian date program and noticed that it will work only for dates since the introduction of the Gregorian calendar on October 15, 1582 (JD 2299161). Every date before produces a JD result that is off by some days, simply because the rules for leap years introduced with the Gregorian calendar did not apply earlier.

Example:

 date          Julian Day   15C program     error
--------------------------------------------------
Oct 15, 1582 JD 2299161 JD 2299161 0 ; first day of Gregorian calendar
Oct 04, 1582 JD 2299160 JD 2299150 -10 ; last day of Julian calendar
Jan 01, 1500 JD 2268933 JD 2268924 -9
Jan 01, 1000 JD 2086308 JD 2086303 -5
Jan 01, 300 JD 1830633 JD 1830633 0
Jan 01, 1 JD 1721424 JD 1721426 +2
In other words, the 15C program assumes a proleptic (perpetual) Gregorian calendar, so that even dates before Oct 15, 1582 are assumed Gregorian. This means that even dates in medieval times are assumed to be given in a calendar system introduced many centuries later. This is at least not very common, so that either the program should be modified or a respective note should be added.

Dieter


#52

Quote:
Eddie, I tried the Julian date program and noticed that it will work only for dates since the introduction of the Gregorian calendar on October 15, 1582 (JD 2299161). Every date before produces a JD result that is off by some days, simply because the rules for leap years introduced with the Gregorian calendar did not apply earlier.

Example:

 date          Julian Day   15C program     error
--------------------------------------------------
Oct 15, 1582 JD 2299161 JD 2299161 0 ; first day of Gregorian calendar
Oct 04, 1582 JD 2299160 JD 2299150 -10 ; last day of Julian calendar
Jan 01, 1500 JD 2268933 JD 2268924 -9
Jan 01, 1000 JD 2086308 JD 2086303 -5
Jan 01, 300 JD 1830633 JD 1830633 0
Jan 01, 1 JD 1721424 JD 1721426 +2
In other words, the 15C program assumes a proleptic (perpetual) Gregorian calendar, so that even dates before Oct 15, 1582 are assumed Gregorian. This means that even dates in medieval times are assumed to be given in a calendar system introduced many centuries later. This is at least not very common, so that either the program should be modified or a respective note should be added.

Dieter


Dieter, I will do the note. Thanks for pointing this out. Always appreciated.

Eddie

Edited: 23 May 2013, 10:09 p.m.


Possibly Related Threads…
Thread Author Replies Views Last Post
  Date/time programs for the HP 35s R. Pienne 0 1,120 10-03-2013, 02:37 PM
Last Post: R. Pienne
  New HP 35S Programs posted on my blog Eddie W. Shore 2 1,664 06-08-2013, 03:47 PM
Last Post: Glenn Shields
  hp 35s programs in software library Andrew Nikitin 7 2,392 05-30-2013, 11:55 AM
Last Post: Dave Hicks
  Is there a free RPN stack emulator for writing 35s programs Chris C 6 2,385 11-20-2012, 08:01 AM
Last Post: Mike (Stgt)
  Original 15C Keyboard Test Works With 15C LE!!! DigiGal 5 2,252 09-26-2011, 07:33 PM
Last Post: M. Joury
  15c: Need good programs for Mod, nCr, nPr Dave Britten 55 12,051 09-15-2011, 08:48 PM
Last Post: Gerson W. Barbosa
  Is there anything the 15c can't do compared to the 35s? snaggs 156 36,381 09-02-2011, 05:36 PM
Last Post: Egan Ford
  A few simple HP 35s programs Lode 3 1,358 07-04-2011, 05:38 PM
Last Post: Paul Dale
  A shortcut for running programs on a HP-35s Antonio Maschio (Italy) 4 1,506 01-22-2008, 02:07 AM
Last Post: Antonio Maschio (Italy)
  John Wasilewski's non-interruptable 35s programs Seth Morabito 0 736 10-17-2007, 06:11 PM
Last Post: Seth Morabito

Forum Jump: