Tampilkan postingan dengan label HP 42S. Tampilkan semua postingan
Tampilkan postingan dengan label HP 42S. Tampilkan semua postingan

Happy Halloween and Happy Birthday, HP 42S

Happy Halloween and Happy Birthday, HP 42S








The HP 42S calculator was released to the market on October 31, 1988.  


I also want to wish you a safe and Happy Halloween.  Thank you.


Eddie 


All original content copyright, © 2011-2022.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Swiss Micros DM42: Time Dilation

Swiss Micros DM42:  Time Dilation 



Introduction


The program DILATE calculates the time passage from the traveler's perspective:


t' = t * √(1 - (v/c)^2)


where c = Speed of Light = 299,792,458 m/s


We can also state the equation as:


t' = t * cos(arcsin (v/c)) 


because cos(arcsin(x)) = √(1 - x^2) for |x| ≤ 1



Why cos(arcsin(x)) = √(1 - x^2)?


Let Θ = arcsin x.  Then x = sin Θ.  Assume that -1 ≤ x ≤ 1.


From the trigonometric identity:


cos^2 Θ + sin^2 Θ = 1

(cos Θ)^2 +  (sin Θ)^2 = 1


With sin Θ = x,


(cos Θ)^2 + x^2 = 1

(cos Θ)^2 = 1 -  x^2

cos Θ = √(1 - x^2)

cos(arcsin x) = √(1 - x^2)



Swiss Micros DM42 Program:  DILATE

Also:  Free42, Plus42


00 {52-Byte Prgm}

01  LBL "DILATE"

02  "TIME?"

03  PROMPT

04  "VEL (M/SEC)?"

05  PROMPT

06  299792458

07  ÷

08  ASIN

09  COS

10  ×

11 "T'= "

12  ARCL ST X

13  AVIEW

14  RTN

15  END



Example


A spaceship traveling at a velocity of 186,000,000 m/s (about 416,070,150 mph) for 1 year from our perspective.


XEQ DILATE

TIME?  1

VEL (M/SEC)? 186000000

 

Result:  0.78426 year would have passed on the spaceship, which is about 9 months and almost 13 days


Until next time,


Eddie 


All original content copyright, © 2011-2022.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


HP and Swiss Micros 41C and 42S Series: Stack Storage Operations

HP and Swiss Micros 41C and 42S Series: Stack Storage Operations


Introduction  


The HP 41C and HP 42S families, including the Swiss Micros DM41, DM42, Free42, and Plus42, includes the ability to execute storage arithmetic on any of the four* stack levels X, Y, Z, and T.  


The storage arithmetic operator takes whatever value is in the X stack and applies it to any stack level.  If we enter a number before the stack arithmetic operation, the stack lifts first, then executes the stack arithmetic operation.   See the examples section for illustrations.  


*Some calculators allow for a bigger number of stack levels, like 8.  



Examples



Example 1:  


Keystrokes:  3 [ ENTER ] [ ENTER ] 1 [ ENTER ]

Stack:

T:  3

Z:  3

Y:  1

X:  1


Keystrokes:  41:  [ STO ] [ + ] [ . ] (Y)    42:  [ STO ] [ + ] [ . ]  (ST Y)

Stack:

T:  3

Z:  3

Y:  2

X:  1


Keystrokes:  3 

Stack:

T:  3

Z:  2

Y:  1

X:  3_



Keystrokes:   41:  [ STO ] [ + ] [ . ] (Y)    42:  [ STO ] [ + ] [ . ]  (ST Y)

Stack:

T:  3

Z:  2

Y:  4

X:  3



Example 2:  


Keystrokes:  3 [ ENTER ] [ ENTER ] 1 [ ENTER ]

Stack:

T:  3

Z:  3

Y:  1

X:  1


Keystrokes:  41:  [ STO ] [ + ] [ . ] (Z)    42:  [ STO ] [ + ] [ . ]  (ST Z)

