© Copyright 1995, R.Lanigan-O'Keeffe, Sydney Australia. Not for copying without permission.

Return to Table of Contents
Return to HOME PAGE
Return to Appendix 7.
Forward to Chapter Fifteen
Finish reading Chapter Fourteen (text)

Appendix Eight

ROTATIONAL ENERGY
Calculations
For R.P.S

In this listing, certain parameters are set in the body of the program to ensure that all changes made by the computer user are working.

Only change the parameters, not the mathematics. Since each calculation takes time, finer resolutions involve progressively longer computer times, so a counter is included. This gives the value of "n". Using a radius of 5cm, a thickness of 0.1 cm, 1960 calculations were completed, however when this thickness was set to 0.05 cm n became 7,800. At 0.01cm the computer ran very slowly involving 100,000 complete calculations! At 0.001, the computer ran for a day to produce the first results.

In some versions of the BASIC language, the variables will need to be defined as floating point variables. The variable " J" may need the word "LET" to define it however the command ( i.e. LET J=3) is sometimes taken as an integer, so it may need to be written as J%= , J#= , J!= or as " J= 3. " where the full stop is important. In some cases a dimension statement may be needed (i.e. DIM J#(16)) to give the calculation double precision in the floating point mathematics. In other instances it is necessary to activate the mathematics co-processor to speed up the system. Further, because certain incremental program loops are automatically treated as integers the "STEP" function in the "FOR" loop is used. As the author cannot think for every version of BASIC, it is best to consult the "BASIC MANUAL" supplied with the computer if problems are encountered. REMarks are put in this copy of the program but do not need to be entered in the running program as they slow the system down. If the computer throws up a syntax error, then a line has either not been typed correctly, perhaps the computer will not accept a command like "CLS" which is the clear screen command. If such is the case, the Manual should be consulted.

Because this is a geometric construction of a sphere, the method is to determine the radius of each latitude disc, layer upon layer, latitude by latitude. In telescope making the method to determine the depth of the mirror (the sagitta) uses the Pythagoras theorem and the geometry of a circle to accurately determine the depth of an arc. In this situation, from the depth of an arc, the procedure will determine the shortest point between the ends or the arc. The reversed form of the sagitta equation quite accurately selectively segments a spheroid into latitude slices. The Basic Instruction for this reversed equation is

L= R - (R - SQR (( R^2 ) - ( LAT^2 )))

This expression needs to be used several times if a Golf ball or an Earth like structure is contemplated in order to distinguish boundary zones from the central Core to the Mantle to the Crust. In each case, the finishing point of one zone becomes the start of the next zone with its different density. As each is taken in turn for a latitude, a single series of GOSUB Routines can be used to return all the parameters for each layer. This program does not do this, leaving it for the user to attempt.

One can put the following example through the above computer program as a compact disc. Line 80 reads

80 D=0.749:R=6.:Th=0.13:RPS=40.:GOSUB 700

This line will need to be changed. The problem is given in a respected physics book. Where a pulley is travelling at 36 radians per second, ((57.3x36)/360=5.73 RPS) having a radius of 8 cm and a mass of 600 grams. This means making an assumption since the mass is Area time thickness times density, then the thickness is assumed as being one centimetre (merely to make the mathematics easy). So D=2.984157703. Lines 30 to 70 can be prefixed with the command "REM:" or deleted. Putting a "STOP" command at the end of this modified line will stop the program at that point. Line 80 must now read:-

80 D=2.984157703: R=8.0: Th=1.0: RPS=5.73: GOSUB 700:STOP

Save the programme as " ROTNERGY.MOD "


HOW TO ENTER THE FOLLOWING PROGRAMS

COMPUTERS have different merging modes. Some allow the Subroutine to be "LISTED" to the disc drive as "ASCII" text, to be "ENTERED" from the disc drive into an existing file. Such merging of a file is not possible in many computer systems, so the following is a procedure to reduce keyboard entry. If keyboard does not have "±" key then use "+" , " / " and " - " keys (+/-) .

