Showing posts with label Casio fx-3900Pv. Show all posts
Showing posts with label Casio fx-3900Pv. Show all posts

Saturday, May 3, 2025

Casio fx-3900Pv: Linear System, Poisson Kernel, Normal Distribution, 3 x 3 Matrix Determinant

Casio fx-3900Pv: Linear System, Poisson Kernel, Normal Distribution, 3 x 3 Matrix Determinant


Today, we feature four programs for the classic Casio fx-3900Pv calculator. The fx-3900Pv has 300 steps.


My review from 2023: https://edspi31415.blogspot.com/2023/05/retro-review-casio-fx-3900pv.html


One of the great features of the early “inexpensive” algebraic keystroke programmable calculators (1980s) is that the programs can be seen and edited.


The programs listed will require inputs to be stored in to the memory registers prior to running the program by using the [ Kin ] key.



Casio fx-3900Pv: 2 x 2 Systems


This program solves 2 x 2 linear systems. The Constant memory registers (K1 – K6) are mapped as follows:


K4 * x + K5 * y = K6

K1 * x + K2 * y = K3


The equations are solved as follows:

x = (K2 * K6 – K5 * K3) / M

y = (-K1 * K6 + K4 * K3) / M

where M = (K4 * K2 – K1 * K5)


This program takes 36 steps.


Code:

Kout 4 (determinant)

×

Kout 2

-

Kout 1

×

Kout 5

=

Min

HLT (Pause program, shows determinant. We want a nonzero-determinant.)


(

Kout 2

×

Kout 6

-

Kout 5

×

Kout 3

)

÷

MR

=

HLT (Solve for x)


(

Kout 1

+/-

×

Kout 6

+

Kout 4

×

Kout 3

)

÷

MR

= (Solve for y)


Examples


Example 1

x – y = 5

x + 3 * y = 9


Store the parameters: 1 Kin 4, -1 Kin 5, 5 Kin 6; 1 Kin 1, 3 Kin 2, 9 Kin 3

Results: det = 4, x = 6, y = 1


Example 2

3 * x + 16 * y = 49

5 * x – 2 * y = 22


Store the parameters: 3 Kin 4, 16 Kin 5, 49 Kin 6; 5 Kin 1, -2 Kin 2, 22 Kin 3

Results: det = -86, x = 5.23255814, y = 2.081395349



Casio fx-3900Pv: Poisson Kernel


The program calculates the kernel using the formula:


Pr(θ) = (1 – r^2) / (1 – 2 * r * cos θ + r^2),

0 ≤ r < 1, -π < θ ≤ π


This program takes 22 steps.


Store r in register 1, θ in register 2.


Code:

Rad (Mode 5)

(

1

-

Kout 1

x^2

)

÷

(

1

-

2

×

Kout 1

×

Kout 2

cos

+

Kout 1

x^2

)

=


Examples


Example 1:

r = 0.5, θ = 2.1

0.5 Kin 1, 2.1 Kin 2

Result: 0.4273879049


Example 2:

r = 0.268, θ = 0.842

0.268 Kin 1, 0.842 Kin 2

Result: 1.298397221


Source:

“Poisson Kernel” Wikipedia. May 28, 2024. https://en.wikipedia.org/wiki/Poisson_kernel

Retrieved November 26, 2024


Casio fx-3900Pv: Normal Distribution (Integration)


The program, which is ran in Integration Mode (Mode 1):


∫( e^(-t^2 / 2) / √(2 * π) dt, a, b)


To calculate, really approximate the integral:

MODE 1 P#

Store a level n (1-9), SHIFT RUN

Lower limit RUN

Upper limit RUN


The level n corresponds to the integration intervals 2^n. The higher n is, the longer the calculation takes but the accurate the integral is.


The integrated variable is stored in memory M. Start the function using Min.


Code:

Min

(

MR

x^2

+/-

÷

2

)

e^x

÷

(

2

×

π

)

=


Examples


The following examples will use n = 4.


