Showing posts with label TI-84 Plus. Show all posts
Showing posts with label TI-84 Plus. Show all posts

Saturday, February 3, 2024

Swiss Micros DM42 and TI-84 Plus: Sum of an Infinite Geometric Series

Swiss Micros DM42 and TI-84 Plus:  Sum of an Infinite Geometric Series



Introduction


An infinite geometric series has the form:


a + a × r + a × r^2 + a × r^3 + ...


= a × (1 + r + r^2 + r^3 + ....)



If |r| < 1, the series converges and a sum exists. 


Σ  a × r^n   =   a ÷ (1 - r)

n=0


Σ  a × r^(n-1)   =   a ÷ (1 - r)

n=1


However if |r| ≥ 1, the series diverges and does not have as sum.



DM42 Program:  GSUM


Calculators: DM42, HP 42S, Free42, Plus42


00 { 36-Byte Prgm }

01 LBL "GSUM"

02 ENTER

03 ABS

04 1

05 X<>Y

06 X>Y?

07 GTO 00

08 R↓

09 R↓

10 1

11 X<>Y

12 -

13 ÷

14 RTN

15 LBL 00

16 CLX

17 "DIVERGES"

18 AVIEW

19 .END.


In the case the series diverges, the X stack is cleared (displays 0).  



TI-84 Plus Program:  GSUM


Calculators:  TI-84 Plus, TI-84 Plus CE (Python), TI-83 Premium CE (Python)


Disp "Σ(A*R^N,0,INF)","Σ(A*R^(N-1),1,I)"

Prompt A,R

ClrHome

Disp "A=",A,"R=",R

If abs(R)<1

Then

A/(1-R)→S

Disp "SUM=",S

Else

Disp "DIVERGES"

End



Examples


A:  3,  R:  -0.2

Stack:  Y = 3, X = -0.2

Result = 2.5


A:  3,  R:  0.2

Stack:  Y = 3, X = -0.2

Result = 3.75


A:  3,  R:  -2.2

Stack:  Y = 3, X = -2.2

Result = diverges


A:  3,  R:  2.2

Stack:  Y = 3, X = 2.2

Result = diverges



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, January 28, 2024

Swiss Micros DM42 and TI-84 Plus: Sum of an Infinite Geometric Series

Swiss Micros DM42 and TI-84 Plus:  Sum of an Infinite Geometric Series



Introduction


An infinite geometric series has the form:


a + a × r + a × r^2 + a × r^3 + ...


= a × (1 + r + r^2 + r^3 + ....)



If |r| < 1, the series converges and a sum exists. 


Σ  a × r^n   =   a ÷ (1 - r)

n=0


Σ  a × r^(n-1)   =   a ÷ (1 - r)

n=1


However if |r| ≥ 1, the series diverges and does not have as sum.



DM42 Program:  GSUM


Calculators: DM42, HP 42S, Free42, Plus42


00 { 36-Byte Prgm }

01▸LBL "GSUM"

02 ENTER

03 ABS

04 1

05 X<>Y

06 X>Y?

07 GTO 00

08 R↓

09 R↓

10 1

11 X<>Y

12 -

13 ÷

14 RTN

15▸LBL 00

16 CLX

17 "DIVERGES"

18 AVIEW

19 .END.


In the case the series diverges, the X stack is cleared (displays 0).  



TI-84 Plus Program:  GSUM


Calculators:  TI-84 Plus, TI-84 Plus CE (Python), TI-83 Premium CE (Python)


Disp "Σ(A*R^N,0,INF)","Σ(A*R^(N-1),1,I)"

Prompt A,R

ClrHome

Disp "A=",A,"R=",R

If abs(R)<1

Then

A/(1-R)→S

Disp "SUM=",S

Else

Disp "DIVERGES"

End



Examples


A:  3,  R:  -0.2

Stack:  Y = 3, X = -0.2

Result = 2.5


A:  3,  R:  0.2

Stack:  Y = 3, X = -0.2

Result = 3.75


A:  3,  R:  -2.2

Stack:  Y = 3, X = -2.2

Result = diverges


A:  3,  R:  2.2

Stack:  Y = 3, X = 2.2

Result = diverges



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, January 21, 2024

Approximating Limits to Avoid Overflow

Approximating Limits to Avoid Overflow


For most 10-digit scientific calculators, the maximum that a number can be before an overflow error occurs is 9.999999999×10^99.



The Maximum Number



