Sunday, December 31, 2023

Swiss Micros DM32: Scientific Constants

Swiss Micros DM32:   Scientific Constants


Happy New Year - Wishing you a prosperous and healthy 2024! 


Scientific Constants



The state constants.d32 loads eight scientific constants to eight global registers.   On the DM32, global registers, (numbered -100 to -999, note the negative numbers here), are registers that can be accessed in any state ("calculator").


The eight constants featured are:


-900:  Earth's Gravity constant:   g = 9.80665 m/s^2

-901:  Molar Gas constant:  R = 8.314462618 J/(K mol)

-902:  Planck constant: h = 6.62607015E-34 J/Hz

-903:  Newtonian Universal Constant:  G = 6.67430E-11 m^3/(kg s^2)

-904:  Avogadro constant: Na = 6.02214076E23 mol^-1

-905:  Speed of Light: c = 299,792,458 m/s

-906:  Boltzmann constant:  k = 1.380649E-23 J/K

-907:  Elementary Charge constant: e = 1.602176634E-19 C


Program Labels:


LBL L:  Load the constants

LBL H:  help file, press [ R/S ] between each description

LBL V:  view all the numerical value of constants

LBL O:  obtain a single constant.  Enter a number from 0-7.


0: g

1: R

2: h

3: G

4: Na

5: c

6: k

7: e


The labels are not global, but the scientific constants are.   


Store the register number (-900 to -907) in the variable i.   Press RCL (i) to obtain the constant.  



[ Link to download constants.d32 ]

