Showing posts with label Casio fx-5800p. Show all posts
Showing posts with label Casio fx-5800p. Show all posts

Sunday, July 25, 2021

Casio fx-5800P and TI-84 Plus CE: Simplify Radicals and August TI-95 ProCalc Month

Casio fx-5800P and TI-84 Plus CE: Simplify Radicals and August TI-95 ProCalc Month


Introduction

The program SIMPRAD simplifies radicals of any positive integer and power.

Casio fx-5800P Program: SIMPRAD

"2021-05-16 EWS"
"x(N)->A x(B)"
"INTEGERS"
"X"?->X
"N"?->N
Xx(N)->R
If Frac(R)=0
Then R
Stop
IfEnd
Int(R)->Q
N->B
1->A
While Q1
B÷(Q^(X))->S
If Frac(S)=0
Then Q×A->A
S->B
IfEnd
Q-1->Q
WhileEnd
"A x(B):"
A
B

TI-84 Plus CE Program:  SIMPRAD


Or type: 

"2021-05-16 EWS"
ClrHome
Disp "√(N)->A*x√(B)","ENTER INTEGERS"
Input "X? ",X
Input "N? ",N
Xx√N→R
If fPart(R)=0
Then
Disp R
Stop
End
iPart(R)→Q
N→B
1→A
While Q≠1
B/(Q^X)→S
If fPart(S)=0
Then
Q*A→A
S→B
End
Q-1→Q
End
Disp toString(X)+"x√("+toString(N)+")="
Disp toString(A)+"*"+toString(X)+"x√("+toString(B)+")"

Examples 




TI-95 ProCalc Month:  August 2021




Every Saturday in August 2021 (8/7/21, 8/14/21, 8/21/21, 8/28/21) will feature the Texas Instruments TI-95 ProCalc from the late 1980s.   


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, September 14, 2019

TI-84 Plus CE and Casio fx-5800P: Highway Transition Spiral

TI-84 Plus CE and Casio fx-5800P:  Highway Transition Spiral

Introduction



For any given parameters of a highway transition spiral:

PI:  point of intersection of the vertices (X coordinate, Y coordinate; Program Variables A, B)
∆:  intersection angle  (Program variable I)
D_C:  degree of the curve (Program variable D)
L_S:  length of the spiral (Program variable L)

Outputs:

Z:  Angle between the radii of spiral at TS and SC
R:  radius of circular curve
TS:  point of intersection of main tangent and approach spiral   (Program Variables U, V)
SC:  point of intersection of main tangent and circular curve
ST:  short tangent

Formulas:

Z = L * D / 200

Z is in degrees
Convert Z to radians:  Q = Z * π /180

x = L * (1 - Q^2/10)
y = L * (Q/3 - Q^3/43)
k = x - R * sin Z
p = y - R * (1 - cos Z)
T = (R + P) tan (∆/2) + K
S = Y * csc Z = Y / sin Z

Coordinates of TS:
[ PI_X - intg(T/100),  PI_Y - 100 * frac(T/100)]

Coordinates of SC:
[ TS_X + intg(L/100), TS_Y + 100 * frac(L/100)]


TI-84 Plus CE Program HYSPIRAL
(program to be typed)

Degree
"EWS 2019-08-03"
Disp "HWY SPIRAL"
Input "PI X: ",A
Input "+ PI Y: ",B
Input "INT-ANGLE: ",I
Input "LENGTH: ",L
Input "DEGREE: ",D
L*D/200→Z
100/(D*π/180)→R
Zπ/180→Q
L(1-Q²/10)→X
L(Q/3-Q³/43)→Y
X-R sin(Z)→K
Y-R (1-cos(Z))→P
(R+P) tan(I/2)+K→T
Y/sin(Z)→S
Disp "ANGLE TS-SC:",Z,"RADIUS:",R
Pause
A-iPart(0.01T)→U
B-100 fPart(0.01T)→V
Disp "TS:",U,"+",V
Pause
Disp "SC:",U+iPart(0.01L),"+",V+100 fPart(0.01L)
Pause
Disp "ST:",S

Casio fx-5800P Program HWYSPIRAL