What is the maximum number x can be before the calculator overflows?   (For reference, I used a TI-84 Plus to calculate these numbers.)


Function:  Maximum Number


e^(x^2):   15.17427129


x!:   69    (most calculators only allow nonnegative integers for the factorial function)


3^x:   209.5903274


e^x:  230.2585093


2^x:  332.1928095


x^4:  slightly less than 1E25  (1 × 10^25)  (like 9.99999999999E24)


x^3:  2.15443469E33  (2.15443469 × 10^33)


x^2:  slightly less than 1E50  (1 × 10^50)  (like 9.99999999999E49)


x^(3/2):  4.641588833E66  (4.641588833 × 10^66)  



Limits to Infinity



Why is this important?    This could be useful in applications, say approximating values of y(x) when x approaches infinity.




Example 1:


y = ln(x) / x^3


To find the limit x can be, look at the function presented and select the "part" that has the lowest limit.   In this case, that "part" is x^3.  Approach to that limit.


y(1E33):  7.59853081E-98


y(1.5E33):  2.26343032E-98


y(2E33):  9.58480691E-99


y(2.1E33):  8.28498493E-99


It would appear that ln(x)/x^3 approaches 0 as x approaches ∞.



The key is to select x values that will not cause the calculator to provide the overflow error.



Example 2:  


y = e^x/x^2


e^x has a max x of 230.2585093, while x^2 has a max x of 9.99999999999E49.  To prevent an overflow, we must choose x values approaching the lower max, in this case, 230.2585093.


y(229.9):  1.321975623E95


y(230):  1.459738847E95


y(230.1):  1.611859E95


y(230.2):  1.779832347E95


It would appear that e^x/x^2 approaches ∞ as x approaches ∞.



Example 3:


y = (x^3 - 1) / (x! * x^2)


Since the factorial is involved, the highest x can be is 69.


But y(69) overflows in this case!   Then we have to select lower x values until we can get answers.  This can be a trial and error approach.


y(68):  overflow


y(67):  1.83706434E-93


y(66):  1.21246228E-91


y(65):  7.88100352E-90


Looking at the results from y(65), y(66), and y(67), it appears that (x^3 - 1) / (x! * x^2) approaches 0 as x approaches ∞.



Remember that this isn't proof, but we can get an idea how a rational function will behave.  We still need the tools such as the ratio, root, and other tests.



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. 


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, September 26, 2021

TI-Eighties Graphing Calculators: A Timeline

 TI-Eighties Graphing Calculators:  A Timeline

(dates are from Wikipedia) - United States

TI-81:  1990

TI-85: 1992


TI-82:  1993


TI-80:  1995 - (not pictured)

TI-83:  1996 - (not pictured)

TI-86:  1996


TI-89 (Original): 1998 - (not pictured)

TI-83 Plus: 1999


TI-83 Plus Silver Edition: 2001



TI-84 Plus: 2004




TI-89 Titanium:  2004


TI-84 Plus Silver Edition: 2004 (not pictured)

TI-84 Plus Silver Edition C:  2013 (not pictured)

TI-84 Plus CE:  2015




TI-84 Plus CE Python Edition:  2021




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, May 15, 2021

Retro Review and Comparison: TI-82 Advanced

 Retro Review and Comparison: TI-82 Advanced




I can officially say that I have a French calculator.  


Quick Facts:


Models:  TI-82 Advanced

Company:  Texas Instruments

Manufactured: 2015-2021

Type:  Graphing

Battery:  4 AAA

Country: France


Keyboard


All the TI-82 Advanced is a French calculator, where the keys and functions are in French.  Examples include:


French:  suppr,  English:  delete


French:  dessin,  English:  draw


French:  annul,  English: clear


French:  rappel,  English: recall



I like the how the keys respond and how comfortable the keys feel.  The screen is a monochrome screen but the contrast between the screen and its text.  


More Like the TI-84 Plus


The TI-82 Advanced is pretty much the equivalent of the TI-84 Plus.  I put together a comparison table between three calculators:


*  The basic TI-82 (United States)

*  TI-82 Advanced

*  TI-84 Plus  (monochrome screen)


The table lists the commands available in several menus including Lists, Distributions, Program Editing, and Variables.  You can download the comparison here.  


Python to Come


In the Fall of 2021, Texas Instruments will release the next version of the TI-82 Advanced: the TI-82 Advanced Edition Python.  The new TI-82 Advanced will retain the classic TI-82 casing, including being powered by AAA batteries, but will have a color screen and have a Python programming mode. 