Example 1: lower limit = 0, upper limit = 3. Result: 0.49865

(actual ≈ 0.4986501019)


Example 2: lower limit = -1, upper limit = 1. Result: 0.6827

(actual ≈ 0.6826894921)


Example 3: lower limit = -2, upper limit = 1.5. Result: 0.910443

(actual ≈ 0.910 4426667)



Casio fx-3900Pv: 3 x 3 Determinant


This program calculates the determinant of a 3 x 3 matrix. How are we to do this with only seven memory registers?


The program sets the matrix as:


[ [ 1st input, 2nd input, 3rd input ] [ K4, K5, K6 ], [ K1, K2, K3 ] ]


The user will be stop execution three times. At each time, enter the element corresponding to the top row.


For example:


[ [ 1, 2, 3 ] [ 4, 5, 6 ] [ 7, 8, 9 ] ]


Store 4 in K4, 5 in K5, 6 in K6; 7 in K1, 8 in K2, 9 in K3. While running, enter 1, 2, then 3 during program execution.


The determinant is stored to memory M. This program takes 40 steps.


Code:

(

Kout 5

×

Kout 3

-

Kout 2

×

Kout 6

)

×

ENT # (enter a legitimate number to continue, prompt for row 1, column 1)

=

Min


(

Kout 4

×

Kout 3

-

Kout 6

×

Kout 1

)

×

ENT # (prompt for row 1, column 2)

=

M-


(

Kout 4

×

Kout 2

-

Kout 5

×

Kout 1

)

×

ENT # (prompt for row 1, column 3)

=

M+


MR


Examples


Example 1:

[ [ 1, 5, 6 ] [ 2, 7, 8 ] [ 11, 4, 3 ] ]


Store:

(2nd row) 2 Kin 4, 7 Kin 5, 8 Kin 6

(3rd row) 11 Kin 1, 4 Kin 2, 3 Kin 3

Run the program (P1-P4): 1 RUN, 5 RUN, 6 RUN

Result: -15


Example 2:

[ [ -3, 0, 9 ] [ 0 , -3, 9 ] [ 9, -3, 0 ] ]


Store:

(2nd row) 0 Kin 4, -3 Kin 5, 9 Kin 6

(3rd row) 9 Kin 1, -3 Kin 2, 0 Kin 3

Run the program (P1-P4): -3 RUN, 0 RUN, 9 RUN

Result: 162


Until next time,


Eddie


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

Casio fx-3900PV: Program Bank

Casio fx-3900PV:  Program Bank



Here are a few programs for the Casio fx-3900Pv.  These programs should also work on the fx-3600P/fx-180P series (as long as the number of steps is less than 38) except that we can review and edit the steps on the fx-3900Pv.   See my review of the fx-3900Pv here:  


http://edspi31415.blogspot.com/2023/05/retro-review-casio-fx-3900pv.html



Error Function


The program allows the you to calculate the error function:


erf(b) = ∫( 2 * e^(-x²) ÷ √θ dx, x = 0, x = b)


Code:


001   Min

002   MR

003   x²

004   +/-

005   eˣ

006   ×

007   2

008   ÷

009   π

010   √

011   =



To calculate the erf(b):  run integral mode (Mode 1).  Select the program, enter n to get 2^n divisions by pressing [SHIFT] [RUN].   Next, enter 0 [RUN], then b [RUN].


Examples:  n = 6,  (2^6 = 64 divisions)


erf(1.5):

a = 0,  b = 1.5,  Result:  9.661051 * 10^-1


erf(0.4):

a = 0, b = 0.4,  Result:  4.28392 * 10^-1


erf(3.9):

a = 0, b = 3.9,  Result:  9.9999997 * 10^-1




Range and Height of a No-Air Projectile


R = v^2 * sin(2 * θ) ÷ g


H = v^2 * sin^2 θ ÷ (2 * g)


where:

R = range of the projectile (m)

H = maximum height of the projectile (m)

v = initial velocity (m/s)

θ = angle in degrees