Deg
"HIGHWAY SPIRAL"
"PI X: "?→A
"PI Y: "?→B
"INT-ANGLE: "?→I
"LENGTH: "?→L
"DEGREE: "?→D
L*D÷200→Z
100÷(D*π÷180)→R
Z*π÷180→Q
L*(1-Q²÷10)→X
L*(Q÷3-Q^(3)÷43)→Y
X-R sin(Z)→K
Y-R (1-cos(Z))→P
(R+P) tan(I÷2)+K→T
Y÷sin(Z)→S
"ANGLE TS-SC:"
Z⊿
"RADIUS:"
R⊿
A-Int(0.01T)→U
B-100 Frac(0.01T)→V
"TS X:"
U⊿
"TS Y:"
V⊿
"SC X:"
U+Int(0.01L)⊿
"SC Y:"
V+100 Frac(0.01L)⊿
"ST:"
S

Example

A highway with a transition spiral is at station 50 + 64.84, with the intersection angle 50°, and the degree of the curve at 6°.  The length of the curve is said to be 360 ft.

Inputs:

PI X = 50
PI Y = 64.84
INT-ANGLE = 50
LENGTH = 360
DEGREE = 6

Outputs:

ANGLE TS-SC = 10.8
RADIUS = 954.9296586
TS:  (X + Y) = 44 + 37.12990632
SC:  (X + Y) = 47 + 97.12990632
ST = 120.4143341

Source:

Hicks, Tyler P.E.  Handbook of Civil Engineering Calculations McGraw Hill: New York.  2000  ISBN 0-07-028814-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, September 8, 2019

TI-84 Plus CE and Casio fx-5800P: Lateral Pressure of Cohesionless Soils

TI-84 Plus CE and Casio fx-5800P:  Lateral Pressure of Cohesionless Soils

Introduction

The following equations calculates the total thrust of soil against a wall.  The soil is assumed to be cohesionless, free running soil.  This applies to soils like sand and gravel, but not clay.

SI units (meters, seconds, kilograms) are assumed in these calculations.

Inputs:

Φ = angle of internal friction of soil.  For cohesionless soils, such as medium and coarse sands, the angle of internal friction typically ranges from 30° to 35°.  The program assigns Φ to the variable I.

H = the height of the wall (m).

γ = unit weight of soil (kg/m^3).  The program assigns γ to W.

Outputs:

K_A = pressure coefficient (unit-less).  The program assigns K_A to K.

P = total thrust of the soil (kg/m) of the wall.

Equations:

K_A = (tan(45° - Φ/2))^2

P = 1/2 * γ * H^2 * K_A  (kg/m)

TI-84 Plus CE Program SOILPRES

(this program needs to be typed in)

Degree
Disp "LATERAL PRESSURE","SAND/GRAVEL","ANGLE INTERNAL"
Input "FRICTION: ",I
tan(45-I/2)²→K
Disp "WALL HEIGHT"
Input "(M): ",H
Disp "SOIL WEIGHT"
Input "(KG/M³): ",W
0.5*W*H²*K→P
Disp "PRESSURE COEF: ",K,"SOIL THRUST: ",P

Casio fx-5800P Program SOILPRESSURE

Deg
"LATERAL PRESSURE"
"SAND OR GRAVEL"
"ANGLE INTERAL"
"FRICTION: "?→I
(tan(45-I÷2))²→K
"WALL HEIGHT"
"(M): "?→H
"SOIL HEIGHT"
"(KG÷M^(3)): "?→W
0.5*W*H²*K→P
"PRESSURE COEF:"
K⊿
"SOIL THRUST:"
P

Example

Input:
Φ = I = 37°
H = 15 m
γ = W = 0.64 kg/m^3

Output:

K_A = K = 0.2485836199
P = 17.89802063 (kg/m)

Source:

Hicks, Tyler P.E.  Civil Engineering Formulas 2nd Ed.   McGraw Hill: New York.  2000.   ISBN 978-0-07-161470-2

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, January 2, 2019

HP Prime and Casio fx-5800p: Rational Binomial Coefficients

HP Prime and Casio fx-5800p:  Rational Binomial Coefficients

Introduction

Let p be a rational fraction, p = num/dem.  The rational binomial coefficients of order n are defined by:

B_0(p) = 1

B_n(p) = COMB(p, n) = ( p * (p - 1) * (p - 2) * (p - 3) * ... * (p - n + 1) ) / n!

There are algorithms, but the program RATBIN uses the definition. 

