Sunday, March 17, 2024

Casio fx-9750GIII and fx-CG 50: Playing Games with the Probability Simulation Mode

Casio fx-9750GIII and fx-CG 50: Playing Games with the Probability Simulation Mode






The Probability Simulation add-in has six types of probability simulations:

* Coin Toss

* Dice Roll

* Spinner

* Marble Grab

* Card Draw

* Random Numbers


The add-in application is available for the following calculators:

* Casio fx-9750GIII and fx-9860GIII (and Graph 75/85/95 series, Graph 35+ E II)

* Casio fx-CG 10/20 and fx-CG 50 (and Graph 90+E)

* Casio fx-9860G


I believe on the fx-9750GIII and fx-9860GIII, the Probability Simulation Add-In is available out of the box. For others, the add-in can be downloaded through Casio’s Worldwide Education Website: https://edu.casio.com/download/index.php.


Let’s look at three ways we can use the Probability Simulation add-in in games of chance. This is a great app when you don’t have a pair of dice, playing cards, or a bag of marbles around.


In the Set Up menu, there is an option for seed from 1 to 99999.


Screen shots are from the fx-CG 50.


Interaction with Other Modes


* Data can be stored into global lists 1-26. Lists in these Casio calculators contain only numerical information. Numerical codes are used for card suits and face cards.


* There are no commands from the Add-In that can be used in programming. The simulation is mean to be a stand-alone app.




Drawing a Poker Hand






From the main screen, press F5 for Card Draw. To simulate poker, go into set up by pressing [SHIFT] {SET UP}. We can set either a 52 playing card deck, which is the standard deck without Jokers, or a reduced deck of 32 cards (sevens through Aces only). We don’t want Replacement, so turn that off. Press [ EXIT ] to go back to the simulation.


To draw a single card, press [ F1 ]. To draw multiple cards, press [ F2 ] for { +n }. At the prompt, press [AC/ON] and enter the number of cards.


We will have to memorize the cards or note the down on paper or another writing device.


To save the cards drawn, select [ F3 ] (STORE). There are three lists:


Draw: Draw number

Value: Card value. 1 = Ace, 11 = Jack, 12 = Queen, 13 = King

Suit: 1 = Heart, 2 = Club, 3 = Spade, 4 = Diamond


Lists can be allocated to the global list variables List 1 to List 26. Press [ F6 ] { EXE } to store the cards. Storing results works similarly in other applications.



Rolling Dice in Adventure Games





In adventure and fantasy games such as Dungeon and Dragons, sometimes dice beyond the standard six-sided die is needed. The Dice Roll (F2 from the Main Menu) has dice that are four-sided, six-sided, eight-sided, twelve-sided, and twenty-sided. Up to three dice can be thrown at once.


A Simple Lottery





Random integers from 0 to 99 can be drawn with the Random Numbers. Again, the set up menu is the key. For the lottery, turn the Repeat option off. Above are four draws from a simple lottery from 63 numbers.



This has been a look at Casio’s Probability Simulation Add-In. Until next time,


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.


Saturday, March 16, 2024

DM42 and DM41X: Timing Programs

DM42 and DM41X: Timing Programs


How Long Does it Take?

There is a convenient way of timing programs on the Swiss Micros DM42 and DM41X. This is accomplished by the TIME function. The TIME function returns the time, initially shown in HH:MM:SS format. HH represents hours, MM represents minutes, and SS represents seconds. The time is stored internally in HH.MMSS format.

We will also use the HMS- function. The HMS- subtracts two time values in HH.MMSS format.

A format that time the performance of an algorithm:


TIME

STO ## (store in any variable desired)

...

[main code here]

TIME

RCL ## (recall time stored in the beginning)

HMS-

“TIME=” (shows the time using a message, optional)

ARCL ST X

AVIEW

RTN


The elapsed time is in HH.MMSS format.


One word of caution, I would not use this method if you plan to run the test and midnight (12:00 AM or 0:00 hours) comes in between execution.



Example Code


Here is an example program that measure long a loop takes. In the example, the loop requires to display the x and y values for the function:


y = 2/5 × ln((x + 1)^2 ÷ 5) for x = 0 to 25.



Swiss Micros DM41X Code


01 LBL ^T TIMETST

02 0.025

03 STO 00

04 TIME

05 STO 01

06 LBL 00

07 RCL 00

08 INT

09 ^T X=

10 ARCL X

11 AVIEW

12 PSE

13 XEQ 01

14 ^T Y=

15 ARCL X

16 AVIEW

17 PSE

18 ISG 00

19 GTO 00

20 TIME

21 RCL 01

22 HMS-

23 ^T TIME=

24 ARCL X

25 AVIEW

26 RTN

27 LBL 01

28 1

29 +

30 X↑2

31 5

32 /

33 LN

