(50g) Earthquake Magnitudes: How Much Stronger?
|
07-06-2019, 01:21 PM
Post: #1
|
|||
|
|||
(50g) Earthquake Magnitudes: How Much Stronger?
In honor of the two large earthquakes here in Southern California in the past two consecutive days, here's a little User RPL program called 'QUAKE' which answers the question, "How much bigger in one earthquake than another earthquake?"
"Earthquake magnitude" has many different meanings. This program uses the definition used by the USGS, since that's what the US news services quote. INPUT: Two earthquake magnitudes (order doesn't matter). OUTPUT: How much "BIGGER" the larger quake is, and how much "STRONGER" (energy expended) the larger quake is. Both outputs are tagged. Example: Yesterday's quake was M7.1 and the quake the day before that was M6.4. How much worse was yesterday's quake? 7.1 ENTER 6.4 QUAKE --> STRONGER: 11.2 BIGGER: 5 So yesterday's quake was 5 times bigger and 11.2 times stronger than the quake the day before that. 'QUAKE' << I->R - ABS ALOG LASTARG 2. / ALOG OVER * 1. RND "STRONGER" ->TAG SWAP 1. RND "BIGGER" ->TAG >> BYTES: 76.5 #EECDh The math is simple. If the two magnitudes are A and B: BIGGER = 10^ABS(A-B) STRONGER = 10^(ABS(A-B)/2)*BIGGER Simplifying the program is left as a micro-challenge. <0|ɸ|0> -Joe- |
|||
07-06-2019, 04:20 PM
Post: #2
|
|||
|
|||
RE: (50g) Earthquake Magnitudes: How Much Stronger?
Hi, Joe: Sorry for the quakes, we had a respectable one last week or so in Costa Rica, no damage. (07-06-2019 01:21 PM)Joe Horn Wrote: Example: Yesterday's quake was M7.1 and the quake the day before that was M6.4. How much worse was yesterday's quake? HP-71B: INPUT A,B @ T=ABS(A-B) @ "Bigger:";10^T;", Stronger:";10^(1.5*T) Trivial but shorter and way less cryptic, as usual. If you want results rounded to just 1 decimal place, place a FIX 1 anywhere before the output. Have a nice weekend. V. All My Articles & other Materials here: Valentin Albillo's HP Collection |
|||
07-06-2019, 05:06 PM
Post: #3
|
|||
|
|||
RE: (50g) Earthquake Magnitudes: How Much Stronger?
(07-06-2019 01:21 PM)Joe Horn Wrote: 'QUAKE' Interesting. I make that 86 bytes but with the same checksum as you. There's this option too (leaving the rounding to the user's display settings): Code: << 76.5 bytes, #3C12h |
|||
07-06-2019, 05:07 PM
Post: #4
|
|||
|
|||
RE: (50g) Earthquake Magnitudes: How Much Stronger?
And for RPN fans here is a 42S version
Code: 00 { 47-Byte Prgm } |
|||
07-06-2019, 09:52 PM
Post: #5
|
|||
|
|||
RE: (50g) Earthquake Magnitudes: How Much Stronger?
(07-06-2019 05:06 PM)grsbanks Wrote:(07-06-2019 01:21 PM)Joe Horn Wrote: 'QUAKE' Yes, it's 86 bytes if you execute BYTES on the name, but 76.5 bytes if you execute BYTES on the program itself, which I prefer to do, to allow for renaming. <0|ɸ|0> -Joe- |
|||
07-06-2019, 09:55 PM
Post: #6
|
|||
|
|||
RE: (50g) Earthquake Magnitudes: How Much Stronger?
(07-06-2019 04:20 PM)Valentin Albillo Wrote: Thanks for sharing that! The human-readable clarity of HP-71 BASIC always warms my heart. <0|ɸ|0> -Joe- |
|||
07-07-2019, 02:04 AM
Post: #7
|
|||
|
|||
RE: (50g) Earthquake Magnitudes: How Much Stronger?
(07-06-2019 05:07 PM)Didier Lachieze Wrote: And for RPN fans here is a 42S version Oh, does this mean I can play 'Quake' on my DM42? — Ian Abbott |
|||
07-07-2019, 07:57 AM
Post: #8
|
|||
|
|||
RE: (50g) Earthquake Magnitudes: How Much Stronger?
(07-06-2019 09:52 PM)Joe Horn Wrote: Yes, it's 86 bytes if you execute BYTES on the name, but 76.5 bytes if you execute BYTES on the program itself, which I prefer to do, to allow for renaming. Interesting. I'll have to read up on this and find out why. Feeding my version of the program to BYTES makes it 67 bytes in length. |
|||
07-17-2019, 02:19 PM
Post: #9
|
|||
|
|||
RE: (50g) Earthquake Magnitudes: How Much Stronger?
On the HP Prime, I have implemented some additional earthquake functions that may be of interest.
https://www.hpmuseum.org/forum/thread-13244.html Thanks for the inspiration. Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)