HP Prime Program RATBIN

Arguments:  rational fraction, order

EXPORT RATBIN(p,n)
BEGIN
// 2018-12-26 EWS
// p-q, n
// Rational Binomial Coefficient
LOCAL X;
IF n==0 THEN
RETURN 1;
ELSE
IF n==1 THEN
RETURN p;
ELSE
RETURN QPI(ΠLIST(p-MAKELIST(X,X,0,n-1))/n!);
END;
END;
END;

* Note: the result is not always a fraction, but you can convert the answer to fraction by pressing [ a b/c ]

Casio fx-5800p Program RATBIN

For fractional results, use the fraction button [  []/[] ].

"2018-12-26 EWS"
"FRACTION"? → P
"ORDER?" → N
If N=0
Then
0
IfEnd
If N=1
Then
1
IfEnd
If N>1
Then
Prod (P-Seq(X,X,0,N-1,1)) ÷ N! → Q
Q
IfEnd

Examples

b_2(1/2) = -1/8

b_3(1/2) = 1/16

b_4(1/2) = -5/128

b_5(1/2) = 7/256

Source:

Henrici, Peter.  Computational Analysis With the HP-25 Calculator  A Wiley-Interscience Publication. John Wiley & Sons: New York 1977 .  ISBN 0-471-02938-6

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.  Please contact the author if you have questions.

Sunday, December 23, 2018

Casio fx-5800p and HP Prime: American Wire Gauge (AWB)

Casio fx-5800p and HP Prime:  American Wire Gauge (AWB)

Everyone, I wish you all a Happy Holiday season, Merry Christmas and Happy New Year!  I'm thankful for all of you.  Wishing you the best!  - Eddie

Introduction

The following formula calculates the diameter of an American Wire Gauge:

d = 460 / (92^((3 + g)/39))  (in mils)

where g is the wire number (integer).

Define g as:
Wire number:  0000000,  g = -6
Wire number:  000000,  g = -5
Wire number:  00000, g = -4
Wire number:  0000, g = -3
Wire number:  000, g = -2
Wire number:  00, g = -1
Wire number:  0, g = 0
Any other wire number, enter g as the wire number (1, 2, 3, 4, etc.)

Conversion factor:  1000 mils = 1 in

Cross area of the wire:

a = d^2

Casio fx-5800p Program WIRES

Given the wire number, the program WIRES returns the diameter of the wire in inches and the cross sectional area in square inches.

"WIRE NUMBER: "? → G
460 ÷ (92 ^((3 + G) ÷ 39)) → D
D ÷ 1000 → D
D^2 → A
"DIAMETER: (IN)" ⊿
D ⊿
"CROSS AREA:  (IN^2)" ⊿


HP Prime Program Function AWB

Given the wire number, the function AWB returns the diameter of the wire in inches. 

EXPORT AWG(g)
BEGIN
// American Wire Gauge Diameter Function
// 2018-12-23 EWS
// in inches
RETURN (460/(92^((3+g)/39)))/1000;
END;

Examples:

g = -2  (000);  d ≈ 0.4096 in, a ≈ 0.1678 in^2
g = 3; d ≈ 0.2294 in, a ≈ 0.0526 in^2
g = 6; d ≈ 0.1620 in, a ≈ 0.0263 in^2


Sources: 

Ball, John A.  Algorithms For RPN Calculators  John Wiley & Sons: New York  1978.  ISBN 0-471-03070-8

Glover, Thomas J.  Pocket Ref 4th Edition. Sequoia Publishing, Inc.:  Littleton, CO  2012.  ISBN 978-1-885071-62-0

Eddie

All original content copyright, © 2011-2018.  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.  Please contact the author if you have questions.

Thursday, February 22, 2018

HP Prime and Casio fx-5800P: The Two Train Problem (updated 2/26/2018)

HP Prime and Casio fx-5800P:  The Two Train Problem
(updated 2/28/2018)

Introduction

Have you ever heard the infamous problem “two trains are heading towards each other…”? 

Today’s blog will cover the following question:

Two trains are heading towards each other, on their own separate train track.  Each train has going at their own speed (velocity).  The trains start out a distance apart.

1. When will the trains cross over the same spot, and


2. Where will the trains cross over the same spot?




