Showing posts with label special functions. Show all posts
Showing posts with label special functions. Show all posts

Tuesday, March 14, 2023

Casio Classpad (fx-CP400): Collection of Functions

Casio Classpad  (fx-CP400):  Collection of Functions



For my birthday post, on Pi (π) Day (March 14), here is a collection of functions for the Casio Classpad (300, 330, fx-CP400, fx-CP500). 



Birthday Probability Function:   bday(c,n)


"The probability that a number in a room do not share a same birthday"

c:  number of categories (i.e. days in a year)

n:  population size


Example:

bday(365, 40):  0.1087681902



Percent Change:  pchg(old, new)


old:  old amount

new:  new amount


Example:

pchg(400,500):  25



Combination with Repetition:  nHr(n,r)


n:  population

r:  number of objects to pick


Example:

nHr(52,5):  3819816



Error Function and Error Compliment Function


Error Function:   erf(x)

Error Compliment Function:  erfc(x)


Note that erf(x) + erfc(x) = 1


Example:

erf(0.60):  0.6038560908

erfc(0.60):  0.3961439092



Law of Cosines


a^2 = b^2 + c^2 - 2*b*c*cos(α)


Finding the Angle α:  cosang(a,b,c)

Finding the Side a:  cosside(b,c,α)


Example:

(Degrees Mode)

a = 20.1, b = 18.5, c = 22.3:  cosang(20.1,18.5,22.3):  58.13961834°  (approx)

b = 24.2, c = 18.9, α = 58°:  cosside(24.2,18.9,58):  21.4032954 (approx)



Fresnel Integrals


Fresnel Cosine Integral:  frescos(u)

C(u) = ∫( cos(π * x^2 ÷ 2) dx, 0, u)


Fresnel Sine Integral:  fressin(u)

S(u) = ∫( sin(π * x^2 ÷ 2) dx, 0, u)


Example:

frescos(1.5):  0.445261176

fressin(1.5):  0.6975049601



Bessel Integral of the First Kind:  bessel(n,x)


J_n(x) = 1 / π * ∫( cos(n * t - x * sin t) dt, 0, π)


Example:

bessel(0,1.5):  0.5118276716

bessel(2,1.2):  0.1593490183



Elliptic Integral of the First Kind:  ellip(x)


K(x) = ∫( 1/ √(1 - x^2 * sin^2 t) dt, 0, π/2)


Example:

ellip(-0.6):  1.750753803

ellip(0.4):  1.639999866



Sine Integral:  Si(x)


Si(x) = ∫( sin t / t dt, 0, x)


Example:

Si(1.8):  1.50581678

Si(6):  1.424687551



Beta Function:  beta(a,b)


β(a, b) = (Γ(a) * Γ(b)) ÷ Γ(a+b)


Example:

beta(2,3): 1/12

beta(1.9,4.6):  0.04470413922 (approx)



Relativity Factor:  relat(v)


factor = √(1 - v^2/c^2)

c = 299792458 m/s

v = velocity


Example:

relat(201E6):  0.7419422153  (approx)



Schwarzschild Radius:  schwarz(m)


r = (2 * G * m)/c^2

G = 6.674E-11  m^3/(kg s^2)

c = 299792458 m/s

m = mass the black hole, kg

r = Schwarzschild Radius, m  (event horizon)


Example:

schwarz(7.89E30):  11717.95418



Distance of a Drop:  dropdist(v0,t)


v0:  initial velocity, m/s

t: time, s

Calculated:  distance, m


Example:

dropdist(15,5):  197.583125



Cycle of a Simple Pendulum:  pendu(l)


l:  length of a string, m

Calulated:  time of the pendulum swing, s


Example:  

pendu(5.5):  4.705446883



Impedance in LRC Series Circuit:  lrcser(R,f,L,C)


R:  resistance, Ω

f:  frequency, Hz

L:  inductance, H

C:  capacity, F


Example:

lrcser(4,80,0.1,50E-6):  11.21437564


