05-19-2013, 01:28 PM

05-19-2013, 01:28 PM

05-20-2013, 04:39 AM

Thank you, very useful!

05-20-2013, 05:46 AM

+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:-)

05-20-2013, 08:05 AM

05-20-2013, 08:32 AM

Quote:

Examples

Uphill curve:

I = 1,000 ft

G = 7% = .07

H = -4% = -.04

L = 1,368 ftPoint 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

05-20-2013, 10:28 AM

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 errorIn 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.

--------------------------------------------------

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

Dieter

05-20-2013, 02:54 PM

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.

05-20-2013, 03:48 PM

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. *

05-21-2013, 02:43 PM

Quote: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.

Here's a third variant:

LBL C

1

+

2

Cy,x

RTN

Cheers,

Gerson.

05-21-2013, 11:27 PM

If you define as the

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

- = 1 (identity)

- C
_{n,k}= C_{n,k-1}

- C
_{n,k}= C_{n,k+1}

*k*of the binomial coefficient up and down.

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

Cheers

Thomas

05-23-2013, 03:56 PM

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. *

05-23-2013, 03:58 PM

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 errorIn 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.

--------------------------------------------------

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

Dieter

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

Eddie

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

05-25-2013, 07:33 AM

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

05-29-2013, 07:24 AM

Quote:

I completely mixed up the peak point of the curve and theVertical 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.

05-29-2013, 08:52 AM

Just compare these two images:

## VERTICAL CURVE EQUATIONS

## HP35S Vertical Curve: Elevation at Peak and at End Point

## LEGEND

g_{1}= Approach gradient in %

A = Algebraic difference in gradients

L = Length of vertical curve stationsB.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 = g*

_{1}{L/A}
Your sketch suggest that *(x _{0}, y(x_{0}))* is the

*Vertical Point of Intersection*where instead it is the peak of the

__curve__. I recommend to change the sketch.

Kind regards

Thomas

06-03-2013, 10:37 PM

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 END00 { 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.

06-04-2013, 12:39 AM

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. *

06-04-2013, 05:34 AM

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/e^{x}*:

06-04-2013, 10:53 AM

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*

06-04-2013, 12:01 PM

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

06-04-2013, 12:10 PM

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

06-04-2013, 12:11 PM

Quote:

How on earth did you stumble upon this?

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

Gerson.

06-04-2013, 12:46 PM

Quote:How accurate should that be? On the WP34S I get679065481033757312.000000000000

679065481033757541.1897711439112775

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

pi^34 = 8.000or10471505e16

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. *

06-04-2013, 01:38 PM

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

06-04-2013, 09:27 PM

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

e to the pi Minus pi

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. *

06-05-2013, 07:37 AM

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

Kind regards

Thomas