According to the diagram above, we have two trains, labeled Train I and Train II, each going at velocity v and acceleration a.  The trains start at distance D apart.  We will call the point where the trains cross over the same spot, x. 

Notes:

1. To make our lives easier, let’s assume that Train I starts at position 0, while Train II starts at position D. 

2. Train I is going at velocity v and acceleration a. 

3. Train II is going at velocity –v and acceleration –a. Why negative?  Train II is traveling in the opposite direction of Train I.

Setting up the Equations

The general distance equation is:  x = x0 + v*t + a*t^2, where x0 is the initial position.

We are going to cover two scenarios:  one where there is no acceleration, that is the velocity of both trains is constant.  The other is where acceleration is present for at least one of the trains.  Acceleration is assumed to be constant. 

In general the distance equations for both trains are:

Train I:  x =        v1*t + 1/2*a1*t^2
Train II: x = D  - v2*t -  1/2*a2*t^2

What this boils down to are a system of two equations, solving for both t and x.

Case 1:  Constant Velocity

The trains are moving at constant velocity in this scenario.  Which means there is no acceleration, and hence a1 = 0 and a2 = 0.  Then:

Train I:  x =        v1*t
Train II: x = D -  v2*t

Subtracting equations gives us:

0 = -D + v1*t – -v2*t
0 = -D + (v1 + v2)*t
D = (v1 + v2)*t
t = D/(v1 + v2)

Once t is known, we can use substitution to find x.  Train I’s equation is simpler, so:

x = v1*t

Case 2:  Non-Zero Acceleration

Start with:

Train I:  x =        v1*t + 1/2*a1*t^2
Train II: x = D  - v2*t -  1/2*a2*t^2

Subtracting the equations and solving for t yields:

0 = -D + v1*t – -v2*t + 1/2*a1*t^2 - -1/2*a2*t^2
0 = -D + (v1 + v2)*t + 1/2*(a1 + a2)*t^2

Using the quadratic equation:

t = ( -(v1+v2) ± √( (v1+v2)^2 + 4*D*1/2*(a1+a2)) ) / (2*1/2*(a1 + a2))
t = ( -(v1+v2) ± √( (v1+v2)^2 + 2*D*(a1+a2)) ) / (a1 + a2)


Note that there are two roots for t.  However, given the problem, negative time does not make sense.  We can eliminate the root for t that is obviously negative.

Hence, our solution for time in this problem is:

t = ( -(v1+v2) + √( (v1+v2)^2 + 2*D*(a1+a2)) ) / (a1 + a2)

Again, we are going to use the simpler equation for Train I to figure x:

x = v1*t + a1*t^2

The Program TRAINS

The program TRAINS will solve this problem.  Below are the codes for both the HP Prime and Casio fx-5800p.  Enter each as a positive value as the directions are accounted for in the program.

In the program, Train I is considered the left train, while Train II is considered the right train.

HP Prime Program: TRAINS

EXPORT TRAINS()
BEGIN
// 2018-02-22 EWS
// 2 trains problem

LOCAL d,t,x;
LOCAL v1,a1,v2,a2;

INPUT({d,v1,a1,v2,a2},
"Two Opposing Trains",
{"Dist:","L Vel:","L Acc:",
"R Vel:","R Acc:"},
{"Distance between trains",
"Left Train: Velocity",
"Left Train: Acceleration",
"Right Train: Velocity",
"Right Train: Acceleration"});

// calculation
IF a1≠0 OR a2≠0 THEN
t:=(−(v1+v2)+√((v1+v2)^2+
2*d*(a1+a2)))/(a1+a2);
x:=v1*t+1/2*a1*t^2;
ELSE
t:=d/(v1+v2);
x:=v1*t;
END;

// results
RETURN {"Time",t,
"Position",x};


END;

Casio fx-5800P Program: TRAINS

“EWS 2018-02-22”
“DISTANCE”?→D
“LEFT-VEL.”?→A
“LEFT-ACC.”?→E
“RIGHT-VEL.”?→B
“RIGHT-ACC.”?→F
If E≠0 Or F≠0
Then
(-(A+B)+√((A+B)^2
+2*D*(E+F)))÷
(E+F)→T
A*T+1/2*E*T^2→X
Else
D÷(A+B)→T
A*T→X
IfEnd
“TIME:”
T
“POSITION:”
X

Examples

Assume compatible units for each example.

