07-06-2019, 01:21 PM

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.

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