Showing posts with label base. Show all posts
Showing posts with label base. Show all posts

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, October 30, 2022

HP 71B and TI-84 Plus CE: Binary Decimal Conversions Revised

HP 71B and TI-84 Plus CE:  Binary Decimal Conversions Revised


The programs presented can easily convert integers without the needs of lists or strings in input.  



HP 71B Programs:  BINDEC, DECBIN


No modules are required.


BINDEC (137 bytes)


100 DISP "BIN>DEC" @ WAIT .5

105 DESTROY A,B,C,D,E

110 INPUT "BIN? ";A

115 B=1 @ D=0 @ C=A

200 E=A/10 @ A=INT(E)

205 D=D+10*B*(E-A) @ B=2*B

210 IF A THEN 200

300 DISP "(2)";C;"="D


DECBIN (130 bytes)


100 DISP "DEC>BIN" @ WAIT .5

105 DESTROY A,B,C,D

110 INPUT "DEC? ";D

115 B=0 @ A=D @ C=1

200 E=D/2 @ D=INT(E)

205 B=B+C*(D<E)

210 C=C*10

215 IF D THEN 200

300 PRINT A;"=(2)";B



TI-84 Plus CE Programs:  BINDEC2, DECBIN2



BINDEC2


"V.2"

Disp "BIN>DEC"

Input "BIN? ",A

1→B:0→D:A→C

Lbl 2

A/10→E:iPart(E)→A

D+10*B*(E-A)→D

2*B→B

If A:Goto 2

Disp "(2) "+toString(C)+"= "+toString(D)



DECBIN2


"V.2"

Disp "DEC>BIN"

Input "DEC? ",D

0→B:D→A:1→C

Lbl 2

D/2→E:iPart(E)→D

B+C*(D<E)→B

10*C→C

If D:Goto 2

Disp toString(A)+"=(2) "+toString(B)


This is recommended for only integer values of 512 (decimal base) or less.  


Example


Decimal: 476  (DEC>BIN)

Result Binary:  111011100


Binary:  10111011 (BIN>DEC)

Result Decimal:  187



Source


Craig, John Clark.  119 Practical Programs For The TRS-80 Pocket Computer  TAB Books Inc.  Blue Ridge Summit, PA.  1982 pg. 133



Happy computing,

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. 


Sunday, April 18, 2021

Swiss Micros DM16L: Advanced Boolean and Factorial (up to 20)

Swiss Micros DM16L:   Advanced Boolean and Factorial (up to 20)


Introduction


The program listing, for the Swiss Micros DM16L and Hewlett Packard HP 16C,  will assign the following functions to the labels:


A:  NAND:   nand(x, y) = not(x and y)

B:  NOR:   nor(x, y) =  not(x or y)

C:  XNOR:  xnor(x, y) = (not x and not y) or (x and y)

D:  Implication:  y → x = (not y) or x