Example 1:  Constant Velocity
Train I:  v1 = 40 (a1 = 0)
Train II: v2 = 35 (a2 = 0)
Distance:  300

Results:
Time:  4
Position:  160

Example 2:  Acceleration
Train I:  v1 = 40, a1 = 0.5
Train II: v2 = 35, a2 = 0.8
Distance:  300

Results:
Time:  3.87018761454
Position:  158.552092625

Thank you to Gianfranco Cazzaro, Dieter, and all who wrote to me pointing out the errors.  

Eddie

This is blog is property of Edward Shore, 2018.


Wednesday, March 23, 2016

Casio fx-5800p: Barometric Formula

Casio fx-5800p: Barometric Formula

This program estimates the Barometric pressure at height H (given in meters).  This formula tends to work the best when H < 11000 m (approximately 36,089.24 feet).  

Formula:

P = P0 * e^(-g * H * M / (R * T))

Where:
P0 = static pressure, 101,325 Pa
g = Earth's Gravity, 9.80665 m/s^2
M = molar mass of air, 0.0289644 kg/mol
R = universal gas constant, about 8.31432 N*m/(mol*K)*
T = standard temperature at sea level, 288.15 K (15 °C)

The value of R varies.  The constant stored in the fx-5800p is 8.314472.  Since this program uses values from built in constants, this value is used.  

Access to the Constants:
[ FUNCTION ], 4: CONST and then:

Gas Constant R:
down, down, down, 3

Earth's Gravity:
down four times, 3

Standard atmospheric pressure, labeled atm:
down four times, 8

Program BAROMETRIC

For this text, constants are surrounded by single quotes (example: 'g')

"BEST UP TO 11000 M" ◢
"HEIGHT:"?→H
'atm' * e^( -'g' * H * 0.0289644 ÷ ( 'R' * 288.15 )) → P
"PRESSURE (PA):" ◢
P


At 11,000 m, the pressure is estimated to be 27,500.16552 Pa.  

Source:
"Barometric Formula" Wikipedia    https://en.m.wikipedia.org/wiki/Barometric_formula. Retrieved March 15, 2016


This blog is property of Edward Shore, 2016

Casio fx-5800p: Histogram

Casio fx-5800p: Histogram

The program HISTOGRAM draws a histogram for up to four data points using the Locate command.  The screen of the fx-5800p has 16 columns and 4 rows.   

When all four data points that are 15 or less, including 0, the histogram is exact.  If any data point exceeds 15, an approximate histogram is drawn as all the data points are normalized.  (Go to work with the limitations of the fx-5800p).  

Variables Used:
Data points: A, B, C, D
Normalized (if needed) data points: E, F, G, H
Sum: S = A + B + C + D



The example (shown above) shows a histogram with A = 10, B = 12, C = 13, D = 5

Program HISTOGRAM

Cls
"ENTER 4 PTS" ◢ 
"A"? → A : A → E
"B"? → B : B → F
"C"? → C: C → G
"D"? → D : D → H
A + B + C + D → S
If A > 15 Or B > 15 Or C > 15 Or D > 15
The 
Intg(E ÷ S * 15)→ E
Intg(F ÷ S * 15)→ F
Intg(G ÷ S * 15)→ G
Intg(H ÷ S * 15)→ H
IfEnd
"READY" ◢ 
Cls
For 1 → I To E
Locate I, 1, "A"
Next
For 1 → I To F
Locate I, 2, "B"
Next
For 1 → I To G
Locate I, 3, "C"
Next
For 1 → I To H
Locate I, 4, "D"
Next

This blog is property of Edward Shore, 2016 


Thursday, March 3, 2016

Casio fx-5800p: Complex Numbers Calculations: e^z, ln z, z^w

Casio fx-5800p:  Complex Numbers Calculations: e^z, ln z, z^w


Let z = a + bi = r*e^(θi) and w = c + di = s*e^(αi) where i = √-1

The complex mode of the Casio fx-5800p, and quite frankly, most graphing calculators of Casio have limited capabilities working with complex numbers, limited to arithmetic, and powers to real numbers only.  These three programs extend that functionality. 

Use Radian mode.

Complex Exponential Function

Calculation:  e^z = e^a * e^(yi) = e^a * (cos b + i*sin b)

The input is stored in Z, output is stored in X. 