34 2

35 *

36 5

37 /

38 RTN


Swiss Micros DM42 Code


00 {75-byte Prgm}

01 LBL “TIMETST”

02 0.025

03 STO 00

04 TIME

05 STO 01

06 LBL 00

07 RCL 00

08 IP

09 “X=”

10 ARCL ST X

11 AVIEW

12 PSE

13 XEQ 01

14 “Y=”

15 ARCL ST X

16 AVIEW

17 PSE

18 ISG 00

19 GTO 00

20 TIME

21 RCL 01

22 HMS-

23 “TIME=”

24 ARCL ST X

25 AVIEW

26 RTN

27 LBL 01

28 1

29 +

30 X↑2

31 5

32 ÷

33 LN

34 2

35 ×

36 5

37 ÷

38 RTN



The results that I have:


DM41X (SN 00843): 0.0049 (49 seconds)

DM42 (SN 03911): 0.0053 (53 seconds)


For reference, here are the values (rounded to 4 digits):


X

Y

0

-0.6438

1

-0.0893

2

0.2351

3

0.4653

4

0.6438

5

0.7896

6

0.9130

7

1.0198

8

1.1140

9

1.1983

10

1.2745

11

1.3442

12

1.4082

13

1.4675

14

1.5227

15

1.5743

16

1.6228

17

1.6685

18

1.7118

19

1.7528

20

1.7918

21

1.8291

22

1.8646

23

1.8987

24

1.9313

25

1.9627



I hope you find this helpful. Take care and until next time,


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.



Thursday, March 14, 2024

Spotlight: Casio fx-6500G

 

Spotlight: Casio fx-6500G


For my birthday, I present a review of the Casio fx-6500G.






Quick Facts


Model: fx-6500G

Company: Casio

Timeline: 1986 – 1988

Type: Graphing Scientific Calculators

Power: 3 x CR2032

Programming Memory: 486 steps at default

Number of Memory Registers: 26 at default

Screen Size: 96 x 32 pixels

Graph Types: Function, Scatter plot, Histogram, Linear Regression Plot, Point Plot

Linear Regression

Base Operations and Logic Functions

Hyperbolic Functions





Screen Sizes and Memory of Casio’s Early Calculators


fx-7000G (1985)

422 bytes, up to 78 registers

96 x 64 pixels

fx-6500G (1986)

486 bytes, up to 86 registers

96 x 32 pixels

fx-7500G (1988)

4006 bytes, up to 526 registers

96 x 64 pixels

fx-6300G (1991)

400 bytes, up to 76 registers

40 x 23 pixels


(measures from rskey.org, Casio fx-6300G manual, Casio fx-7500G manual)






Other Features


Like the other early Casio graphing calculators, including the fx-7000G, fx-7500G, and later the fx-6300G, the fx-6500G has the a similar structure.


The screen of the fx-6500G is just as wide of the screens of the fx-7000G and fx-7500G, but half of the height. The screen of the fx-6500G is still bigger than the fx-6300G and graphs take the entire screen, which I appreciate.


There are four statistical modes:


SD1: single-variable statistics analysis mode

SD2: single-variable statistics graphics mode for Histograms, data lines, and normal curves

LR1: linear regression analysis mode, with the regression equation y = A + Bx

LR2: linear regression graphics mode for scatter plots and linear regression trend lines