Impedance in LRC Parallel Circuit:  lrcpar(R,f,L,C)


R:  resistance, Ω

f:  frequency, Hz

L:  inductance, H

C:  capacity, F


Example:

lrcpar(4,80,0.1,50E-6):  3.999122191



Source for:

Distance of a Drop

Cycle of a Simple Pendulum

Impedance in LRC Series Circuit

Impedance in LRC Parallel Circuit


Scientific Calculator 128 fx-1000F/fx-5000F Owner's Manual.   Casio.  Tokyo, Japan. 



Download the file here:  https://drive.google.com/file/d/1M54HlJ9dP95VBEmGzkUozGzJxKGpiHMh/view?usp=share_link



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. 


Friday, December 22, 2017

HP Prime and TI-84 Plus CE: Digamma Function

HP Prime and TI-84 Plus CE: Digamma Function

Calculation

The HP Prime and TI-84 Plus CE program DIGAM ( ψ  ) calculates the digamma function for any positive integers and multiples of 1/2 (such as 3/2, 5/2, 7/2,etc) using the formulas:

ψ(1/2) = -γ – ln 4 = -1.963510026

ψ(1) = -γ = -0.5772156649

ψ(n) = Σ(1/x, x, 1, n-1) - γ for n is an integer

ψ(n) = Σ(2/(2*x+1), x, 0, n-3/2) - γ – ln 4 for n a multiple of 1/2 for the form p/2, p is odd

where γ = 0.577215664901533 (Euler-Mascheroni constant)

HP Prime Program DIGAM

EXPORT DIGAM(N)
BEGIN
// EWS 2017-12-17
LOCAL K,D,E:=0.577215664901533;
CASE
IF N==1 THEN
RETURN −E; END;
IF N==0.5 THEN
RETURN −E-LN(4); END;
IF FP(N)==0 AND N>1 THEN
RETURN Σ(1/K,K,1,N-1)-E; END;
IF FP(N)==0.5 AND N>1 THEN
RETURN Σ(2/(2*K+1),K,0,N-3/2)-E-LN(4); END;
DEFAULT RETURN "Error: Invalid N";
END;
END;

TI-84 Plus CE Program DIGAM

"DIGAMMA 2017-12-17 EWS"
0.577215664901533→E
0→K
Input "N?",N
If fPart(N)≠0 and fPart(N)≠0.5
Then
Disp "INVALID N"
Stop
End
If N=1
Then
­E→D
End
If fPart(N)=0 and N>1
Then
Σ(1/K,K,1,N-1)-E→D
End
If N=0.5
Then
­E-ln(4)→D
End
If fPart(N)=0.5 and N>1
Then
Σ(2/(2*K+1),K,0,N-1.5)-E-ln(4)→D
End
Disp D

Examples

DIGAM(2) = 0.422784335098
DIGAM(3) = 0.922784335098
DIGAM(4) = 1.25611766843

DIGAM(3/2) = 0.03648997398
DIGAM(5/2) = 0.70315664065
DIGAM(7/2) = 1.10315664065

Source:
Keith Oldham, Jan Myland, & Jerome Spainer.  An Atlas of Functions.  2nd Edition.  Springer: New York.  2009  ISBN 13: 978-0-387-48806-6

Eddie


This blog is property of Edward Shore, 2017

Wednesday, November 29, 2017

Casio fx-5800p Special Functions

Casio fx-5800p Special Functions

Programs

An Alternate Way of Extracting the Fraction and Integer Parts of a Number

The fraction part is stored in F, and the integer part is stored in I.  This algorithm can be used when a calculator or programming language does not have a fractional part or integer part function.

This program assumes the program is in Radians mode.

Casio fx-5800P Program FPIP

Rad
0.5    → F
? → X
cos(πX) = 0 ⇒ Goto 1
Abs(X) → F
tan^-1 (tan (πF)) ÷ π → F
X < 0 ⇒ -F → F
Lbl 1
F /right-triangle ([Shift] [x^2])
X – F → I