You can read the about the TI-82 Advanced Edition Python here:


https://education.ti.com/fr/produits/calculatrices/graphiques/ti-82-advanced-edition-python  (French)


https://tiplanet.org/forum/viewtopic.php?p=259509#p259509 (French)


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, January 9, 2021

TI 84 Plus: Plotting Circular Arcs with Just Two Points

 TI 84 Plus: Plotting Circular Arcs with Just Two Points


Introduction




Knowing two points (x0, y0) and (x1, y1), we can draw a circular arc between two points.  We are going to assume that the points form the diameter of the circle.  Therefore, either point forms the radius along with the line's midpoint.   The midpoint between the points, labeled (A,B) is:


A = (x0 + x1) / 2, B = (y0 + y1) / 2


With the radius:


R = √((A - x0)^2 + (B - y0)^2) = √((x1 - A)^2 + (y1 - B)^2)


Set the parametric equations as:


x = R * (cos(t) + A / R)

y = R * (sin(t) + B / R)


With t being the range of required angle measure (θ), we have to determine the start and end points for the range of values for t.  Since (A, B) may not be the origin, we must take it into account the midpoint in determining the angle points:


t0 = atan((B - y0) / (A - x0)) mod 2*π

t1 = atan((y1 - B) / (x1 - A)) mod 2*π


The program ARC2PTS for the TI-84 Plus makes use the complex number functions abs and angle to determine radius and the angles, respectively.


TI-84 Plus Program: ARC2PTS


"2020-12-20 EWS"

Radian

a+bi

Param

FnOff 

Input "X0? ",J

Input "Y0? ",K

Input "X1? ",L

Input "Y1? ",M

(J+L)/2→A

(K+M)/2→B

angle((A-J)+i(B-K))→C

If C<0:C+2π→C

angle((A-L)+i(B-M))→D

If D<0:D+2π→D

abs((A-J)+i(B-K))→R

"R(cos(T)+A/R)"→X₁T

"R(sin(T)+B/R)"→Y₁T

Menu("DIRECTION","TOP",1,"BOTTOM",2)

Lbl 1

min(C,D)→Tmin

max(C,D)→Tmax

Goto 3

Lbl 2

max(C,D)→Tmin

min(C,D)+2π→Tmax

Goto 3

Lbl 3

π/64→Tstep

ZoomFit

ZSquare


Examples


Example 1


Points:  (1,3) and (5,9), top part of the circle




Example 2


Points:  (-5, -8) and (-1, -7), bottom part of the circle




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, October 5, 2019

Fun with the TI-81: Part I

Fun with the TI-81:  Part I

Before there there was the TI-82, TI-83 and its family, and the TI-84 Plus and its family, there was the Texas Instrument's original calculator from the 1990, the TI-81!

Translating TI-81 to TI-84 Plus (and Back) 

Most of the commands can be copied directly.  Some caveats to keep in mind:

Disp

The TI-81's Disp (Display command) can only display either a variable's value or a string.  The command can only display one item per line.

The TI-84 Plus' Disp command can list any combination of strings and variable values, separated by a comma.  Each argument will be placed on one line.

Input

The TI-81's Input command can ask for one variable.  There is no prompt string option.  A prompt string will require an extra Disp command.  Also, there is no colon character.

Disp "VAR="
Input A

The TI-84 Plus' Input command can have an optional prompt string.

Input "VAR=", A

Lists 

The TI-81 has two lists that are used for statistical calculations, {x} and {y}.  To recall an element of either {x} or {y}, press [ 2nd ] [ 0 ] or [ 2nd ] [ 1 ], respectively.  The dimensions of the stat lists can be found by pressing [VARS], and selecting Dim{x} under the DIM menu.  Stat lists can't be resized by storing a value to it.

All of the lists for the TI-84 Plus start with a lower case bold "L".  Lists 1-6 can be pressed by [ 2nd ] [ 1 ] through [ 6 ].  There are many lists commands and functions for the TI-84 Plus.

Linear Regression Options

Running linear regression is the LinReg command on the TI-81.  The equation will always be a + bx.

Running linear regression for the TI-84 Plus will need you to designate the x-list and y-list.  There are also various options: a + bx, ax + b, or Med-Med

The If Command and Loops

The TI-81 only has a singular If command, no Then or Else.  The syntax is:

If condition
do if condition is true
skip to here if condition is false