Stack:

T:  3

Z:  4

Y:  1

X:  1


Keystrokes:  3 

Stack:

T:  4

Z:  1

Y:  1

X:  3_



Keystrokes:   41:  [ STO ] [ + ] [ . ] (Z)    42:  [ STO ] [ + ] [ . ]  (ST Z)

Stack:

T:  4

Z:  4

Y:  1

X:  3



Note:  Casio fx-991EX Week - September 5, 2022 to September 9, 2022 


Eddie 


All original content copyright, © 2011-2022.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


HP 42S/DM42: Base Programs

 HP 42S/DM42:   Base Programs


Unsigned NOT


The program UNOT applies a NOT to a binary integer (flips zeros to ones and ones to zeros) using unsigned binary integers.  The number of bits (size) is prompted.


HP 42S/DM42 Program UNOT


00  {40-Byte Prgm}

01  LBL "UNOT"

02  BINM

03  "BIN?"

04  PROMPT

05  STO 01

06  EXITALL

07  "SIZE?"

08  PROMPT

09  STO 02

10  2

11  X<>Y

12  Y↑X

13  RCL- 01

14  STO 02

15  1

16  -  

17  BINM

18  END


Examples:


Unsigned NOT of 10100, size 5:  1011  (01011)


Unsigned NOT of 10100, size 8:  11101011


Shift Left


Makes a binary integer shift left: a zero is added to the right side of the integer and "drops" off the left most digit.  The number of bits (size) is prompted.  The binary number is assumed to be non-negative. 


HP 42S/DM42 Program SL16


00  {35-Byte Prgm}

01  LBL "SL16"

02  BINM

03  "BIN?"

04  PROMPT

05  EXITALL

06  2

07  ×

08  "SIZE?"

09  PROMPT

10  2

11  X<>Y

12  Y↑X

13  MOD

14  BINM

15  END


Examples:


Shift Left:  10100, size 5:  1000   (01000)


Shift Left:  10100, size 8:  101000  (00101000)


Shift Right (Logical)


Makes a binary integer shift right: a zero is added to the left side of the integer and "drops" off the left most digit.  The binary number is assumed to be non-negative. A logical shift right divides an integer by 2 and taking the integer result.


HP 42S/DM42 Program SR16


00  {24-Byte Prgm}

01  LBL "SR16"

02  BINM

03  "BIN?"

04  PROMPT

05  EXITALL

06  2

07  ÷

08  IP

09  BINM

10  END


Examples:


Shift Right:  10100:  1010


Shift Right:  1010:  101


The next two programs deals with RGB and HEX codes for computer colors.


HP 42S/DM42 Program CLR→:   RBG to Hexadecimal Code


00  {51-Byte Prgm}

01  LBL "CLR→"

02  DECM

03  "RED?"

04  PROMPT

05  65536

06  BASE×

07  "GREEN?"

08  PROMPT

09  256

10  BASE×

11  BASE+

12  "BLUE?"

13  PROMPT

14  BASE+

15  HEXM

16  END


Example:

Red: 221, Green: 80, Blue 109

Result:  HEX Code:  DD506D


HP 42S/DM42 Program  →CLR:   Hexadecimal to RGB Code


00  {63-Byte Prgm}

01  LBL "→CLR"

02  HEXM

03  "HEX CODE?"

04  PROMPT

05  STO 00

06  DECM

07  65536

08  BASE÷

09  STOP   // Red

10  65536

11  BASE×

12  RCL 00

13  X<>Y

14  BASE-

15  STO 00

16  256

17  BASE÷

18  STOP   // Green

19  256

20  BASE×

21  RCL 00

22  X<>Y

23  BASE-

24  END


Example:  

HEX Code:  103E22

Result:  Red:  16, Green:  62,  Blue:  34


Eddie



All original content copyright, © 2011-2022.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Backlink 9999 Traffic Super

Order Now...!!!!