g = Earth's gravity = 9.80665 m/s^2


Inputs:

K1 = v

K2 = θ


Outputs:

K3 = R

K4 = H


Used:

K5 = g


Code:


001   DEG  ( MODE 4 )

002   9

003   .

004   8

005   0

006   6

007   6

008   5

009   Kin 5

010   Kout 1

011   x²

012   ÷

013   Kout 5

014   ×

015   (

016   2

017   ×

018   Kout 2

019   )

020   SIN

021   =

022   Kin 3

023   HLT

024   Kout 1

025   x²

026   ×

027   Kout 2

028   SIN

029   x²

030   ÷

031   2

032   ÷

033   Kout 5

034   =

035   Kout 4


Examples:


Inputs:  K1 = 11.9 m/s,  K2 = 40°

Outputs:

R = 14.22082219 m

H = 2.98317166312 m


Inputs:  K1 = 11.9 m/s,  K2 = 60°

Outputs:

R = 12.0558115 m

H = 5.415075484 m

   


Magnitude and Phase of a LCR Series Circuit


Z = √(R² + (w * L - 1 ÷ (w * C))² )


θ = arctan((w * L - 1 ÷ (w * C)) ÷ R)


where:

Z = magnitude (Ω)

θ = phase angle (degrees)

R = resistance (Ω)

L = inductance (H)

C = capacitance (F)

w = angular frequency, where w = 2 * π * f

f = frequency


Inputs:  R, f, C, L

M = f  

K2 = L

K3 = R

K4 = C


Outputs:

K1 = w

K5 = Z

K6 = θ


Note that the source (see Source section below) omitted the square root in the formula for Z.  The above formula is correct.


Code:


001   DEG    (Mode 4)

002   MR

003   Kin 1

004   2

005   Kin× 1   (shown as K×1)

006   π

007   Kin× 1    (shown as K×1)

008   Kout 1

009   ×

010   Kout 2

011   -

012   (

013   Kout 1

014   ×

015   Kout 4

016   )

017   1/x

018   =

019   Kin 6

020   Kout 3

021   x²

022   +

023   Kout 6

024   x²

025   =

026   √

027   Kin 5

028   HLT

029   (

030   Kout 6

031   ÷

032   Kout 3

033   )

034   tan⁻¹

035   =

036   Kin 6



Example:


Inputs:

f = 100 Hz,  [ Min ]

L = 4 * 10^-3 H  (store in K2)

R = 6300 Ω  (store in K3)

C =  5 * 10^-6 F  (store in K4)

Outputs:

Z = 6307.909915 Ω  (K5)

θ = -2.869631956° (K6)



Quadratic Equations:  Real Roots


Solve the equation: 


x^2 + K1 * x + K2 = 0


The roots are:


x = (-K1 ± √(K1^2 - 4 * K2)) ÷ 2


Inputs:

K1 = coefficient of x

K2 = constant


Outputs:

K4 = root 1

K5 = root 2


Used:  K3 = √(K1^2 - 4 * K2)


Code:


001    (

002    Kout 1

003    x²

004    -

005    4    

006    ×

007    Kout 2

008    )

009    √

010    Kin 3

011    (

012    Kout 3

013    +/-

014    -

015    Kout 1

016    )

017    ÷

018    2

019    =

020    Kin 4

021    HLT

022    +

023    Kout 3

024    =

025    Kin 5



Example:


Solve x^2 - 19 * x + 10 = 0

Inputs:

K1 = -19

K2 = 90

Outputs:  9, 10



Source 

(for Range and Height of a No-Air Projectile and Magnitude and Phase of a LCR Series Circuit):


Rosenstein, Morton.   Computing With the Scientific Calculator.  Casio.  1986



Enjoy,


Eddie 


All original content copyright, © 2011-2023.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


RPN: DM32 and DM42: Stopping Sight Distance (Metric)

RPN: DM32 and DM42: Stopping Sight Distance (Metric) The Stopping Sight Distance Formula – Derivation The stopping sight di...