The defragment mode ( [ MODE ] [ . ] {Defm}) can allow an additional 60 registers at the expense of programming steps. Each new register costs 8 programming steps. Array registers are accessed in the format A[#], where A is the letter of memory and # is the number of registers away from the variable.


For example:

A[0] accesses A

A[1] accessed B

A[2] accesses C

A[25] accesses Z

A[26] accessed the first expanded memory, the same as Z[1]


# can be a negative integer. Array-type memories allow for indirect registers.


The programming command set is relatively simple, and most of it has remained throughout the entire Casio graphing and programming calculator set:

There are 10 program slots: P0 through P9.


: separates program lines from each other. The carriage return by pressing [ EXE ] also terminates the line.


◢ is the run/stop symbol. Any quoted text or numeric value is shown as the calculator stops. Press [ EXE ] to continue.


⇒ is the jump command and is used for quick If-Then-Else structures. The syntax is:

condition ⇒ do if the condition is true : (or ◢) jump to here if the condition is false.


Goto and Lbl: goto and label. There are ten labels available in each for each program: Lbl 0 through Lbl 9.


Prog: Prog executes another program as a subroutine. An implied “return” is automatically executed at the end of program.


Isz: Increment and skip. Adds 1 to a variable and skips the next command if the new value is 0.

Isz variable : do if var=var+1≠0 is true : (or ◢) skip to here if the var=var+1=0


Dsz: Decrement and skip. Subtracts 1 from a variable’s value and skips the next command if the new value is 0. If find Dsz particularly useful in simple For-Next loops.

Dsz variable : do if var=var-1≠0 is true : (or ◢) skip to here if the var=var-1=0



Final Thoughts


The calculator looks nice and clean. The fx-6500G offers all of the features of the fx-7000G and fx-7500G (and fx-6300G less the fractions) in a scientific calculator size. I like the fact the graphs do fill the entire screen. Programs and calculation modes have up to four lines. The fx-6500G is the way to handle a smaller-sized graphing calculator, which makes it a very sought, harder to find, calculator.


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, March 10, 2024

Fun with the TI-81 (March 2024 Edition)

Fun with the TI-81 (March 2024 Edition)






TI-81 SCATTER







Produces a scatter plot.


Size: 52 bytes


Code:


If Dim{x}=0

Disp “NO DATA”

If Dim{x}=0

Stop

ClrDraw

1→I

Lbl 0

PT-On({x}(I),{y}(I))

IS>(I,Dim{x})

Goto 0

DispGraph


Note: Dim{x} returns the number of data points in the statistics list {x}.

Keystrokes: [ VARS ], DIM, 7: Dim{x}



TI-81 ANGLES


Given three pints, the internal and external angle are calculated.





Size: 196 bytes


Code:

Deg

Disp “SIDE PT (S,T)”

Input S

Input T

Disp “CORNER (M,N)”

Input M

Input N

Disp “SIDE PT (U,V)”

Input U

Input V

(S-M)*(U-M)+(T-N)*(V-N)→D

√((S-M)^2+(T-N)^2)→A

√((U-M)^2+(V-M)^2)→B

cos^-1 (D/(A*B))→I

360-I→E

Disp “INTERNAL ANGLE”

Disp I

Disp “EXTERNAL ANGLE”

Disp E



Example:

(S,T) = (-4,-6)

(M,N) = (1,1)

(U,V) = (3,5)



INTERNAL ANGLE: 171.0273734

EXTERNAL ANGLE: 188.9726266


Source:

Cook, John D. “Ramanujan approximation for circumference of ellipse” John D. Cook Consulting. May 5, 2015. https://www.johndcook.com/blog/2013/05/05/ramanujan-circumference-ellipse/ Accessed January 24, 2024


TI-81 ELLIPSE

Given the length of the semi-axis, the program draws the ellipse, calculates the area, and approximates the circumference using Ramanujan formula.

Size: 195 bytes


Code:


Param

Rad

Disp “SEMI X-AXIS”

Input A

Disp “SEMI Y-AXIS”

Input B

(A-B)/(A+B)→L

Ï€*(A+B)*(1+(3*L^2)/(10+√(4-3*L^2))→P

Ï€*A*B→R

Disp “APPROX. CIR=”

Disp P

Disp “AREA=”

Disp R

Pause

All-Off

“A*cos T”→X_1T

“B*sin T”→Y_1T

X1T-On

-A-1→Xmin

A+1→Xmax

-B-1→Ymin

B+1→Ymax

0→Tmin

2Ï€→Tmax

Ï€/24→Tstep

DispGraph



Notes:

All-Off turns all the graphing equations off from graphing.

[ 2nd ] {Y-VARS}, OFF, 1: All-Off



XT1 and YT1 are the equation variables x1(t) and y1(t):

[ 2nd ] {Y-VARS}, Y, 5: X_1T and 6: Y_1T, respectively



Example:


SEMI X-AXIS? 2

SEMI Y-AXIS? 3



Results:

APPROX. CIRC= 15.86543959

AREA= 18.84955592






TI-81 RELATIVE

Calculate the consequences of reality when it comes to a length and mass of an object traveling near the speed of light, c = 299,792,458 m/s.


Size: 141 bytes


Code:

299792458→C

Disp “C=”

Disp C

Disp “M/S”

Pause

Disp “°/. OF C”

Input P

P*C/100→U

√(1-(U/C)^2)→V

Disp “LENGTH”

Input L

Disp “OBS LENGTH=”

L*V→K

Disp K

Pause

Disp “MASS”

Input M

Disp “OBS. MASS=”

M/V→N

Disp N


Enter the percentage of the speed of light (70%, 80%, 90%, etc.). Three characters are used to create the percent sign (%) (°, / , . )


Example:


92.5% of the speed of light

length: 40.8 m

mass: 6,700 kg


Results:

observed length = 15.50265784 m

observed mass = 17,633.10542 kg


Source:


Jackson, Mark D. The QuickStudy for Physics BarCharts Publishing Inc. Boca Raton, Florida. 2007. ISBN 13: 9781423202677. pp. 114-115

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.


Saturday, March 9, 2024

Casio FX-702P, Swiss Micros DM42, HP 27S: Design of Coil Spring

Casio FX-702P, Swiss Micros DM42, HP 27S: Design of Coil Spring


Today’s blog calculates the load of a coil spring.


Variables Used


P

LOAD

Load (kg)

G

SHEAR

Shear Modulus (kg/mm^2)

A

WDIA, W.DIA

Diameter of the wire (mm)

Y

DEFL

Deflection (mm)

N, NA

#COIL

Number of Coils

D

CDIA, C.DIA

Diameter of the coil (mm)

K = (G×A^4)÷(8×N×D)


Spring Constant (kg/mm)
(FX-702P only)



Casio FX-702P Code


The original BASIC programs are listed here (Casio, pg. 72, Program Library FX-702P, see sources):

5 FOR L=1 TO 5

10 INP “K,P:1,A:2,D:3,NA:4”,I

20 FOR J=1 TO 4

30 IF I=J THEN 100

40 NEXT J

50 GOTO 10


100 INP “G=”,G

110 G=G/8

120 IF I=2 THEN 150

130 INP “A=”,A:A=A↑4

140 IF I=3 THEN 170

150 INP “D=”,D:D=D↑3

160 IF I=4 THEN 180

170 INP “NA”=,N

180 INP “Y=”,Y

190 IF I=1;K=G*A/N/D:P=K*Y:PRT “K=”;K,”P=”;P:GOTO 240

200 INP “P=”,P

210 IF I=2;A=(P*D*N/G/Y)↑(1/4):PRT “A=”;A:GOTO 240

220 IF I=3;D=(A*G*Y/N/P)↑(1/3):PRT “D=”;D:GOTO 240

230 N=G*A*Y/D/R:PRT “NA=”;N

240 NEXT L

250 END


INP: input

PRT: print


Swiss Micros DM42 Solver Code: SPRING


Also for HP 42S, Free42, Plus42.


00 { 103-Byte Prgm }
01▸LBL "SPRING"
02 MVAR "LOAD"
03 MVAR "SHEAR"
04 MVAR "W.DIA"
05 MVAR "C.DIA"
06 MVAR "#COIL"
07 MVAR "DEFL"
08 RCL "SHEAR"
09 RCL "W.DIA"
10 4
11 Y↑X
12 ×
13 RCL× "DEFL"
14 8
15 RCL× "#COIL"
16 RCL "C.DIA"
17 3
18 Y↑X
19 ×
20 ÷
21 +/-
22 RCL+ "LOAD"
23 RTN
24 .END.


Run SPRING through the SOLVER.



HP 27S Equation: SPRING


Spaces added for readability.


SPRING: SHEAR × WDIA^4 × DEFL ÷ (8 ×#COIL × CDIA^3)



Example: Copper Spring Coil


Shear: G = 4558.131472 kg/mm^2

Coil Diameter: D = 10 mm

Wire Diameter: A = 0.7 mm

Deflection: Y = 5 mm

Number of Coils: N = 4


Result: Load: P: 0.17100 kg



Calculate the wire diameter if the load is 0.25 kg.


Result: Wire Diameter: A: 0.79672 mm



What if instead we have 8 coils? Wire diameter resets to 0.7 mm.


Result: Load: P: 0.08550 kg




Table of Shear Modulus Values


These are the shear modulus of various mediums. The higher the shear modulus is, the more rigid the solid is. If the solid’s modulus is smaller, it is easier to deform or change its shape. For liquids, the modulus is zero. The table below has two units, GPa (gigapascal) and kg/mm^2. The conversion rate is approximately 1 GPa = 101.9716212978 kg/mm^2.


The values in are from the “What is the Shear Modulus?” article by Dr. Helmenstine (see the Sources section) in GPa.


Shear Modulus

GPa

kg/mm^2

Rubber

0.0006

0.06118297278

Plywood

0.62

63.2224052

Nylon

4.1

418.0836473

Lead

13.1

1335.828239

Aluminum

25.5

2600.276343

Brass

40

4078.864852

Copper

44.7

4558.131472

Titanium

41.1

4191.033635


Source:


Casio. Program Library: FX-702P pp. 71-72 (English)

Helmenstine, Anne Marie, Ph.D. "What Is the Shear Modulus?" ThoughtCo, Feb. 17, 2021, thoughtco.com/shear-modulus-4176406. Retrieved January 21, 2024.

TranslatorsCafe.com “Convert gigapascal [GPa] to kilogram-force/millimeter² [kgf/mm²]”

https://www.translatorscafe.com/unit-converter/en-US/pressure/5-28/gigapascal-kilogram-force/millimeter%C2%B2/ Retrieved January 21, 2024



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.


Casio fx-9750GIII and fx-CG 50: Playing Games with the Probability Simulation Mode

Casio fx-9750GIII and fx-CG 50: Playing Games with the Probability Simulation Mode The Probability Simulation add-in has six type...