[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Katoomba Scenic Railway not steepest?



Michael Roebuck wrote:

> On Sun, 07 Feb 1999 23:39:18 +1100, David Johnson
> <trainman@ozemail.com.au> wrote:
>
> >For these formulae,
> >Gradient in % = "GP"
> >Gradient in degrees = "GD"
> >Gradient in rise:horizontal distance = 1 in "GH"
> >
> >GP = (tan (GD)) * 100
> >GP = (1 / GH) * 100
> >
> >GD = inv tan (GP / 100)
> >GD = inv tan (1 / GH)
> >
> >GH = 1 / (GP / 100)
> >GH = 1 / (tan (GD))

> Sorry David, I'm not a mathematician.

OK, I thought about it, and wrote a program for QBASIC which would automatically
convert it for you.  Simply copy this code into QBASIC and run it.  It probably won't
work properly on other versions of BASIC, because of the way they handle TAN and ATN
differently.

1 REM Copyright David Johnson
5 RAD = 3.141592654# / 180
10 CLS
20 PRINT "Gradient Conversion Program"
30 PRINT "Enter Number of known data"
40 PRINT "1 = Rise : Distance (1 in x)"
50 PRINT "2 = Angle (Degrees)"
60 PRINT "3 = Percentage"
70 INPUT G
80 CLS
90 IF G = 1 THEN 200
100 IF G = 2 THEN 300
110 IF G = 3 THEN 400
120 GOTO 10
200 INPUT "Enter Horizontal Distance - 1 in "; GH
210 GP = (1 / GH) * 100
220 GD = ATN(1 / GH) / RAD
230 GOTO 500
300 INPUT "Enter Angle in degrees "; GD
310 GP = (TAN(GD * RAD)) * 100
320 GH = 1 / (TAN(GD * RAD))
330 GOTO 500
400 INPUT "Enter Gradient Percentage "; GP
410 GD = ATN(GP / 100) / RAD
420 GH = 1 / (GP / 100)
430 GOTO 500
500 CLS
510 PRINT "Gradient is:"
520 PRINT "1 in"; GH
530 PRINT GD; " degrees"
540 PRINT GP; "%"
550 END

Feel free to point out any errors found - I just knocked this up and did some simple
testing on it.

--
David Johnson
CityRail Guard
trainman@ozemail.com.au
http://www.ozemail.com.au/~trainman/