Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Parallel

Dr. Dobb's Math Power Newsletter - December 2003


Dr. Dobb's Math Power Newsletter - Vol. 9, No. 9, September 2003 - ISSN 1087-2035

 

Math Power

Official Publication of Math Power Club
Incorporating LIGHT WORK and COMPUTER WRANGLER
Math Power Club is an Unofficial Club of Pima CC East
Editor and Publisher Emeritus: Homer B. Tilton

Vol.9, No.11, December 2003 - ISSN 1087-2035


ACCELERATION
By Homer Tilton with Contributions from Akhlesh Lakhtakia and Florentin Smarandache
Special Thanks to David Iadevaia, Jim Oliver, Jim Malmberg, and Norman

Part 1. Acceleration due to light pressure

SuperCalculator News

Sexagesimal Arithmetic

The largest part of today's windows computer programs is taken up by overhead in providing the glamor and glitz. When that part is stripped away, many of today's gee-whiz programs can be replaced by compact batch files. This time-anywhere-in-the-world batch file is an example.

Angles are perhaps most often specified in degrees, minutes, and seconds, but they can also be specified in decimal degrees, as slide rule manufacturers found convenient to do, with their so-called "decitrig" scales. Similarly, time of day is normally specified in hours, minutes, and seconds, but it can also be specified in decimal hours. "Sexagesimal" means base 60, being the relationship of hours or degrees to minutes and seconds of either genre.