Bernoulli Numbers

The program BERNOULLI approximates the Bernoulli number of nth order.

Casio fx-5800P Program BERNOULLI

? → N
If N = 0
Then
1 → B
Goto 1
IfEnd
If Frac(N ÷ 2) ≠ 0
Then
Int( Abs(N – 2) ÷ (N – 2) – 1) ÷ 4 → B
Goto 1
IfEnd
Σ ( (2*J*π)^(-N), J, 1, 250) * (-1)^(N ÷ 2 + 1) * 2 * N! → B
Lbl 1
B

Euler Numbers

The program EULERNUM calculates the Euler number of order n.

Casio fx-5800P Program EULERNUM

? → N
0 → E
Frac(N ÷ 2) ≠ 0 ⇒ Goto 1
(2 ÷ π)^(N + 1) * N! ÷ 5 → E
-1 – 10 * Int(E) → E
Frac(N ÷ 4) ≠ 0 ⇒ Goto 1
4 – E → E
N ≠ 0 ⇒ Goto 1
1   → E
Lbl 1
E

Custom Formulas

How to create custom formulas:  [MODE], 5.  PROG, 1.  NEW, give the name, 3. Formula

To calculate the custom formula, press [CALC], enter the value for T (ignore X because X is a dummy variable).

Sine Integral:   SI:  ∫( sin(X)/X dX,0,T)

Dawson Integral:  DAWSON:  ∫(e^(T^2-X^2) dX,0,T)

Bessel Function, with order N:  BESSEL:  1/π * ∫(cos(T * sin(X)-N*X) dX,0,T)

Error Function:  ERF:  2/√π * ∫(e^(-X^2) dX,0,T)

Fresnel Sine:  FRESSIN:  ∫( sin(π*X^2/2) dX,0,T)

Fresnel Cosine: FRESCOS: ∫( cos(π*X^2/2) dX,0,T)

Source:

Jerome Spainer and Keith B. Oldham  An Atlas of Functions Hemisphere Publication Corporation: Washington  1987  ISBN 0-89116-5738-8

Eddie

This blog is property of Edward Shore, 2017

Wednesday, April 13, 2016

HP Prime, Casio Classpad: Bessell Functions of the 1st Kind

Bessel Function of the First Kind

The program BESS1 calculates the Bessel function of the First Kind. With the HP Prime and Casio Classpad, and any calculators that can process integrals (and the processor is fast enough), we can use the definition:

J_n(x) = 1/π * ∫ (cos(n*t – x*sin(t)) dt for t= 0 to t = π

This is the solution to the differential equation:

x^2*y’’ + x*y’ + (x^2 – n^2)*y = 0, where y is a function of x.

There are many other variations and approximations to calculate J_n(x) if the integral function is not available on your calculator. 

More information on the Bessel function is found here:

Wolfram

Wikipedia



Casio Classpad (fx-CP400):  The Function BESS1




As the screen above shows, I used a Define statement in the Main Mode:

Define bess1(n,x) = 1/π ∫ (cos(n*t – x*sin(t)) dt, from t = 0 to t = π)

Note:  Make sure that the calculator is in Radians mode before calculating.

HP Prime:  BESS1

EXPORT BESS1(n,t)
BEGIN
// Bessel 1st Kind
LOCAL b;
// Integrate
b:=(1/π)*CAS.int(COS(n*X-t*SIN(X)),X,0,π);
// Approximate
b:=approx(b);
RETURN b;

END;

Note: the integration and approximation are two separate steps.  They need to be in order for this program to work correctly.

Examples

bess1(1,2) ≈ 0.576724807756
bess1(0,6.3) ≈ 0.223812006132
bess1(2,4) ≈ 0.364128145852


This blog is property of Edward Shore, 2016.

Casio fx-50F/Radio Shack EC-4024 Program Collection: October 2026

Casio fx-50F/Radio Shack EC-4024 Program Collection: October 2026 Notes: * The fx-50F/EC-4024 has a 29 step program space betwe...