STEP 1. IN THE COMPUTER'S BASIC ENVIRONMENT, (GWBASIC, QBASIC, GFABASIC, STOS, ATARIBASIC, BASIC etc.), ENTER FOLLOWING LISTING.
SAVE THE LISTING AS "ROTNERGY.BAS". CHECK THE INPUT FOR TYPO'S, DEBUG AND SAVE THE PROGRAM AGAIN. RUN THE PROGRAM.
--------------------------------
STEP 2. MODIFY AND SAVE AS "ROTNERGY.MOD" AS PER REQUESTED IN THE WORK. RUN AND NOTE WHAT HAPPENS.
--------------------------------
STEP 3. LOAD "ROTNERGY.BAS" AGAIN.
--------------------------------
STEP 4. SAVE THIS PROGRAM UNDER THE NAME "ERGY.BAS". THIS MEANS TWO COPIES OF THE SAME PROGRAM.
--------------------------------
STEP 5. ENTER THE INSTRUCTION "NEW" AND PRESS CARRIAGE RETURN
--------------------------------
STEP 6. LOAD "ENGY.BAS" (THE SECOND COPY)
--------------------------------
STEP 7. IN A BLOCK, DELETE LINES FROM LINE 200 TO LINE 590: SAVE THE PROGRAM AT THIS POINT.
--------------------------------
STEP 8. ENTER ITEM 2 "THE ENGY ROUTINE". FOLLOWING MAIN ROUTINE. SAVE IT AGAIN AS "ERGY.BAS". CHECK THE PROGRAM FOR ERRORS, Correct these and SAVE the program.
--------------------------------
STEP 9. RUN THE PROGRAM.

PROG: ROTNENGY.BAS