Program EXPCOMPLX
“Z”? → Z
Rad
ReP(Z) → A
ImP(Z) → B
e^(A)*(cos(B)+i*sin(B))→X

Examples: 
e^(-6i) ≈ 0.9601702867 + 0.2794154982i
e^(5.25 + 3.75i) ≈ -156.3709348 – 108.9203077i

Complex Natural Logarithm Function

Calculation: ln z = ln r + iθ

Program LNCOMPLX
“Z”? → Z
Rad
Abs(Z) → R
Arg(Z) → T
ln(R) + iT → X

Examples:
ln(3 + 6i) ≈ 1.903331245 + 1.107148718i
ln(7i) ≈ 1.945910149 – 1.570796327i

Complex Power

Calculation: z^w = e^(w ln z)

Program POWCOMPLX
“Z^(W), Z”? → Z
Rad
Abs(Z) → R
Arg(Z) → T
ln(R) + iT → X
“W”? → W
WX → X
ReP(X) → A
ImP(X) → B
e^(A)*(cos(B) + i*sin(B)) → X

Examples:
(2 + 3i)^(-1 + i) ≈ 0.09917578259 + 0.03064399883i
(0.075 – 3i)^(0.2i) ≈ 1.3295102 + 0.2970040915i


This blog is property of Edward Shore - 2016

Wednesday, March 2, 2016

HP Prime and Casio fx-5800p Approximating the Factorial Function

HP Prime and Casio fx-5800p Approximating the Factorial Function

A quick way to estimate the factorial function, which is good for all real numbers (and complex numbers with the HP Prime) is determined by Gergő Nemes Ph. D (Mathematics, University of Edinburgh):

N! ≈ N^N * √(2*π*N) * e^(1/(12*N+2/(5*N+53/(42*N)))-N)

The error is the order of 1 + O(N^-8).   Like the Sterling approximation formula, this formula is a better approximation as N increases. 

Casio fx-5800p Program:  GERGO

“GERGO RSKEY.ORG”
“N”? → N
N^(N)*√(2πN)*e^(
1÷(12N+2÷(5N+53÷
(42N)))-N)

HP Prime:  GERGO

EXPORT GERGO(N)
BEGIN
// rskey.org 2016-03-02
RETURN N^N*√(2*N*π)*
e^(1/(12*N+2/(5*N+53/(42*N)))
-N);
END;

How accurate is it?

Here a test of some random values to compare accuracy.

Values

N
N! (Determined by Wolfram Alpha)
N! approximation
1.25
1.13300309631…
1.133039736
3.08
6.64025496878…
6.640255733
5
120
120.0000005
6.64
2460.94013688180…
2460.940138
8.27
72172.53628421024…
72172.53629
11.5
1.368433654655… x 10^8
136843365.5

Source:

“Sterling’s Approximation”  Wikipedia – Page February 26, 2016 https://en.wikipedia.org/wiki/Stirling%27s_approximation#cite_note-Nemes2010-10 Retrieved March 1, 2016


Toth, Viktor T.  “The Gamma Function”  R/S Programmable Calculators  http://www.rskey.org/CMS/the-library?id=11  Retrieved March 1, 2016

Monday, February 29, 2016

Quick Tricks: Casio Programming Calculators and webcal.freetzi.com

Quick Tricks:  Casio Programming Calculators and webcal.freetzi.com

 I spent the last week learning how the Casio fx-3650p can be programmed to execute amazing calculations.  The reason why I say amazing is that on the surface, the fx-3650p is limited, both in programming space (360 bytes allocated on 4 program slots) and the number of variables (7: A, B, C, D, X, Y, M).  Please check out the WebCal Page Counting Machine, run by David Chuek: 


The website is in Chinese (I believe) and I am grateful for Google Translate because I am not proficient in Chinese. 

On this page advanced programs for the fx-3650p including:

* Gamma Function, Elliptic Functions (for x<1), Beta, Zeta, and other special functions
* Determinant of a 3 x 3 Matrix
* Squaring a square matrix
* 4 and 8 point Fast Fourier Transform
* Geometry:  Distance from a point to a line, area from a set of vertices
* Prime Factorization
* Engineering Programs: Snell’s Laws, Prism, Ohm’s law
* Days between Dates, Day of the Week

If you have a Casio programming calculator, check this awesome website out.