Our interest turns at this time to an algorithm for doing sexagesimal arithmetic to facilitate time conversions. As you read through this article, a really simple batch file called TIMEX.BAT to do that job will unfold. In this implementation, PC time is read in decimal hours, then a decimal hour shift is specified by the user, to be added or subtracted by the program, & the result is presented in sexagesimal format. While that job historically was performed by a comparatively large program (typically 46196 bytes -- see May '96 COMPUTER WRANGLER) called ALLTIME.EXE which was unreadable maybe even in its source pre, TIMEX.BAT does that to display a running clock for time anywhere in the world using less than 2200 bytes and it is totally readable with the source pre being the final program.

Getting started

The Smart BASIC TIMER function returns the number of seconds since midnight and so you can retrieve your computer time in decimal hours with this Smart BASIC miniprogram:

Echo PC=TIMER/3600:?PC|ok

Invoke it at the DOS command prompt. As always, "ok" refers to Smart BASIC which is just GWBASIC.EXE renamed to ok.EXE. If your computer time is standard time then PC+N will give the decimal standard time at a location N time zones east of you. There are 24 time zones around the world, each encompassing a 15-degree band of latitudes.

We now need a routine to adjust the resulting hour to fall between 0 and 24, while providing a tomorrow/yesterday (carry/borrow) flag. The result is to be presented in sexagesimal format. The overall effect is to add a decimal number N to a sexagesimal number. N can be negative and it need not be integer; this is a must, since fractional time zones are encountered for example in Iran and Newfoundland.

Keeping the hour between 0 and 24

Here is an algorithm breadboard -- a small batch file -- which keeps the hour between 0 and 24 and provides a tomorrow/yesterday flag; but be sure there is not already a file named TMP that you want to save:

@Echo off

:: This is TESTBED.BAT. The %1 batch parameter that you supply at the

:: keyboard is the number of the destination time zone.

SET CT=7

:: ^ Put your computer time zone here;

:: 10 Honolulu, 8 Los Angeles, 7 Denver, 6 Chicago, 5 New York.

Echo 10 PC=TIMER/3600:T=PC-%1+%CT%>tmp

Echo"20 If T>=24 then T=T-24:Tom=1 else T=T'">>tmp

Echo"30 If T<0 then T=T+24:Yst=1 else T=T'">>tmp

Echo 40 ?:?PC,T>>tmp

Echo 50 If Tom=1 then ?"Tomorrow" >>tmp

Echo 60 If Yst=1 then ?"Yesterday">>tmp

ok tmp.

Type it exactly as shown. Run it by invoking TESTBED -12 or TESTBED 12 or use another zone number, x. The display will show the actual decimal time at a location which is x time zones west of GMT and whether it is tomorrow or yesterday there.

Converting to sexagesimal format

Given decimal hour, we can convert to hh:mm format as illustrated by this Smart BASIC minprogram typed at the DOS command prompt:

Echo T=12.5:HH=INT(T):MM=INT((T-HH)*60):?HH":"MM|ok

That should return 12:30. Actually it shows a spaced-out 12 : 30 instead. We'll fix that in the final program, TIMEX2.BAT.

The listing for TIMEX2.BAT appears below. You can type it using EDIT. The help text makes up half the file. A typical display produced by TIMEX.BAT shows running clock time and looks like this:

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

TIMEX2 - F10 to exit <--A reminder to hit the F10 function key to exit

12:10:12 Computer time <--Running local time; 24-hr clock

04:10 Tokyo/-9 <--Running time at destination/zone index

Tomorrow <--This note automatically adjusts itself

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

The command <<TIMEX -9 Tokyo>> calls up that display. Fractional indexes are allowed; thus the command <<TIMEX -5.5 Bombay>> is perfectly good. The on-screen display can be printed out any time by tapping the PrntScrn key with printer on line.


@Echo off

:: This is TIMEX2.BAT - Homer B.Tilton - 5 Apr 2003/WK14/Sat

:: For MATH POWER Dec'03

:: Like TIMEX.BAT but with zone numbers adjusted so that AZT is zone 7

:: Computer time zone is retrieved from environment variable CT

If "%1" == "" goto help

Echo 60 ON KEY(10) GOSUB 200: KEY(10) ON>>tmp

Echo 70 ?:?"- TIMEX2 - F10 to exit">>tmp

Set CT=7

:: ^ Your computer time zone; 8 is PST, 7 is MST, 6 is CST, 5 is EST

::Loop starts here

Echo 90 ?:?time$" Computer time">>tmp

::Develop decimal time

Echo 110 PC=TIMER/3600:T=PC-%1+%CT%>>tmp

Echo"120 If T>=24 then T=T-24:Tom=1'">>tmp

Echo"130 If T<0 then T=T+24:Yst=1'">>tmp

::Extract hours HH and minutes MM

Echo 140 HH=INT(T):MM=INT((T-HH)*60):?>>tmp

::Convert to sexagesimal HH:MM designation

Echo"150 If HH<10 and MM<10 then?using "0#:0#";HH;MM;'">>tmp

Echo"160 If HH<10 and MM>9 then?using "0#:##";HH;MM;'">>tmp

Echo"170 If HH>9 and MM>9 then?using "##:##";HH;MM;'">>tmp

Echo"180 If HH>9 and MM<10 then?using "##:0#";HH;MM;'">>tmp

Echo 181 ?" %2/%1">>tmp

Echo 182 If Tom=1 then ?"Tomorrow">>tmp

Echo 184 If Yst=1 then ?"Yesterday">>tmp

Echo 186 Tom=0:Yst=0>>tmp

Echo 190 Locate 3,1:Goto 90>>tmp

Echo 200 SYSTEM:END>>tmp

ok tmp.

:: ^ Period is necessary

del tmp

:Help text:

Echo TIMEX2 -12 Wake_Island - west of int'l dateline from AZ view

Echo TIMEX2 -11 Melbourne/Sidney

Echo TIMEX2 -10 Guam

Echo TIMEX2 -9 Tokyo/Seoul

Echo TIMEX2 -8 Manilla/Hong_Kong/Taipei (All of China is on Hong Kong Time)

Echo TIMEX2 -6.5 Rangoon

Echo TIMEX2 -5.5 Bombay/Calcutta/Delhi

Echo TIMEX2 -4 Baghdad/Israel/Moscow (Civil time)

Echo TIMEX2 -3.5 Tehran

Echo TIMEX2 -3 Baghdad/Moscow/Riyadh (Astronomical time)

Echo TIMEX2 -2 CapeTown/Helsinki/Jerusalem/Johannesburg (London in Summer)

Echo TIMEX2 -1 Brussels (London in Winter)

Echo TIMEX2 0 GMT (Zulu Time) (Belfast, Edinburgh, Casablanca)

Echo TIMEX2 3.5 Newfoundland Standard Time

Echo TIMEX2 4 EDT/AST (Atlantic Standard Time) (Halifax,Nova Scotia)

Echo TIMEX2 5 CDT/EST (Quebec, Toronto, San Juan, Havana)

Echo TIMEX2 6 MDT/CST (Denver in Summer)

Echo TIMEX2 7 PDT/MST_AZT (Arizona Time) (Sonora Mexico, LA in Summer)

Echo TIMEX2 8 PST (Los Angeles in Winter, Juneau in Summer)

Echo TIMEX2 9 AST - Alaska Standard Time

Echo TIMEX2 10 HI Time/Aleutian ST - east of int'l dateline from AZ view

Echo TIMEX2 11 Samoa standard time

Mail Matters

Liked the "Acceleration" article (Nov issue)
Phone call received 8 Sep'03 (paraphrased):

Hi Homer-
Could you print a copy of "Acceleration" with a laser printer for me? I want to check out the possiblity of submitting it to another journal.
...Florentin Smarandache, U of NM

Florentin-
I'd love to. Unfortunately, the laser printers we have are incompatible with the mathematical word-processor we've come to know and love. Perhaps Dr. Dobb would let you download a copy of his e-mail newsletter rendition, or I could supply you with a close copy on diskette in ASCII if he does not object. Thanks for supporting the article, Dr. S.!
...HBT

3-D or not 3-D; that is the question

Dear Homer-
Do you have something published on seeing stereo "effects" with a mono projector? Do you have Email? Then I'll call you. P. 4 (Math Power) Basic -- How can I get a modern (simple) Basic which runs on Mac?
All the best, Leonard "Len" X. Finegold, Dept. of Physics, Drexel U.

Dear Len-
I am not sure what you mean by "projector;" do you mean a slide projector, a PC-monitor projector, a TV/video projector, a movie projector? I.e., what is the basic imaging medium you have in mind. There are several publications describing 3-D in mono images. Some are in hard-cover books as listed below. If you'd like to be pointed to more such publications by others let's hear your specific needs and concerns. If your Mac can run DOS programs, you're all set. GWBASIC runs on nearly all versions of DOS. I know of no BASIC specifically written for Mac.
...HBT

The editor, having written a book on REALbasic for the Mac, feels compelled to point out that it's a pretty nice implementation and runs on Mac OS X as well as older versions of the OS and on recent versions of Windows. Whether Homer or Dr. F. would regard REALbasic as "real" Basic or not depends on how they feel about Visual Basic, which it resembles. For older Macs there are other Basic implementations as well, but the reader might have to search for them. -ms

Received 4 Aug '03:

Dear Homer-
Thanks. We have the 1993 Stereo Computer Graphics book which answered my questions clearly. Good article. All the best.
...Len

3-D BOOK LIST -

  • 1967: HBT, "Principles of Scenographic CRT Displays," pp. 349-374 in AUTOMATION IN ELECTRONIC TEST EQUIPMENT, VOL. IV, David M. Goodman, Ed., New York U.P.
  • 1971: HBT, "Real-time Direct-viewed CRT Displays having Holographic Properties," pp. 415-422 in Proceedings of the Technical Program, Electro-Optical Systems Design Conference - 1971 West, Publ. Cahners Exposition Group, 1350 E. Touhyt Ave., Des Plaines, IL 60018
  • 1986: HBT, The 3-D Oscilloscope, Prentice-Hall, ISBN 0-13-920240-4
  • 1993: HBT, "Moving Slit Methods," Chapter 8 in Stereo Computer Graphics, David F. McAllister, Ed., Princeton U. Press, ISBN 0-691-08741-5
  • 2001: HBT, "An Autostereoscopic CRT Display," pp. 284-288 in Selected Papers on Three-Dimensional Displays, Stephen A. Benton, Ed., SPIE Optical Engineering Press, Bellingham, WA, ISBN 0-8194-3893-6

Physics on Mars

If an object is dropped off a 150-foot cliff on Mars, how many seconds will

it take to reach the ground? Note: The acceleration due to gravity on Mars is 12.2 ft/sec2.

Ans. Use the formula s=1/2at2 or t=(2s/a); s=150, a=12.2.

t = (300/12.2) = 5.0 sec, rounded to the nearest tenth.


If you liked TIMEX.BAT (see pp.1-3) and want more, buy the latest edition of GENERIC PC MATH: A PRACTICAL HANDBOOK for Graphing and Calculating. It shows how to write your own batch programs to do special tasks.


Words of the month

sic; intentionally so written
scientifiction; science fiction with the accent on science; Coined by Hugo Gernsback, Editor-in-Chief of 1930's pioneering Radio-Craft magazine.


Scientifiction by Ralph Nerdnick

How lobarithms [sic] were invented on Earth 124C

Imagine that you are Head Mathematical Investigator in a parallel universe in which logarithms have not yet been discovered or invented. How would you go about solving b^x=p for x under those circumstances?

How, indeed. Well if you are successful you may just find you have invented logarithms along the way. But we're getting ahead of our story.

"Hmm," you think; "b^x=p. If I conjure up some previously undefined action or operator which is capable of recovering x when applied to b^x, then... ? Aha! I'll call that operator lob, after my best friend, Lobo. Symbolically I can now write, by the Universal Theorem of Equations,

lob(b^x) = lob(p)

applying lob to both sides, and

x = lob(p)

because that's what lob does. Holey guacamole!"

You investigate the various properties of lob, and when a communications channel is later established with your counterpart on Earth Prime, it becomes apparent you have invented logarithms (you came to call them lobarithms -- close enough), and specifically lob is the same as log base b. [Read about the invention of logarithms on Earth Prime on p. 89 of: Dirk J. Struik, A Concise History of Mathematics, Rev. 4th ed., Dover, 1987, ISBN 0-486-60255-9.]


The operator idea figures prominently in the modern Dirac algebra of quantum mechanics. There is a "creation operator" and a "destruction operator" among many others, their names describing their designated actions.


The Universal Theorem of Equations: You can perform the same operation to both sides of an equation and you'll still have a valid equation.

You can add the same thing; multiply by the same thing; color both sides yellow; use each side as a numerator over a common denominator, or as a denominator under a common numerator; use each side as an exponent on a common base; apply oog to both sides where "oog" need not even be initially defined.

"Oh yeh?" says Joe Negative. "You can't divide both sides by zero!"

Response: "You mean because then it might be undefined? Let's think about that. Read my book, Special Calculus, then we'll talk."


The hard copy version of MATH POWER is published as a shareletter; that means you are permitted to make not-for-profit copies of it for distribution to your colleagues and students.


MATH POWER is published monthly. It is published and edited by Homer B. Tilton under the auspices of Pima Community College, East Campus, 8181 E. Irvington Rd. Tucson AZ 85709-4000. Editorial Assistant, Jo Taylor. All material is copyright Homer B. Tilton unless otherwise noted. A limited number of copies may be made at educational institutions for internal use of faculty and students. For more extended copying or to request additional copies contact the Editor at the above address. Letters and editorial material are welcome. All submitted material may be published in MATH POWER, and edited, unless specifically requested otherwise.


Written reader comments are invited on all material. Those intended for my attention must be submitted by US Mail to my Tucson address. All such comments are subject to being published unless requested otherwise. They may also be subject to editing. ...Homer Tilton, Editor


Is There Daylight-Saving Time on Mars?

...Groucho might have answered, "I sointenly hope not." Of course that question will make little sense until some time after settlements have been established there.

Mars makes one rotation in just a little less than one Earth day (about 0.9747), and a system of 24 time zones around the planet -- like Earth's -- can already be seen to make sense. A fact article in Analog/Astounding magazine around 1939 pointed out that a wind-up alarm clock -- common at the time -- could easily be adjusted to keep accurate local time on Mars because of the closeness of its rotation rate to that of the Earth.

Synchronous electric clocks designed to run with 100% accuracy on Earth using power having a frequency of 60 hertz would keep accurate local time on Mars, if Mars Edison were to maintain a frequency of 58.48206 Hertz. That choice of power-line frequency is good for another reason as well; it lies within the range of the 50-60 Hertz rating common to other electrical appliances of today. Sorry, Charlie, but your highly-accurate quartz-crystal clocks of today would run fast on Mars! (They'd still keep accurate Earth time of course, for whatever that's worth.)

Latitude comes naturally on any planet for which opposite north and south poles can be defined. Deneb, of first magnitude in the constellation Cygnus (the swan), is the Martian Polaris. It is brighter than the Earth Polaris. Since Earth is embedded in the Cosmos just as is Mars, Deneb can be seen from any backyard in the northern hemisphere of Earth as well as Mars. Look for it along the Milky Way between Lyra and Pegasus. Find it in the night sky to make a close Martian connection!

Longitude on Mars is sudivided into 360 degrees as on Earth as you go 'round the equator; and with 24 hours in a day, moving fifteen degrees would take you to a new time zone there just as on Earth.

National Geographic published a large foldout color Mercator projection of Mars some years ago. It carried no political subdivisons (there were none) but geographic features were clearly marked on it. I've misplaced my copy, but Duncan (1946) gave a small such map that he credits to Flammarion and Antoniadi. It situates the prime meridian just west of Eden (near 30°N latitude) putting Utopia near 100°E and Tempe around 65°W. Take care when reading that map; astronomers have the annoying habit of printing everything upside down!

Patrick Moore (A Guide to Mars, Macmillan, 1958) gave a map agreeing with the Flammarion and Antoniadi map at the inside front & back covers (the same illustration in both places), with written descriptions of the surface features on pages 113 and 114. There are better references today. The National Geographic map mentioned above is one. Find one for yourself and grab it!

Decide where you'd like to settle on Mars, then consider the time at that point relative to the prime meridian. Do something, son and daughter! Make a TIMEX-for-Mars batch file! Don't just sit there!


SuperCalculator

A new, more-appropriate name is introduced this month for the system of calculation using Smart BASIC (Microsoft GW-BASIC(R)) which we have been touting in these pages almost from day 1; we call it a SuperCalculator. More specifically we call it our

Programmable, Graphing, Printing SuperCalculator

"Super" because it has a super-size screen with color and hi-res. graphs.


THE FIRST STARSHIP
Conclusion: Chapter 7. Welcome home starman!

The sun looms large. You'd forgotten how large.

The artificial gravity is gradually increased during these final weeks until you are at nearly 1G; thus you will have little trouble regaining your land legs when you finally step out onto Terra Firma.

You recall the story of the "Twins Paradox" and wonder, "Will all my friends have aged more than me?" Maybe some have even been dead for years. But no; you've kept up with the obits so you know that hasn't happened. And you've been informed of the current Earth date and time.

The newscasts from Earth which you had been following almost daily during the trip are now up to date. Yes, you come home fully informed and educated on all that has transpired since you left, eight-plus years ago. You know that a respectable space infrastructure has grown up, on and around the Moon and around Earth while you were gone, and that -- in addition to the now-budding Jupiter Base -- the first permanent Mars base, Bradbury, is nearing completion. You suppose that this impressive progress can be partly attributed to the inspiration provided by SS Alpha's success reported daily in the local news, and to the Priestley oxygen generators that have sprouted-up all across Mars.

The ship inserts into lunar parking orbit.

You are next transported to Moon Base Armstrong with the entire crew for debriefing and you see and talk with mom and dad by high definition video link. You hear "Our Boy," bringing you down a notch. After that you are transported directly to Earth Station Goddard and taken from there to the surface by a new generation of high-apogee shuttle.

You are now only 30-ish, having left when you were 22. On the way you muse: If someone asks me, "Would you do it again?" I'd answer, "Give me two weeks!" Then, "But we really need three bio-modules so everybody can eat better."

It was surprising to learn that Earth clocks are almost half an hour behind the ship's. The reason, you are now told, is that while you were in space experiencing an average gravitational force of 1/2G, those who stayed behind were immersed in a full 1G field. Thus for eight years, atomic clocks on the ship ran faster than clocks on Earth in accordance with the general theory of relativity. It turned out that the opposite effect, which some had predicted from special relativity, did not materialize. You wonder if this new information will be enough to justify an attempt to break the light barrier next time out. You remember the video movie, Longitude, and think: "John Harrison, we need a new space clock; maybe an atomic clock whose output is compensated in an electronic circuit by a gravity-force sensor signal."

You're anticipating being home with your family once again. You're about to find that the toughest part of the journey lies ahead for you and your eleven crewmates, with ticker-tape parades followed by weeks of guest spots and interviews. The excitement is electric; the world has been following your epic journey all the way.

THE BEGINNING ... Homer Tilton


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.