10 CLS: PRINT "Welcome to a Demonstration of the power of"
19 REM SET THE PARAMETERS
20 GOSUB 1000: REM USE PRESETS
30 GOSUB 680: Th=0.1:GOSUB 600
40 RPS=20:GOSUB 650
50 RPS=100:GOSUB 650
60 RPS=500:GOSUB 650: RPS=10: Th=0.05: GOSUB 690
70 R=20: GOSUB 630
80 D=0.749:R=6.:Th=0.13:RPS=40.:GOSUB 700
90 RPS=100: GOSUB 700
95 PRINT:GOSUB 1240:PRINT:FOR I=1 TO 59:READ A:PRINT CHR$(A);
96 NEXT I:GOSUB 1230:GOSUB 1220:GOSUB 1230:END
100 REM: MAIN PROGRAM LOOPS AND ROUTINES
200 X=0:Y=0: REM RESET CALCULATION COUNTER
210 FOR LAT=CC TO R STEP TH
220 IF LAT>(R-Th) THEN GOTO 500
230 L= R-(R-SQR((R^2)-(LAT^2))) :REM SET LATITUDE DISC LIMIT
240 FOR R2=CC TO L STEP Th : REM POSITION LATITUDE ANNULUS
250 R1=R2+Th:IF R2>L THEN GOTO 360:REM OVERSIZE FIX.
260 Q=(R1^2)-(R2^2):REM PARAMETERS OF ANNULUS
270 V1=Q*Pi*Th: REM FIND ANNULUS VOLUME280 M1=V1*D: REM DETERMINE ITS MASS
290 N1=M1*(2*PI*(R2+C5)*RPS): REM DETERMINE MOMENTUM
300 E1= (0.5*(N1*(2*PI*(R2+C5)*RPS))) : REM AND KINETIC ENERGY
310 V3=V1+V3: REM SUBTOTAL VOLUME
320 M3=M1+M3: REM SUBTOTAL MASS
330 N3=N1+N3:REM SUBTOTAL MOMENTUM
340 E3=E1+E3:REM SUBTOTAL ENERGY
350 X=X+1:NEXT R2
360 V2=V2+(2*V3):REM VOLUME FOR BOTH HEMISPHERES
370 M2=M2+(2*M3):REM MASS FOR BH
380 N2=N2+(2*N3):REM MOMENTUM FOR BH
390 E2=E2+(2*E3):REM ENERGY FOR BH
400 Y=Y+1:IF Y=1 THEN PRINT "Disc Volume ";V3;" cc. Mass is ";M3;" grams"
401 PRINT "Disc Momentum ";N3;:GOSUB 1260
402 PRINT "Energy is ";E3;:GOSUB 1270:PRINT
403 IF FLAG=1 THEN FLAG=0:GOTO 550
405 REM CLEAR SUB TOTAL REGISTERS
410 V3=0:V1=V3:M3=V3:M1=V3:N3=V3:N1=V3:E3=V3:E1=V3
420 NEXT Lat:: REM END OF MAIN GOSUB
500 L1=((MS-M2)/MS)*100:L2=((VS-V2)/VS)*100:REM ORDER OF ERROR
510 PRINT "At ";Th;" cm Sphere's Mass error ";L1;"% Volume error ";L2;"%"
520 IF L1>1 OR L2>1 THEN GOSUB 1280
530 PRINT "Sphere's Momentum ";N2;:GOSUB 1260:PRINT "±";L1*N2/100;:GOSUB 1260 :PRINT
540 PRINT "Energy ";E2;:GOSUB 1270:PRINT "±";L1*E2/100;:GOSUB 1270:PRINT
550 PRINT "That took ";x;" calculation loops!"
560 IF X>12000 THEN PRINT "Sorry about the delay but this is fabulous resolution"
570 RETURN
599 REM Decreasing routines
600 PRINT: GOSUB 1300: GOSUB 1340: GOTO 680: REM Thickness
610 PRINT: GOSUB 1300: GOSUB 1330: GOTO 680: REM Speed
620 PRINT: GOSUB 1300: GOSUB 1400: GOTO 680: REM Density
630 PRINT: GOSUB 1300: GOSUB 1320: GOTO 680: REM Radius
639 REM Increasing routines
640 PRINT: GOSUB 1300: GOSUB 1340: GOTO 680: REM Thickness
650 PRINT: GOSUB 1300: GOSUB 1330: GOTO 680: REM Speed
660 PRINT: GOSUB 1300: GOSUB 1400: GOTO 680: REM Density
670 PRINT: GOSUB 1300: GOSUB 1320: GOTO 680: REM Radius
679 REM ACTION & PRINT
680 PRINT: GOSUB 1100: PRINT: GOSUB 200: RETURN
690 PRINT: GOSUB 1300: GOSUB 1330: GOTO 680: REM Many parameters
699 REM Do a disc only
700 FLAG=1: PRINT: GOSUB 1300: GOSUB 1330: GOSUB 680: FLAG=0: RETURN
999 STOP: REM SETUP THE VARIABLES
1000 GOSUB 1200:GOSUB 1230: PRINT: REM DISPLAY TITLE
1010 Pi=3.14159 :REM Set value of Pi.
1020 R=5.0 : REM Set the radius of sphere to 5 cm
1030 D=0.88 : REM Density to 0.88 grams per cubic centimetre
1040 Th=0.5 :T= Th : REM Th is disc thickness. T sets a sample rate equal to the thickness.
1050 RPS=10: REM Set the Origin of sphere to zero
1060 CC=0.0:ID=CC:RETURN:REM Set origin
1099 REM CLEAR ALL REGISTERS IN FLOATING POINT MODE
1100 V1=0.0:V2=V1:V3=V1
1110 M1=V1:M2=V1:M3=V1
1120 N1=V1:N2=V1:N3=V1
1130 E1=V1:E2=V1:E3=V1
1139 REM SET FIXED CONSTANT VARIABLES
1140 C1=Pi*Th: C2=2*Pi*RPS:C3=2*(Pi^2)*Th*D*RPS:C4=C3*Pi*Th*RPS:C5=0.707*Th
1149 REM Determine and NOTE THE CALCULATED VOLUMES AND MASSES
1150 MD=C1*D*(R^2).: PRINT "Disk thickness " ;Th;" cm ":PRINT "Mass is ";MD;" grams"
1160 VD=C1*(R^2):VS=(4/3)*Pi*(R^3)
1170 PRINT "Tip Speed is ";C2*R;" cm/s"
1180 MS=D*VS:PRINT "Sphere's Mass ";MS;" grams"
1190 RETURN
1200 CLS : PRINT "ROTATIONAL ENERGY"
1210 PRINT :PRINT "by":PRINT
1220 PRINT "Robert P. .Lanigan-O'Keeffe";: RETURN
1230 PRINT:PRINT:RETURN
1240 PRINT "Nature is Simple":RETURN
1260 PRINT "gm/cm/s ";:RETURN
1270 PRINT "gm/cm/s^2 ";:RETURN
1280 PRINT "That error is A BIT high":RETURN
1290 FLAG=1:PRINT:PRINT "Consider a quad speed CD":GOSUB 1310:GOSUB 1320:GOSUB 1310: GOSUB 1330:GOSUB 1300:GOSUB 1340:GOSUB 1310:GOTO 1400
1300 PRINT "Lets increase the ";:RETURN
1310 PRINT "Lets decrease the ";:RETURN
1320 PRINT "radius to ";R;:GOTO 1390
1330 PRINT "speed to ";RPS;" rps " :RETURN
1340 PRINT "thickness to ";Th;" cm ":RETURN
1380 RPM=60*RPS:PRINT RPS;" rps or ";RPM;" RPM":RETURN
1390 PRINT " cm";:RETURN
1400 PRINT "the density to ";D;" grams/cc ":RETURN
5000 DATA 84,104,101,32,80,111,119,101,114
5001 DATA 32,111,102,32,78,97,116,117,114
5002 DATA 101,32,101,120,99,101,101,100,115
5003 DATA 32,97,108,108,32,101,120,112,101,99
5004 DATA 116,97,116,105,111,110,115,32,111,102
5005 DATA 32,111,110,101,39,115,32,109,105,110,100,46

SAVE "ROTNERGY": and RUN it.

This program chiefly uses GOSUB routines to do the fancy screen handling and reporting. To change any parameter means directing the program lines 30 to 99 to the routine in lines 600-700. To change the Density one uses either the GOSUB routines of line 620 or 660 depending on whether the value is decrease, the lower line number or increased with the higher line number. So to increase it would be something like D=8:GOSUB 660: To vary many parameters, GOSUB 690. To view a disc only, GOSUB 700 is used.