[ Link to download constants: here



Source


"2018 CODATA Recommended Values of the Fundamental Constants of Physics and Chemistry"  NIST SP 959.  June 2019.   Retrieved December 2, 2023  https://physics.nist.gov/cuu/pdf/wallet_2018.pdf




Eddie


All original content copyright, © 2011-2023.  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. 


Saturday, December 30, 2023

HP 15C (CE) and TI-84 Plus CE Triangle, Square, and Sawtooth Waves

HP 15C (CE) and TI-84 Plus CE Triangle, Square, and Sawtooth Waves


Almost New Years...  thank you for all your support in 2023!


The Periodic Waves Featured


Let:


A = amplitude of the wave

P = period of the wave


Triangle:





TW(A,P,x) = (2 × a ÷ π) × arcsin(sin (2 × π × x ÷ p))

Domain:  [ -A, A ]


Square:





SW(A,P,x) = a × sgn(sin(2 × π × x ÷ p)) = a × (-1)^floor(2 × x ÷ P)

Domain:  [ -A, A ]


Sawtooth:





SAW(A,P,x) = A × frac(x ÷ P) 

Domain:  [ -A, A ]



The programs presented only allow for non-negative arguments (x>0).  The TI-84 Plus CE program PRDWAVES offer calculations and graphs.



HP 15C Program Code


LBL A:  Triangle Wave

LBL B:  Square Wave

LBL C:  Sawtooth Wave



Registers Used:

R1 = amplitude (A)

R2 = period (P)


Load A and P in R1 and R2 and then load x  in the x stack.   X must be non-negative or an error occurs (Error 0).


Step |  Key Code |  Key


Triangle Wave


001 | 42, 21, 11 |  LBL A

002 | 43, _5, _8 |  CF 8

003 | 43, 30, _2 |  TEST 2 (x<0?)

004 | __, __, 11 |  √x

005 | __, __, _2 |  2

006 | __, __, 20 |  ×

007 | __, 43, 26 |  π

008 | __, __, 20 |  ×

009 | 45, 10, _2 |  RCL÷ 2

010 | __, __, 23 |  SIN

011 | __, 43, 23 |  SIN^-1

012 | __, __, _2 |  2

013 | __, __, 20 |  ×

014 | 45, 10, _1 | RCL÷ 1

015 | __, 43, 26 |  π

016 | __, __, 10 |  ÷

017 | __, 43, 32 | RTN


Square Wave


018 | 42, 21, 12 |  LBL B

019 | 43, _5, _8 |  CF 8

020 | 43, 30, _2 |  TEST 2 (x<0?)

021 | __, __, 11 |  √x

022 | __, __, _2 |  2

023 | __, __, 20 |  ×

024 | 45, 10, _2 |  RCL÷ 2

025 | __, 43, 44 |  INT

026 | __, __, _1 |  1

027 | __, __, 16 |  CHS

028 | __, __, 34 |  x<>y

029 | __, __, 14 | y^x

030 | 45, 20, _1 | RCL× 1

031 | __, 43, 32 | RTN


Sawtooth Wave


032 | 42, 21, 13 | LBL C

033 | 43, _5, _8 |  CF 8

034 | 43, 30, _2 |  TEST 2 (x<0?)

035 | __, __, 11 |  √x

036 | 45, 10, _2 |  RCL÷ 2

037 | __, 42, 44 |  FRAC

038 | 45, 20, _1 | RCL× 1  

039 | __, 43, 32 | RTN 



Technique:  If you require entries to be nonegative, you can use the sequence:


... commands. ..

CF 8  (turns complex mode off)

TEST 2  (x<0?)

√x   (causes an error, specifically Error 0; skipped if x is non-negative)

... commands ... 



TI-84 Plus CE Program PRDWAVES


(spaces added for clarity)


Func

Radian

FnOff

"2023-11-28 EWS"

1→A

1→P

ClrHome


Lbl 0

"AMP = "+toString(A)+","+"PRD = "+toString(P)→Str1

Menu(Str1,"ENTER PARAMETERS",1,"TRIANGLE WAVE",2,"SQUARE WAVE",3,

"SAWTOOTH WAVE",4,"EXIT",E)


Lbl 1

Input "AMPLITUDE? ",A

Input "PERIOD? ",P

Goto 0


Lbl 2

"2*A/π*sin^-1(sin(2*π*X/P))"→Y1

Goto C


Lbl 3

"A*(-1)^iPart(2*X/P)"→Y1

Goto C


Lbl 4

"A*fPart(X/P)"→Y1

Goto C


Lbl C

ClrHome

Menu("CALCULATE","F(X)",F,"GRAPH",G,"NEW PROBLEM",0,"EXIT",E)


Lbl F

Equ>String(Y1,Str2)

Disp Str2

Input "X≥0,X? ",X

If X<0

Then

Disp "X CAN NOT BE NEGATIVE"

Pause

ClrHome

Goto F

end

Y1(X)→Y

Disp "Y = ", Y

Pause 

Goto C


Lbl G

0→Xmin

10→Xmax

ZoomFit

DispGraph

Stop


Lbl E

Disp "BYE."

Stop


Notes:


Y1:  [vars], Y-VARS, 1: Function..., 1: Y1  (captial Y with subscript 1)


Download PRDWAVES.8xp here


Examples


Let P = 2, A = 1


X = 1

Triangle:  0.0000

Square:  -1.0000

Sawtooth:  0.5000


X = 2.5

Triangle: 1.0000

Square:  1.0000

Sawtooth:  0.2500


X = 4.8 

Triangle:  0.4000

Square:  1.0000

Sawtooth:  0.4000




Eddie


All original content copyright, © 2011-2023.  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. 


Tuesday, December 26, 2023

HP15C: A Corrected Floor Function by Werner

HP15C: A Corrected Floor Function by Werner



A Corrected Floor Function



On November 25, 2023, I posted floor and ceiling functions for the HP 15C, DM42, and HP 27S calculators.  I also posted the code on the Museum of HP Calculators (MoHPC).


Werner informed me that the floor code was inaccurate for x=-0.5.   In fact, the code is inaccurate for all x values from -1 to 0.  


The corrected code that Werner presented, by permission, on the MoHPC forum is:


Key Code : Key


__, 43, 44 : INT

42, _4, 25:  x<> I

__, 43, 36:  LST x

__, 42, 44:  FRAC

43, 30, _2:  TEST (x<0?)

42, _5, 25:  DSE I   (decreases I, always skips)

__, __, 16:  CHS  (nop)

__, __, 33:  R↓

42, _4, 25:  x<>I


This code works for all real values.   


For the ceiling function, use the identity:   ceil(x) = -floor(-x).  


   

MoHPC thread:  

https://www.hpmuseum.org/forum/thread-20766-post-182065.html#pid182065


Eddie


All original content copyright, © 2011-2023.  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. 


Monday, December 25, 2023

TI Calculator App: RPN83P v0.8 by Brian T. Park

TI Calculator App:  RPN83P v0.8 by Brian T. Park








Reverse Polish Notation on the TI-83/TI-84 Plus


The calculator app, the RPN83P, programmed by Brian T. Park, is a calculator app that runs an HP 42S-like interface and gives the calculator a working, feature-filled RPN (Reverse Polish Notation) calculator.   The application works on the TI-83/84 Plus family that have a monochrome screen:  


TI-83 Plus

TI-83 Plus Silver Edition

TI-84 Plus

TI-84 Plus Silver Edition (I'm pretty sure that the SE keyboard attached to the original TI-Nspire would work too)

TI-84 Plus Pocket SE

TI-84 Pocket.fr


RPN83P will not work on the TI-84 Plus CE or CE Python.   


The app takes 32,768 bytes of flash memory, which is the size of 2 flash pages.  Two lists are also created, REGS for memory registers, STK for the four level stack.




Features


RPN83P operates with a traditional 4-level stack (X, Y, Z, T), and all the stack levels are displayed at once.  To quickly clear the stack, press [CLEAR] three times.  The display also shows current fix and angle settings.    


You can turn the calculator off from the app, when we turn the calculator on and run the app, it goes back to the screen where we left off.  




Common key mappings in RPN83P 


[ (  ] :  roll down the stack, R↓


[ ) ]:  swap the contents of the X and Y stacks, x<>y


[ 2nd ] ( ANS ):  Last x 


[ 2nd ] ( ENTRY ):  Show the entire precision of the value in the X stack, regardless of mode.   Press [ ENTER ] to exit. 


[ MATH ]:   Shows the MATH menus and the HELP facility.  The HELP file is a nine page document that shows the common keys and some of the functions of RPN83P.  Scroll the pages with the up and down arrow keys.  


[ MODE ]:  Sets the following modes:

Display:  FIX, SCI, ENG.   FIX 10 sets the float mode.

Angel:  DEG/RAD.  Degrees or Radians



The Math Functions



A full listing can is found here:  https://github.com/bxparks/rpn83p


Math-Math:  Cube, Cube Root, Universal Roots, ATAN2, extended logarithmic and exponential functions including E^X- (e^x - 1) and LN1+ (ln(x + 1))


Math-Num:  Percent, Percent Change, Integer, Fraction, Ceiling, Floor, Rounding, and other number facilities



The percent (%) function operates like the RPN calculators:


Y:   whole

X:   percentage


( % )  →

Y:   whole

X:   whole × percentage/100


To add a percent:  y [ ENTER ] x (% ) [ + ]

To subtract a percent:  y [ ENTER ]  x (%) [ - ]



The PRIM (prime) function is the smallest prime number function and used in with the division key  for prime factorization.


Example:  


254  (PRIM)   X:  2  

[ ÷ ]  (PRIM)   X:  1  (last number finishes the factorization)

[ ÷ ]    X :  127


254 = 2 × 127


Math-Prob:  Probability Functions


Math-Conv:  Deg/Rad, Rec/Pol, Hour/Hour-Minutes-Seconds conversions


Math-Help:  Access the Help documentation


Math-Base:  Base conversion, Boolean Logic, and computer science functions such as shift and rotate (HP 16C) 


Math-Hyp:  Hyperbolic functions


Math-Stat:  Statistics and regression fit:


LIN: linear

LOGF:  logarithmic

EXPF:  exponential

PWRF:  power

BEST:  takes the data and matches it to the best fitting regression


Math-Units:  Conversion of SI/English Units.   The conversions are in pairs and are cleverly organized.  For example:


>°C   ([ Y = ]) - °F>°C

>°F  ([WINDOW])  °C>°F


>hPA ([TRACE])  iHg>hPa

>iHg  ([GRAPH])  hPa>iHg


Scroll with the up and down arrow keys.  


There are 12 sets of conversions.  


Math-TVM:  Finance functions (see the Finance section)


Math-CLR:  Clearing functions, X, stack, registers, statistics, and time value of money registers


Math-MODE:  Mode settings


Math-STK:  Stack functions:  R↑, R↓, x<>y




The Finance Menu



The finance menu is accessed by [ MATH ], [ ↓ ], [ GRAPH ] (TVM).


The menus in finance are:


1st Page:  the Time Value of Money variables:


N   ([ Y = ])

I%YR  ([WINDOW])

PV ([ ZOOM ])

PMT ([TRACE])

FV  ([GRAPH])


2nd Page:  Utilities


P/YR   ([ Y = ]):   set payments per year

BEG  ([WINDOW]):  sets beginning of the period mode

END  ([ ZOOM ]):  sets end of period mode


CLTV  ([GRAPH]):   Clear TMV variables


3rd Page:  Solving for Interest Settings


IYR1   ([ Y = ]):   set first guess (default 0%)

IYR2  ([WINDOW]):  set second guess (default 100%)

TMAX ([ ZOOM ]):   iteration maximum (up to 255, default set at 15)


RSTV  ([GRAPH]):  Reset the solver


The standard cash flow convention is used:  negative for outflows (payments), positive for inflows (receipts).  This mode operates like the HP 17B financial calculator.  


To enter a number in the finance variables, enter the number and then press the corresponding soft key.


To solve for a variable, just press the soft key that corresponds to the variable.


Example:  Find the value of a savings fund if monthly deposits of $300 are made for 4 years.  The account pays at 3.1% rate.


[ ↓ ]  

( CLTV )


[ ↑ ]

4 [ ENTER ] 12 [ × ] ( N )

3.1 (I%YR)

300  [(-)] (PMT)

( FV )  


Result:   15309.85772




Where to get RPN83P 



The RPN83P application is a work in progress:  the version I am reviewing at the time of this post is v0.8.   Planned additions for 2024 include complex number support.  The application is subject to testing, change, and possible bug correction.  The RPN83P is an open source project, with the source code on GitHub (see GitHub page link below).


RPN83P GitHub page:

https://github.com/bxparks/rpn83p


Download the program here:

https://github.com/bxparks/rpn83p/releases


Thread on Museum of HP Calculators:

https://www.hpmuseum.org/forum/thread-20867.html


Special thanks and gratitude to Brian T. Park.  I definitely recommend the RPN83P application and am excited to see the future updates that will be added to this excellent app.  


Eddie


All original content copyright, © 2011-2024.  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. 


Sunday, December 24, 2023

TI-73 (Explorer): Percents and Random Fractions

TI-73 (Explorer):  Percents and Random Fractions



TI-73 Program:  PERCENT





TAX+:  Appropriately add a percent to a number.   Application:  Sales Tax


TAX-:   Appropriately subtract a percent from a number.  Application:  Discount


% CHANGE:  Percent change from the old number to new number.  Additional application:  Percent Markup (OLD = cost, NEW = selling price)


%TOT:  Finds the percentage portion of a total number


% MARGIN:  Given an item's cost and selling price, calculate the item's percent margin.  



Code:

(spaces added for clarity)


"EWS 2023-12-02"     // (comment)


Lbl 0

Menu("PERCENT","TAX+",1,"TAX-",2,

"% CHANGE",3,"%TOT",4,"% MARGIN",5,

"EXIT",E)


Lbl 1

Prompt N

Input "X% ",X

N*(1+X%)→Y

Disp "ANSWER="

Pause Y

Goto 0


Lbl 2

Prompt N

Input "X% ",X

N*(1-X%)→Y

Disp "ANSWER="

Pause Y

Goto 0


Lbl 3

Input "OLD=",O

Input "NEW=",N

(N-O)*100/O→Y

Disp "% CHANGE="

Pause Y

Goto 0


Lbl 4

Input "PART=",P

Input "WHOLE=",W

100*P/W→Y

Disp "%"

Pause Y

Goto 0


Lbl 5

Input "COST=",C

Input "SELL PRICE=",S

(S-C)/S*100→Y

Disp "% MARGIN="

Pause Y

Goto 0


Lbl E

Disp "BYE"

Pause



Note:   Results that are to be displayed need to be followed or accompanied by a Pause command, unless the results will not show.  This wrinkle is unique to the TI-73.  

Link to download PERCENT.73p



TI-73  Program:  RANDFRAC




Generate a number of fractions with randomized numerators and denominators.  


T = number of fractions to be generator

L = upper limit that the numerator and denominator can take.  The numbers range from 1 to L


The result is returned in three parts:


numerator

denominator

fraction


For example:


5

7

5/7


Simplification rules are set through the MODE key.  


Code:

(spaces added for clarity)


"EWS 2023-12-02"     // (comment)


Disp "NO. FRACTIONS"

Prompt T

Disp "UPPER LIMIT"

Prompt L


For(I,1,T)

randInt(1,L)→N

randInt(1,L)→D

N ⁄ D→F     // N [ b/c ] D [ STO> ] F

Disp N,D,F

Pause

End


Note:  The fraction symbol pressed by [ b/c ], symbolized by  ⁄, shows on the screen as a thick division slash.   


Link to download RANDFRAC.73p


For those of you who are celebrating, Merry Christmas!


Eddie


All original content copyright, © 2011-2023.  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. 


Saturday, December 23, 2023

Swiss Micros DM32: Solving Integral Equations

Swiss Micros DM32:  Solving Integral Equations



Introduction


The programs presented today solves the following equation for X:


X

∫   F(T)  dT = C

0


Since we are not able to use an integration command in solving a program on the DM32 (and the HP 32S and 32SII), we will have to use a manual method, mainly Newton's Method:


X_n+1 = X_n - [ ∫( F(T) dT from T = 0 to T = x_n) - C ] ÷ f(x_n) 


with in tolerance D.


To see a similar program for the HP Prime, posted on April 3, 2020, please click here:

https://edspi31415.blogspot.com/2020/04/hp-prime-solving-integral-equations.html



DM32 Code:  Integral Equations


LBL H:  Help File


 LBL H

  SF 10

  EQN: L B L _ F - F ( T )

  EQN: L B L _ S - S O L V E

  EQN: S _ H A S _ R C L _ T

  EQN: C = C O N S T

  EQN: D = T O L E R

  EQN: G U E S S _ X E Q _ S

  CF 10

  RTN


Note:  Underscore is the space key.   Press R/S after each message.   


LBL F

  RCL T

  enter f(T), the integrand, here

  RTN


Note:  The variable used is T.   If you want to test out the function, store a value in the variable T first.  


 LBL S

  RAD

  STO X

  LBL A

  FN= F

  0

  RCL X

  ∫ FN d T

  RCL- C

  STO Y

  RCL X

  STO T

  XEQ F

  STO÷ Y

  RCL X

  RCL- Y

  STO Y

  RCL Y

  RCL- X

  ABS

  RCL D

  x<y?

  GTO B

  RCL Y

  RTN

  LBL B

  RCL Y

  STO X

  GTO A


Note:  This is the main program.  Enter a guess, and then key in XEQ S.  



Variables Used:


T = independent variable

C = constant

D  = tolerance (i.e. 10^-4, 10^-5, 10^-6, etc)

X = x_n

Y = x_n+1, final approximation



Download the state file here:  ntegralequ.dm32



The state file includes a sample integrand:


e^(-T ÷ 4):


LBL F

RCL T

x^2

+/-

4

÷

e^x

RTN



Examples



In the following examples, the tolerance is 10^-5  (5 +/- 10^x STO D) and FIX 5 mode is set.  


1.   ∫( e^(-T^2 ÷ 4) dT for T = 0 to X) = 1


C = 1


Guess = 2,   Result:  1.10208

Guess = 1,   Result:  1.10208

Guess = 3,   Result:  Division by 0 error


Note that initial guesses are important.  



2.  ∫( e^-sin(T + 1) dT for T = 0 to X) = 10


C = 10


LBL F

RCL T

1

+

SIN

+/-

e^x

RTN


Guess = 5;  Result:  9.10014



3.  ∫( T^3 - 2 × T dT for T = 0 to X) = 40


C = 40


LBL F

RCL T

3

y^x

RCL T

×

-

RTN


Guess = 5; Result:  3.84789



4.  ∫( sin^2 T dT for T = 0 to X) = 1.4897


C = 1.4897


LBL F

RCL T

SIN

x^2

RTN


Guess = 2;  Result:  2.49991




Eddie


All original content copyright, © 2011-2023.  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. 


Sunday, December 17, 2023

HP 15C and HP 71B: Precession of the Equinoxes

HP 15C and HP 71B:   Precession of the Equinoxes



How Far Does the Celestial Object Move?  


Given a celestial object's right ascension (α) and declination (δ), we can calculate the new positions after N years by the formulas presented by The Cambridge Handbook of Physics Formulas (see Source):


α' ≈ α0 + (3.075" + 1.336" × sin α0 × tan δ0) × N


δ' ≈ δ0 + (20.043" × cos α0) × N



Decimal degrees of seconds:


3.075" ≈ 854.1677 × 10^-6


1.336" ≈ 371.1111 × 10^-6


20.043" ≈ 5.5675 × 10^-3



According to the Handbook, the formulas are good for only several centuries, as the formulas are local approximations.  




HP 15C Code:  New Right Ascension (LBL A) and New Declination (LBL D)


Step:  Key Code:  Key



New Right Ascension, α'


001:  42, 21, 11:  LBL A

002:  __, 43, _7:  DEG

003:  __, __, _1:  1

004:  __, __, _3:  3

005:  __, __, _3:  3

006:  __, __, 48:  .

007:  __, __, _6:  6

008:  __, __, 26:  EEX

009:  __, __, _6:  6

010:  __, __, 16:  CHS

011:  __, 43, _2:  →H

012:  __, 45, _1:  RCL 1

013:  __, 43, _2:  →H

014:  __, __, 23:  SIN

015:  __, __, 20:  ×

016:  __, 45, _2:  RCL 2

017:  __, 43, _2:  →H

018:  __, __, 25:  TAN

019:  __, __, 20:  × 

020:  __, __, _3:  3

021:  __, __, _0:  0

022:  __, __, _7:  7

023:  __, __, 48:  .

024:  __, __, _5:  5

025:  __, __, 26:  EEX

026:  __, __, _6:  6

027:  __, __, 16:  CHS

028:  __, 43, _2:  →H

029:  __, __, 40:  +

030:  45, 20, _3:  RCL× 3

031:  __, 45, _1:  RCL 1

032:  __, 43, _2:  →H

033:  __, __, 40:  +

034:  __, 42, _2:  →H.MS

035:  __, 44, _4:  STO 4

036:  __, 43, 32:  RTN


New Declination:  δ'


037:  42, 21, 14:  LBL B

038:  __, 43, _7:  DEG

039:  __, __, _2:  2

040:  __, __, 48:  .

041:  __, __, _0:  0

042:  __, __, _0:  0

043:  __, __, _4:  4

044:  __, __, _3:  3

045:  __, __, 26:  EEX

046:  __, __, _3:  3

047:  __, __, 16:  CHS

048:  __, 43, _2:  →H

049:  __, 45, _1:  RCL 1

050:  __, 43, _2:  →H

051:  __, __, 24:  COS

052:  __, __, 20:  × 

053:  45, 20, _3:  RCL× 3

054:  __, 45, _2:  RCL 2

055:  __, 43, _2:  →H

056:  __, __, 40:  +

057:  __, 42, _2:  →H.MS

058:  __, 44, _5:  STO 5

059:  __, 43, 32:  RTN



Variables Used:


R1 = α0:  Initial Right Ascension (enter in DD.MMSS format)

R2 = δ0:  Initial Declination  (enter in DD.MMSS format)

R3 = N:  Number of Years from 2000.  


Outputs:


R4 = α':  Final Right Ascension (in DD.MMSS format)

R5 = δ':  Final Declination  (in DD.MMSS format)



HP 71B Code:   PRECES


Note:  I had battery problems with the HP 71B, so I'm writing this code from written notes.  


100  DEGREES

110  PRINT "PRECESSION" @ WAIT 0.25

120  PRINT "EPOCH J2000.0"  @ WAIT 0.25

130  INPUT "R.A. °,M,S ?"; H,M,S

140  GOSUB 500 @ A0 = X

150  INPUT "DEC °,M,S? "; H,M,S

160  GOSUB 500 @ D0 = X

170  INPUT "# YEARS? "; N

180  A1 = A0 + (854.1667E-6 + 371.1111E-6 * SIN(A0) * TAN(D0)) * N

190  D1 = D0 + (5.5675E-3 * COS(A0)) * N

200  X = A1 @ GOSUB 600 

210  H1 = H @ M1 = M @ S1 = S @ G1 = G

220  PRINT "R.A. ADJ=" @ WAIT 0.25

230  PRINT G1*H1; "°"; M1; "m"; S1; "s" @ PAUSE

240  X = D1 @ GOSUB 600

250  H2 = H @ M2 = M @ S2 = S @ G2 = G

260  PRINT "DEC ADJ=" @ WAIT 0.25

270  PRINT G2*H2; "°"; M2; "m"; S2; "s"

280  END


500  X=SGN(H) * (ABS(H) + M/60 + S/3600)

510  RETURN


600  G = SGN(X) @ X=ABS(X) @ H=IP(X)

610  M = IP(FP(X) * 60)

620  S = FP(FP(X) * 60) * 60

630  RETURN



Examples



First Point of Aries (Vernal Equinox)


α0 = 0° 00' 00"

δ0 = 0° 00' 00"


N = 100

α' ≈ 5'08" (0.0508)

δ' ≈ 33'24"  (0.3324)



Regulus (Alpha Leonis (Leo))


α0 ≈ 5° 55' 10"

δ0 ≈ 7° 24' 25"


N = 100

α' ≈ 6° 00' 19"

δ' ≈ 7° 57' 39"  


Sagittarius A*  (Center of the Milky Way Galaxy)


α0 ≈ 17° 45' 40"

δ0 ≈ -29° 00' 28"


N = 100

α' ≈ 17° 50' 25"

δ' ≈ -28° 28' 39"  



Betelgeuse (Alpha Orionis (Orion))


α0 ≈ 10° 28' 22"

δ0 ≈ 11° 58' 02"


N = 100

α' ≈ 10° 13' 34"

δ' ≈ 12° 30' 55"  



Source


Woan, Gaham.   The Cambridge Handbook of Physics Formulas  2003 Edition. Cambridge University Press.  2000. ISBN 978-0-511-07589-6



Eddie


All original content copyright, © 2011-2023.  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. 


Saturday, December 16, 2023

HP 12C: Simple Interest

HP 12C:   Simple Interest


Some short-term loans and accounts accrue interest using the simple interest method.   This is different from the conventional compound interest method.  


Simple Interest Formula


T = B + B × R% × N = P × (1 + R% × N)


T = total future value (uses the FV register)

B = beginning value (uses the PV register)

R = annual interest rate (uses the i register)

N = time in years (uses the n register)


The program uses four of the TVM registers for the purpose of storing registers in a convenient way.  



HP 12C Code:  Simple Interest


Step :  Key Code  :  Key


# Solve for the future value, GTO 01, R/S


01:  __, 45, 13:  RCL PV

02:  __, 45, 12:  RCL i

03:  __, 45, 11:  RCL n

04:  __, __, 20:  ×

05:  __, __, 25:  %

06:  __, __, 40:  +

07:  __, 44, 15:  STO FV

08:  43, 33, 00:  GTO 00


# Solve for the present value, GTO 09, R/S 


09:  __, 45, 15:  RCL FV

10:  __, __, _1:  1

11:  __, 45, 12:  RCL i

12:  __, 45, 11:  RCL n

13:  __, __, 20:  ×

14:  __, __, 25:  %

15:  __, __, 40:  +

16:  __, __, 10:  ÷

17:  __, 44, 13:  STO PV

18:  43, 33, 00:  GTO 00


#  Solve for the time in years, GTO 19, R/S


19:  __, 45, 15:  RCL FV

20:  __, 45, 13:  RCL PV

21:  __, __, 10:  ÷

22:  __, __, _1:  1

23:  __, __, 30:  -

24:  __, 45, 12:  RCL i

25:  __, __, 10:  ÷

26:  __, __, _1:  1

27:  __, __, 26:  EEX

28:  __, __, _2:  2

29:  __, __, 20:  ×

30:  __, 44, 11:  STO n

31:  43, 33, 00:  GTO 00


# Solve for the interest rate, GTO 32, R/S 


32:  __, 45, 15:  RCL FV

33:  __, 45, 13:  RCL PV

34:  __, __, 10:  ÷

35:  __, __, _1:  1

36:  __, __, 30:  -

37:  __, 45, 11:  RCL n

38:  __, __, 10:  ÷

39:  __, __, _1:  1

40:  __, __, 26:  EEX

41:  __, __, _2:  2

42:  __, __, 20:  ×

43:  __, 44, 12:  STO i

44:  43, 33, 00:  GTO 00



Summary


T = B + B × R% × N


To solve for T:  GTO 01, [ R/S ]

To solve for B: GTO 09, [ R/S ]

To solve for N:  GTO 19, [ R/S ]

To solve for R:  GTO 32, [ R/S ]



Examples


1.   What is the interest rate required if you begin with $1,000.00 and end up with $1,135.00 in 5 years?  Assume that account accrues using simple interest.


1000 [ PV ] 

1135 [ FV ]

5 [ n ]

GTO 32, [ R/S ]


Answer:  2.70%.  


2.  An auto loan of $8,000.00 is to paid back in 60 monthly payments (5 years).  The loan's rate is 6% at simple interest.   What is the monthly payment of this loan?


The first step is to find the total amount:


8000 [ PV ]

6 [ i ] 

5 [ n ]

GTO 01, [ R/S ]


T = $10,400.00  (total plus interest)


[ RCL ] [ FV ] 60 [ ÷ ]


Monthly payment with simple interest:  $ 173.33



Source


Hayes, Adam.  "Simple Interest: Who Benefits, With Formula and Example"  Investopedia.  Last updated May 27, 2023.  Retrieved November 19, 2023.  

URL:  https://www.investopedia.com/terms/s/simple_interest.asp




Eddie


All original content copyright, © 2011-2023.  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. 


TI 30Xa Algorithm: Acceleration, Velocity, Speed

TI 30Xa Algorithm: Acceleration, Velocity, Speed Introduction and Algorithm Given the acceleration (α), initial velocity (v0), and...