E:  Factorial:  x!  (x is a positive integer up to 20, 64 word size


NAND, NOR, NXOR, and Implication are advanced Boolean functions.  You can check out program code for the HP Prime here:


http://edspi31415.blogspot.com/2020/03/hp-prime-advanced-boolean-functions.html


Program - DM16L/HP 16C


// NAND

001 43,22,A LBL A

002 42,20   AND

003 42,30   NOT

004 43,21   RTN


// NOR

005 43,22,b LBL B

006 42,40   OR

007 42,30  NOT

008 43,21  RTN


// XNOR

009 43,22,C LBL C

010 44,1    STO 1

011 42,30  NOT

012 34      x<>y

013 44,2    STO 2

014 42,30   NOT

015 42,20   AND

016 45,1    RCL 1

017 45,2    RCL 2

018 42,20  AND

019 42,40   OR

020 43,21   RTN


// Implication

021 43,22,d LBL D

022 34      x<>y

023 42,30   NOT

024 42,40   OR

025 43,21   RTN


// Factorial

026 43,22,E LBL E

027 44,32  STO I

028 1      1

029 44,1    STO 1

030 43,22,1 LBL 1

031 45,1    RCL 1

032 45,32   RCL I

033 20      ×

034  44,1    STO 1

035 43,23   DSZ

036 22,1    GTO 1

037 45,1    RCL 1

038 43,21   RTN


Examples


Let:

R1 = 1011 0001

R2 = 1100 1100


Set up: 2-16-0000 (2's complement, 16 bits)


RCL 2, RCL 1, GSB A NAND(R2, R1):  0111 1111*

RCL 2, RCL 1, GSB B NOR(R2, R1): 0000 0010*

RCL 2, RCL 1, GSB C XNOR(R2, R1): 1000 0010*

RCL 2, RCL 1, GSB D R2 → R1:  1100 1110* 

* only the last eight bits 


Set word size to 64:

0 [ f ] [ STO ] (WSIZE)


5 GSB E 5! = 120

9 GSB E 9! = 362880*


* if the word size is insufficient, it will not show 362880 but a weird result as an overflow


12 GSB E   (64 word size)

12! = 4 79001600

Window 1:  4

Window 0:  79001600


20 GSB E

20! = 243 29020081 76640000

Window 2: 243

Window 1: 29020081

Window 0: 76640000


Source for the Advanced Boolean Functions:


John W. Harris and Horst Stocker.  Handbook of Mathematics and Computation Science  Springer:  New York, NY.  2006.  ISBN 978-0-387-94746-4



Eddie


All original content copyright, © 2011-2021.  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, April 25, 2020

HP 42S/DM42/Free 42: Advanced Boolean Functions

HP 42S/DM42/Free 42: Advanced Boolean Functions

Introduction

The programs NOTBIT, NAND, NOR, and IMPL are four advanced Boolean functions that work on Binary Numbers.  You designate a bit size, up to 35, on each of these functions.   There is no signed bit in these programs.  Results are stored in the Alpha Register while the decimal equivalent is stored in the X register. 

HP 42S/DM42/Free 42 Program:  NOTBIT

00 { 57-Byte Prgm }
01▸LBL "NOTBIT"
02 "BIT SIZE?"
03 PROMPT
04 STO 00
05 BINM
06 "BIN?"
07 PROMPT
08 STO 01
09 DECM
10 2
11 RCL 00
12 Y↑X
13 X<>Y
14 BASE-
15 1
16 BASE-
17 BINM
18 "NOT: "
19 ARCL ST X
20 AVIEW
21 EXITALL
22 .END.

Example:

NOT 11011, bit size:  8

Result: 
NOT:  11100100

HP 42S/DM42/Free 42 Program:  NAND

a NAND b = NOT ( a AND b )

00 { 67-Byte Prgm }
01▸LBL "NAND"
02 "BIT SIZE?"
03 PROMPT
04 STO 00
05 BINM
06 "BIN1?"
07 PROMPT
08 STO 01
09 "BIN2?"
10 PROMPT
11 STO 02
12 AND
13 DECM
14 2
15 RCL 00
16 Y↑X
17 X<>Y
18 BASE-
19 1
20 BASE-
21 BINM
22 "NAND: "
23 ARCL ST X
24 AVIEW
25 EXITALL
26 .END.

Example:

110011 NAND 111100, bit size: 8

Result:
NAND:  11001111

HP 42S/DM42/Free 42 Program:  NOR

a NOR b = NOT ( a OR b )

00 { 64-Byte Prgm }
01▸LBL "NOR"
02 "BIT SIZE"
03 PROMPT
04 STO 00
05 BINM
06 "BIN1?"
07 PROMPT
08 STO 01
09 "BIN2?"
10 PROMPT
11 STO 02
12 OR
13 DECM
14 2
15 RCL 00
16 Y↑X
17 X<>Y
18 BASE-
19 1
20 BASE-
21 BINM
22 "NOR: "
23 ARCL ST X
24 AVIEW
25 EXITALL
26 .END.

Example:

110011 NOR 111100, bit size: 8

Result:
NOR:  11000000

HP 42S/DM42/Free 42 Program:  IMPL

IMPL (Implication):  a → b = (NOT a) OR b

00 { 66-Byte Prgm }
01▸LBL "IMPL"
02 "BIT SIZE?"
03 PROMPT
04 STO 00
05 BINM
06 "BIN1?"
07 PROMPT
08 STO 01
09 DECM
10 2
11 RCL 00
12 Y↑X
13 X<>Y
14 BASE-
15 1
16 BASE-
17 BINM
18 "BIN2?"
19 PROMPT
20 STO 02
21 OR
22 "A→B: "
23 ARCL ST X
24 AVIEW
25 EXITALL
26 .END.

Example:

110011 IMPL 111100, bit size: 8

Result:
IMPL:  11111100

You can download the raw files here: 
https://drive.google.com/open?id=19u8tPcX4_-o0lwvjUc0KO4-WSmhnxpwe

Source:

John W. Harris and Horst Stocker  Handbook of Mathematics and Computation Science  Springer:  New York, NY.  2006.  ISBN 978-0-387-94746-4

Eddie

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

HP Prime: Advanced Boolean Functions

Advanced Boolean Functions





This is a collection of advanced Boolean functions and how you can do this on a scientific calculator that has base conversions and Boolean functions (and, or, not).   One thing to keep in mind is that Boolean functions on a scientific calculator assume that you are working with a set bit size.

Order of Operations:  Parenthesis, NOT, AND, OR

For the examples below, I am going to work with only 8 bit size binary integers, and display the last 8 bits (rightmost 8 digits in Binary numbers).   For all examples, let (in base 2):

A = 1100 1010
B = 1110 0011

Like the Boolean functions and, or, and not, these functions work on each bit (0s and 1s) of the binary form of the number.

Integer Types on the HP Prime

On the HP Prime, the integer type is used for Boolean function calculations.  Symbolize integer types by preceding it by a hashtag # and designated a letter at the end of the integer:  b for binary, o for octal, d for decimal, and h for hexadecimal.

Example:  #11010b  represents the binary number 11010.

You can specify the bit size, from 1 to 64, by attaching a colon and bit size in between the integer and it's indicator.

Example:  #11010:8b represents the 11010 in an 8-bit format.  You can specify the default size in the Home Settings.

NAND (Not And)

The function NAND is also known as the Shaffer function.

nand(A, B) = not(A and B)

nand(1100 1010, 1110 0011) = not(1100 1010 and 1110 0011) = 0011 1101

Truth Table - NAND
0 nand 0 = 1
0 nand 1 = 1
1 nand 0 = 1
1 nand 1 = 0

HP Prime Program:  NAND

EXPORT NAND(a,b)
BEGIN
// not and Boolean Function
RETURN  NOT (a AND b);
END;

Syntax:  NAND(a,b)

NOR (Not Or)

The function NOR is also known as the Peirce function.

nor(A, B) = not(A or B)

nor(1100 1010, 1110 0011) = not(1100 1010 or 1110 0011) = 0001 0100

Truth Table - NOR
0 nor 0 = 1
0 nor 1 = 0
1 nor 0 = 0
1 nor 1 = 0

HP Prime Program:  NOR

EXPORT NOR(a,b)
BEGIN
// not or Boolean Function
RETURN  NOT (a  OR  b);
END;

Syntax:  NOR(a,b)

XOR (Exclusive Or)

Note:  some calculators will have the XOR function

xor(A, B) = (A or B) and (not A or not B)

xor(1100 1010, 1110 0011)
= (1100 1010 or 1110 0011) and (not 1100 1010 or not 1110 0011)
= 0010 1001

Truth Table - XOR
0 xor 0 = 0
0 xor 1 = 1
1 xor 0 = 1
1 xor 1 = 0

Equivalence (←→), XNOR

A ←→ B = (not A and not B) or (A and B)

1100 1010 ←→ 1110 0011
= 1100 1010 xnor 1110 0011
= (not 1100 1010 and not 1110 0011) or (1100 1010 and 1110 0011)
= 1101 0110

Truth Table - ←→, xnor 
0 xnor 0 = 1
0 xnor 1 = 0
1 xnor 0 = 0
1 xnor 1 = 1

HP Prime Program XNOR

EXPORT XNOR(a,b)
BEGIN
// equivalence, XNOR
RETURN (NOT a AND NOT b) or (a AND b);
END;

Syntax:  XNOR(a, b)

Implication (→)

A → B = (not A) or B

1100 1010 → 1110 0011
= (not 1100 1010) or 1110 0011
= 1111 0111

Truth Table -  Implication, →
0 → 0 = 1
0 → 1 = 1
1 → 0 = 0
1 → 1 = 1

HP Prime Program:  IMPL

EXPORT IMPL(a,b)
BEGIN
// implication
RETURN (NOT a) or b;
END;

Source:

John W. Harris and Horst Stocker.  Handbook of Mathematics and Computation Science  Springer:  New York, NY.  2006.  ISBN 978-0-387-94746-4

Eddie

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

Wednesday, January 16, 2019

Comparison – Three Generations of Casio fx-115





Casio fx-115D



Casio fx-115MS




Casio fx-115ES Plus






Casio fx-115D
Casio fx-115MS
Casio fx-115ES Plus
Years (approximate)
1995
2000s
About 2008
Number of Keys
44
50 with keypad
50 with keypad
Number of Digits
10
10
10
Contrast the Screen?
No
Yes
Yes
Modes
[MODE]:
Engineering
Complex Numbers
SD (1-Var Stats)
LR (Linear Regression)
DEG/RAD/GRAD
FIX/SCI/NORM

[MODE]:
Comp (Compute)
SD (1-Var Stats)
REG (2-Var Stats)
Deg/Rad/Grad
Fix/Sci/Norm
Disp (ab/c, d/c, Dot, Comma)
Contrast
EQN:
2 x 2 linear system, 3 x 3 linear system, quadratic polynomial, cubic polynomial
[MODE]:
Comp (Compute)
Complex (complex numbers)
Stat (Statistics)
Base
Table (f(x), g(x))
Equation: 2 x 2 linear system , 3 x 3 linear system, quadratic polynomial, cubic polynomial
Vector
Verify (comparison tests)

[SETUP]:
MathIO/LinearIO
Deg/Rad/Grad
Fix/Sci/Norm
ab/c vs. d/c
STAT (frequencies on)
TABLE (f or f an g)
Recurring Decimal
Display (comma/decimal point)
Contrast
Statistics Regressions
Linear
Linear, Logarithmic, Exponential, Power, Inverse, Quadratic
Linear, Quadratic, Logarithmic, Exponential, Power (both a*b^x and a*x^b), Inverse
Display
One line: classic post-fix notation
2-line display, top: entry, bottom: result
Textbook (can be set to 2-line display)
Exact Answers
Fractions (when they are used)
Fractions
Fractions, Square Root, Pi
Statistical Registers
On the keyboard
In two menus: S-SUM, S-VAR
In a menu: STAT
Statistical Data Entry
With the [M+] button
With the [M+] button
In a table
Multi-statement operations
N/A
Yes (with [ : ] )
Yes (with [ : ] )
Rect to Polar Conversions
View only (exchange answers with X ←→ Y)
E = r, F = θ
X = r, Y = θ
Answer is displayed
Polar to Rect Conversions
View only (exchange answers with X ←→ Y)
E = x, F = y
X = x, Y = y
Answer is displayed
Calculus Functions
None
Integral, Derivative, Solve for X
Integral, Derivative, Solve for X, Sum, Product
Variables
M, Kin/Kout 1-6
A,B,C,D,E,F,X,Y,M
A,B,C,D,E,F,X,Y,M
Extras
Engineering Symbols
Engineering Symbols
GCD, LMC, Int, Intg, RandInt, Factoring Integers (FACTOR)
Power
Solar/Battery Backup: G927
Solar/Battery Backup: LR44
Solar/Battery Backup: LR44


Eddie

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


DM42 and HP 42S: Quadratic Equation, Characteristic Polynomial, and Eigenvalues

DM42 and HP 42S: Quadratic Equation, Characteristic Polynomial, and Eigenvalues The programs are listed for the Swiss Micros DM42 an...