Loops will require the extensive use of Lbl (label), Goto, DS<(, and IS>(.   Lbl and Goto are self-explanatory. 

DS<(var, target).   The value of var is decreased by 1.  The next command is skipped when value < target.

IS>(var, target).  The value of var is increased by 1.  The next command is skipped when value > target. 

In addition to If (which can still do the two-line structure), Lbl, Goto, DS<(, and IS>(, the TI-84 Plus has Then, Else, For, While, and Repeat.

The STO> Button

The TI-81 turns on the ALPHA keyboard when pressing [STO>].

The TI-84 Plus doesn't.

On to the programming...

TI-81 Decimal to Binary Conversion:  BINTODEC
(75 bytes)

Input the binary integer at the prompt.  Use only 1s and 0s. 

Variables:
B = binary representation
D = decimal representation
N, M:  used

Program:
Disp "BIN>DEC"
Input B
0 → D
0 → N
B → M
Lbl 0
2^N * 10 * FPart(M/10) + D → D
IPart(M/10) → M
IS>(N, IPart(log B) + 1)
Goto 0
Disp D

Example:
Input:  B:  1001010
Result:  D:  74

TI-81 Binary to Decimal Conversion:  DECTOBIN
(99 bytes)

Input the decimal integer at the prompt.  The integer needs to be in between 1 and 1024.  Only positive integers are allowed.

Variables:
B = binary representation
D = decimal representation
N, M:  used

Program:
Disp "DEC>BIN"
Disp "1≤D≤1024"
Input D
0 → B
D → M
IPart( log D / log 2 ) → N
Lbl 2
If 2^N ≤ M
B + 1 → B
If 2^N ≤ M
M - 2^N → M
If N ≠ 0 
10 * B → B
DS<(N, 0)
Goto 2
Disp B

Example:
Input:  D:  516
Result:  B:  1000000100

TI-81 Roots of a Quadratic Equation:  QUADEQN
(121 bytes)

This program solves the equation A*X^2 + B*X + C = 0, which allows for real or complex roots.

Variables:
A, B, C:  coefficients
X, Y:  roots

If the discriminant is zero or positive, the roots are real, and are stored in X and Y.

If the discriminant is negative, we have complex roots in the form of X ± Yi, X is the real part, Y is the imaginary part.

Program:
Disp "AX²+BX+C=0"
Input A
Input B
Input C
-B / (2A) → X
(B² - 4AC) / (4A²) → Y
If Y<0 font="">
Goto 0
√Y → Y
X + Y → Y
2X - Y → X
Disp "ROOTS"
Goto 2
Lbl 0
√(abs Y) → Y
Disp "X+YI, X-YI"
Lbl 2
Disp X
Disp Y

Examples:

x^2 + 4x + 5 = 0,  Roots:  2 ± i
Input:  A: 1, B: 4, C: 5
Results:  "X+YI, X-YI", X: -2, Y: 1

x^2 + 5x + 4 = 0,  Roots:  -4, -1
Input:  A: 1, B: 5, C: 1
Results: "ROOTS", X: -4, Y: -1

Tomorrow will be Part 2. Until then,

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.

Saturday, July 13, 2019

TI-84 Plus and Casio fx-CG50: Which Die Wins?

TI-84 Plus and Casio fx-CG50: Which Die Wins?

Introduction:  Which Die Wins? 

The program DICEODDS compares a pair of dice against each other.  Each die, having values on its six faces and a different distribution of those values, is rolled against each other.  The program determines which die has a better chance of winning.

The face of each die can have any value, and values can repeat.  These dice can and usually are  different from the standard dice (1, 2, 3, 4, 5, 6).

Example 1:

Die 1 is your standard die:  {1, 2, 3, 4, 5, 6}
However, Die 2 has all threes:  {3, 3, 3, 3, 3, 3}

If we roll Die 1 against Die 2, Die 1 wins if a 4, 5, or 6 is rolled.  The odds of Die 1 having a higher value is 1/2. 

Example 2:

Die 1:  {3, 3, 3, 4, 4, 4}
Die 2: {2, 2, 2, 2, 7, 7}

Die 1 wins when a 2 is rolled on Die 2, which occurs 4/6 or 2/3 of the time.  If a 7 is rolled from Die 2, then Die 2 wins, and this has a probability of 1/3. 

DICEODDS compares each value of Die 1 against Die 2 on a single roll of each die.

This is an idea based on a article from James Grime, mathematician who is part of Numberphile. (see Source below)  Numberphile has a YouTube channel which discusses mathematics.   

Grime starts the article by presenting a game where two players choose one of three dies.  The red die has five 3s and one 6, the blue die has three 2s and three 5s, and the olive has one 1 and five 4s.  By comparing dies against each other, the red has a better chance of winning over blue, the blue has better chance of winning over olive, and olive has a better chance of winning over red.  It happens that the dice in this game represent paper-rock-scissors.

Grime also covers games where a chosen die is rolled twice during a game.  There is Efron Dice, a game involving choosing one of four dice (all 3s, half 0s and half 4s, half 1s and half 5s, half 2s and half 6s).  Grime also presents a game involving five dice, each die with an equal chance of winning. 

Dice are considered to be non-transitive when in a game of comparing dice, no die is dominant.

Running DICEODDS

DICEODDS compares two dice on a single role and their probability of winning.  The user is allowed to either enter their own values or generate two random dice, with values ranging from 0 to 9.  Values can repeat, and if you want, do not have to be positive integers.  The screen shots below are from the Casio fx-CG50 version of DICEODDS. 




TI-84 Plus Program DICEODDS

"2019-06-03 EWS"
Menu("WHICH DIE WINS?","RANDOM DICE",1,"ENTER DICE",2)
Lbl 1
seq(randInt(0,9),X,1,6)→L₁
seq(randInt(0,9),X,1,6)→L₂
Goto 3
Lbl 2
Disp "ENTER DIE OF 6 VALUES"
Input "DIE 1: ",L₁
Input "DIE 2: ",L₂
Lbl 3
0→P
For(I,1,6)
sum(L₁(I)>L₂)/6*1/6→F
P+F→P
End
ClrHome
Disp "DIE 1,2",L₁,L₂,"ODDS DIE 1 WINS",P▶Frac,"ODDS DIE 2 WINS",(1-P)▶Frac

Casio fx-CG50 Program DICEODDS - (text file format)

'ProgramMode:RUN
"2019-06-04 EWS"
Menu "WHICH DIE WINS?","RANDOM DICE",1,"ENTER DICE",2
Lbl 1
6->Dim List 1
6->Dim List 2
For 1->I To 6
RanInt#(0,9)->List 1[I]
RanInt#(0,9)->List 2[I]
Next
Goto 3
Lbl 2
"ENTER DIE: 6 VALUES"
"DIE 1:"?->List 1
"DIE 2:"?->List 2
Lbl 3
0->P
For 1->I To 6
Sum (List 1[I]>List 2)/6*1/6->F
P+F->P
Next

ClrText
Red Locate 1,1,"DIE 1:"
Blue Locate 1,2,"DIE 2:"
For 1->I To 6
6+2*I->J
Red Locate J,1,List 1[I]
Blue Locate J,2,List 2[I]
Next
Locate 1,4,"ODDS DIE 1 WINS:"
Red Locate 1,5,P
Locate 1,6,"ODDS DIE 2 WINS:"
Blue Locate 1,7,1-P

Source:

Grime, James "The Bizzare World of Nontransitive Dice: Games for Two or More Players" from:
Pritici, Micrcea (editor) "The Best Writing on Mathematics 2018"  Princeton University Press: Princeton, NJ.  2019  ISBN 978-0-691-18276-6

The article can also be found on the web:  https://singingbanana.com/dice/article.htm
(Retrieved June 5, 2019)

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.

Tuesday, April 2, 2019

HP Prime and TI-84 Plus CE: Percent Change on Paired Data

HP Prime and TI-84 Plus CE:  Percent Change on Paired Data

Introduction

Given a two column matrix, the programs here calculate the percent difference on each row.  The first column is the old value while the second column is the new value.

HP Prime Program %CHGPAIRED

EXPORT %CHGPAIRED(m0)
BEGIN
// Δ% on a 2 column matrix
// 2019-03-31 EWS
LOCAL k,s:=SIZE(m0);
LOCAL n:=s(1);
LOCAL m1:=MAKEMAT(0,n,1);
FOR k FROM 1 TO n DO
m1(k,1):=%CHANGE(m0(k,1),m0(k,2));
END;
RETURN m1;
END;

TI-84 Plus Program CHGPAIR

"2019-03-31 EWS"
Disp "PCHG PAIRED DATA"
Input [J]
dim([J])→L₆
L₆(1)→N
{N,1}→dim([I])
For(K,1,N)
([J](K,2)-[J](K,1))/[J](K,1)*100→[I](K,1)
End
Pause [I]

Example

M =
[[ 1, 6 ], [ 4, 2 ], [ 3, 7 ], [ 6, 5 ], [ 4, 11 ]]

Result:
[[ 500 ], [ -50 ], [ 133.3333333 ], [ -16.6666667 ]]

[picture]

Source:  "Probability and Statistics:  Step by Step Solutions for Your HP-28S or HP-28S Calculator"  Hewlett Packard.  November 1987.

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.

Wednesday, March 13, 2019

TI-84 Plus: Greenwich Mean Sidereal Time Estimate

TI-84 Plus:  Greenwich Mean Sidereal Time Estimate

Introduction

The program GMST calculates and estimates the Greenwich Mean Sidereal Time for any dates between January 1, 1900 and December 31, 2099.

For any date between 1900 and 2099, the date number is calculated as:

number of days since January 1 + (year - 1900) * 365 + int((1900 - year)/4) + 0.5 + hour/24

Please keep in mind, the formula in this program is from 1978 (see source).

For the hour, a 2400 hour clock format is used.  For example, 1 AM = 1, 1 PM = 13. 

This program does not take the location of the observer into account.

TI-84 Plus Program: GMST

"2019-03-08 EWS"
Disp "1900-2099"
Input "MONTH: ",M
Input "DAY: ",D
Input "YEAR: ",Y
Input "HOUR: ",H
If fPart(Y/4)=0 and Y≠1900
Then
1→L
Else
0→L
End

If M≥3
Then
int(30.6*M+1.6)+D-35+L→T
Else
int(30.6*M+368.8)+D-400→T
End

T+(Y-1900)*365+iPart((Y-1900)/4)+.5+H/4Z
Z/36525→Z
6°38'45.836"+2400.051262*Z+0°0'0.0929"*Z²→E
24*fPart(E/24)→E
Disp "GMST: ",E>DMS


Example:

Example 1: 

January 1, 1978, Midnight (Hour = 0):  6°41'9.836"

Example 2:

March 13, 2011, 7:00 PM (H = 19): 11°23'54.646"

Source:

Jones, Aubrey  Mathematical Astronomy With a Pocket Calculator  Halsted Press:  John Wiley & Sons, New York.  1978.  ISBN 0 470 26552 3

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.

Sunday, March 10, 2019

TI-84 Plus and HP 41C: Number of Days After January 1

TI-84 Plus and HP 41C:  Number of Days After January 1

Introduction

The program DATENO calculates the number of days from January 1.  The program prompts whether we are working in a leap year or not. 

With D = Day and M = Month, the days between January 1 and any other date within the calendar year is:

If M = 1 and M = 2 Then
DATE# = int(30.6 * M + 368.8) + D - 400

Otherwise,
DATE# = int(30.6 * M + 1.6) +D - 35  (non-leap year)
DATE# = int(30.6 * M + 1.6) + D - 34  (leap year)

TI-84 Plus Program: DATENO

"DAYS AFTER JANUARY 1"
"2019-03-07 EWS"
Input "MONTH: ",M
Input "DAY: ",D
Disp "0:NO, 1:YES"
Input "LEAP YEAR? ",L
If M≥3
Then
int(30.6*M+1.6)+D-35+L→T
Else
int(30.6*M+368.8)+D-400→T
End
Disp T

HP 41C/DM 41L Program:  DATENO

(^T:  beginning of an alpha string)

01 LBL^T DATENO
02 ^T MONTH
03 PROMPT
04 STO 01
05 ^T DAY?
06 PROMPT
07 STO 02
08 ^T LEAP? N=0,L=1
09 PROMPT
10 STO 03
11 RCL 01
12 3
13 X<=Y?
14 GTO 00
15 30.6
16 RCL 01
17 *
18 368.8
19 +
20 INT
21 RCL 02
22 +
23 400
24 -
25 GTO 01
26 LBL 00
27 RCL 01
28 30.6
29 *
30 1.6
31 +
32 INT
33 RCL 02
34 + 
35 35
36 - 
37 RCL 03
38 + 
39 LBL 01
40 STO 04
41 END

Examples

Days between January 1 and February 16  (M = 2, D = 16):  46

Days between January 1 and October 1 (M = 10, D = 1):
(Non-leap year):  273
(Leap year): 274

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.

Spotlight: Akron Brass FireCalc Pocket Computer

Spotlight: Akron Brass FireCalc Pocket Computer Welcome to a special Monday Edition of Eddie’s Math and Calculator blog. Thi...