The actual mathematical routine is stretched from lines 200 to 500, using a nested loop structure. The first loop increments the latitude disc from the equator to the pole. Only one hemisphere is studied. The results are simply mirrored. The internal loop determines the area, mass, velocity, momentum and energy of each annulus. The results are added in the variables V2, M2, N2 and E2. The initial set up and test parameters are located in lines 1000 to 1100: These are necessary, however they can be modified. The above program was written, run and tested on a AMIGA, Atari ST (in Atari & IBM modes), Macintosh Plus, Atari 800 and JVC MSX. There are slight variations in accuracies between machines. Although the JVC is an ancient and slow 8 bit computer, it is superior in its mathematical manipulation. (As small machines all had different operating systems, MSX was introduced as the universal PC operating system. Unfortunately, it became the "Esperanto" of computers, just another operating system since it failed to gain acceptance.)

As pointed out in a previous appendix, some basic interpreters demand that the variable name carries an extension, such as %, # or $, before the mathematics is recognised and processed with the correct floating point and double precision variable names. This means converting the programs to the basic interpreter used. Basic has a similar structure to Fortran, so it would be simple to transpose the routines.

PROG: ERGY.BAS

200 X=0:REM reset calculation counter
210 FOR LAT=CC TO R STEP TH
220 X=X+1:IF LAT>(R-Th) THEN GOTO 340
230 R1=LAT+TH:R2=LAT:IF R1>R THEN GOTO 380:REM OVERSIZE FIX
240 R3=C5+R2:Q=(R1^2)-(R2^2):REM PARAMETERS OF ANNULUS
250 A=(R-R3):H=2*(SQR((2*A*R)-(A^2))): REM FIND ANNULUS HEIGHT
260 V1=PI*Q*H: REM DETERMINE VOLUME
270 M1=V1*D: REM AND MASS
280 N1=M1*(2*PI*(R2+C5)*RPS): REM DETERMINE MOMENTUM
290 E1= (0.5*(N1*(2*PI*(R2+C5)*RPS))) : REM AND KINETIC ENERGY
300 V2=V2+V1: V3=V2: REM TOTAL VOLUME
310 M2=M2+M1: M3=M2: REM TOTAL MASS
320 N2=N2+N1: N3=N2: REM TOTAL MOMENTUM
330 E2=E2+E1: E3=E2: REM TOTAL ENERGY
340 IF Y<>1 THEN GOTO 390
360 IF Z1<2 AND M2>M4 THEN Z1=4: PRINT LAT/ R:"r is Mass balance"
370 IF Z2<2 AND N2>N4 THEN Z2=4: PRINT LAT/ R:"r is momentum balance"
380 IF Z3<2 AND E2>E4 THEN Z3=4: PRINT LAT/ R:"r is Energy balance"
390 NEXT LAT
360 V2=V2+(2*V3):REM VOLUME FOR BOTH HEMISPHERES
370 M2=M2+(2*M3):REM MASS FOR BH
380 N2=N2+(2*N3):REM MOMENTUM FOR BH
390 E2=E2+(2*E3):REM ENERGY FOR BH
400 L1=((MS-M2)/ MS) * 100: L2=((VS-V2)/ VS)*100 : REM DETERMINE ERRORS
410 PRINT "Mass ERROR is " ;L1;" % Volume ERROR is ";L2;"%
420 IF L1>1 OR L2>1 THEN GOSUB 1280: REM STATE ERRORS ABOVE 1%
430 PRINT "CALCULATED RESULTS":PRINT "Mass ";M2;" grams"
440 PRINT "Momentum ";N2;:GOSUB 1260:PRINT "± ";L1*N2/100;: GOSUB 1260: PRINT
450 PRINT "Energy ";E2;:GOSUB 1270:PRINT "±";L2*E2/100;:GOSUB 1270:PRINT
455 PRINT "or in MKS ';e2/10000000;"nt-m."
460 PRINT "in ';X;" calculations."
470 IF X>10000 THEN PRINT "NICE RESOLUTION"
480 M4=M2/2.:N4=N2/2.:E4=E2/2.
490 Y=Y+1
500 V1=0:V2=V1:V3=V1:M1=V1:M2=V1:M3=V1:N1=V1:N2=V1:N3=V1:E1=V1:E2=V1: E3=V1
510 PRINT "Starting Second Scan":GOTO 200
520 Y=0:Z1=Y:Z2=Y:Z3=Y:RETURN.

* Save and run the bliter....

-------------------End of Appendix 8 -----------------


RETURN TO:
Table of Contents
HOME PAGE
Appendix 7
Chapter Fourteen (text, to continue reading)
GOTO :
Top of page.
Chapter Fifteen


Hosted by www.Geocities.ws

1