While I was learning to code the programs myself, I notice there were several tricks that were used to save space.  I want to test the tricks for the Casio fx-5800p and Casio fx-9860GII (Linear Input Mode).   The case for the fx-9860GII should be the same for other modern Casio graphing calculators (9750g, Prizm). 

Quickly Setting X = 1 and Y = 0

Syntax:  Pol(1,0)
Calculators:   fx-3650p only

Note:  Pol(1,0) sets I to 1 and J to 0 for the fx-5800p.

The Power of Implied Multiplication

Most Casio programming calculators have only single-letter variables, which allows for implied multiplication.  For example, typing AB multiples the values stored in A and B.  In the examples listed below, I use variables A and B, but it applies to all the other variables. 

Implied Multiplication and Square Root

Syntax:  √AB
What it calculates:  √(A*B)
Calculators: fx-3650p, fx-5800p, fx-9860GII

Example:  A = 5, B = 10;  √AB returns 7.071067812  (√50)

Implied Multiplication and Powers

Syntax:  n^AB
What it Calculates:  (n^A)*B
Calculators: fx-3650p, fx-9860GII (linear input only)

Example:  2^AB where A = 5, B = 10;  2^AB returns 320   (2^5*10)

The Jump Function Shortcuts

If the Expression is Nonzero

Syntax:  (var/expression) ⇒ (execute this statement of var/expression ≠  0) : (next command)
The next command must exist or an error occurs

Calculators:  fx-3650p, fx-5800p, fx-9860GII

Example: Ask for A and B.  Divide A by B, unless B is 0. 
Prog2
? → A: ? → B: B ⇒ A ÷ B: Ans

A = 13.5, B = 2.7, result is 5
A = 13.5, B = 0, result is whatever is last stored in Ans

Using the Jump Function to create an AND condition

Connecting two or more jump functions (⇒) to create an AND condition. 

Syntax – 2 Conditions:
(condition 1) ⇒ (condition 2) ⇒ (do if conditions 1 and 2 are true) : (next command)

Syntax – 3 Conditions:
(cond 1) ⇒ (cond 2) ⇒ (cond 3) ⇒ (do if all three conditions are 3) : (next command)
  
Example: Calculate the eccentricity of an ellipse, assuming A ≥ B.  If anything improper is entered, -1 is returned.

Prog3
? → A: ? → B: -1 → C: A ≥ B ⇒ A > 0 ⇒ B > 0 ⇒ √(1 – B2/A2 → C: C

A = 11.5, B = 3.6, result 0.949738796
A = 6, B = 8, result -1
A = -2, B = 1, result -1

Independent Memory

M+:  Calculate the expression, add to M and store the result to M
M-:  Calculate the expression, subtract from M and store the result to M

Syntax:  (expression) M+,  (expression) M-
Calculators: fx-3650p, fx-5800p. 
Note:  This should work on any Casio calculator with M+ and M- available on the keyboard.

Example: 
Store 7 in M.  
3^2 + 4 M+ returns 13 in the display, with M = 20
2^3 – 1 M- returns in the display, with M = 13

Absolute Value

Does you calculator not have an absolute value function?  Try this trick:

Syntax: √A2
What it calculates:  |A|
Calculators:  fx-3650p, fx-5800p, fx-9860GII

Examples:  A = 55, B = -55
√A2 returns 55
√B2 returns 55

Extracting the Integer Part of a Number when the Function Int/Intg is not available

Two ways to do it:
* Syntax:  Fix 0:  Rnd:  Norm 1
* Syntax:  Switch the fx-3650p to Base Mode, 3 for Decimal, then enter your program

The Last Answer (Ans) skips over a prompt

Syntax:  (calculation):  ? → var:  f(Ans)
Calculators: fx-3650p, fx-5800p, fx-9860GII

Example:  Calculate 5^1.5, ask for A, and add it to 5^1.5
Prog1
5^1.5 : ? → A:  Ans + A
Let A = 2, the result is 13.18033989
Let A = 9.75, the result is 20.93033989


Happy Leap Year Day!   Talk to you next time,

Eddie


This blog is property of Edward Shore.  2016


Python – Earth’s Radius and Gravity in US Units

Python – Earth’s Radius and Gravity in US Units Introduction The following script, gravus2.py, estimates the Earth’s gravity i...