# HP Calculator Wiki

### Site Tools

prime:programming:math-special_commands

### Math-Special Commands

#### Beta

Calculates the beta function. Beta(x,y) = (x-1)! * (y-1)! / (x+y-1)!

Syntax

Input:

Home - Algebraic Entry Home - Textbook Entry Program Editor

CAS.Beta(number, number)

Home - RPN Entry

2: number 1: number CAS.Beta(2), press Enter

CAS Mode

Beta(number or algebraic expression, number or algebraic expression)

Numbers can be real or complex.

Output:

Beta(x,y) = (x-1)! * (y-1)! / (x+y-1)!

Examples:

Beta(8,5) returns 1/3960

Beta(1+7*i, -2*i) returns .00118622003099-.0037324363508*i

Access: Toolbox, Math, 8. Special, 1. Beta

See Also: Gamma, Psi

#### Gamma

Calculates the gamma function. Gamma(x) = integral of t^(x-1) * e^-t dt from 0 to infinity

Also Gamma(x) = (x-1)!

Syntax

Input:

Home - Algebraic Entry Home - Textbook Entry Program Editor

CAS.Gamma(number)

Home - RPN Entry

1: number CAS.Gamma(1), press Enter

CAS Mode

Gamma(number)

Output : Result of the Gamma function. See the formulas above.

Notes: Gamma for complex numbers work best in CAS mode. Factorial and gamma of complex numbers in Home mode cannot be approximated.

Examples:

Gamma(5) returns 24 Gamma(-8) returns Inf in Home Mode, ±∞ in CAS Mode

Related: Psi, Beta

#### Psi

The Psi returns the nth derivative of the digamma function. The digamma function is defined as:

Ψ(x) = d/dz ln Γ(x)

The general syntax of Psi is Psi(number, order). If order is omitted, then digamma function is calculated.

Syntax

Input:

Home Mode - Algebraic Entry Home Mode - Textbook Entry Program Editor

CAS.Psi(number, order)

Home - RPN Entry

2: number 1: order CAS.Psi(2), press Enter

For the digamma function: 1: number CAS.Psi(1), press Enter

CAS Mode

Psi(number, order)

Output: Result of the polygamma function. See the formulas above.

Examples:

Digamma: Psi(6) returns -euler_gamma + 137/60, approximately 1.70611766843

Polygamma: Psi(6,2) returns -2 *(Zeta(3) - 256103/216000), approximately -.032789732245

Notes: euler_gamma is the gamma constant, which is approximately 0.577215664902.

Access: Toolbox, Math, 8. Special, 3. Psi

See Also: Gamma, Psi, Beta

#### Zeta

Calculates the Zeta (ζ) function. The general formula for the Zeta function is:

ζ(x) = Σ (k^-x) from k = 1 to ∞

Syntax

Zeta(real number).

Caution: Complex numbers return a result with the Eta function, which does not give full approximate answers. (rev. 5166)

Input:

Home Mode - Algebraic Entry Home Mode - Textbook Entry Program Editor

CAS.Zeta(real number)

Home Mode - RPN Entry

1: real number CAS.Zeta(1), press Enter

CAS Mode

Zeta(real number)

Output: Result of the zeta function. If the number is an even integer, an exact answer is returned. If the number is an odd integer, Zeta(odd integer) is returned, which can be approximated. Otherwise, an approximate answer is returned.

Examples:

Zeta(3) returns Zeta(3),which is approximately 1.20205690316 Zeta(6) returns π^6/945, which is approximately 1.01734306198 Zeta(3.25) returns 1.15915198568

Access: Toolbox, Math, 8. Special, 4. Zeta

See Also: Gamma

#### erf

Calculates the error (erf) function. The general formula for the error function is:

erf(x) = 2/√π * ∫ e^(-t^2) dt from 0 to x

Syntax

erf(number)

The number can either be a real or complex number.

Input:

Home Mode - Algebraic Entry Home Mode - Textbook Entry Program Editor

CAS.erf(number)

Home Mode - RPN Entry

1: number CAS.erf(1), press Enter

CAS Mode

erf(number)

Output: Result of the error function.

Home Mode: erf(number) is returned.

CAS Mode Only: If the number is an integer, erf(integer) is returned, which can be approximated. If the number is not an integer, an approximation is returned.

Examples:

CAS Mode: approx(erf(2)) returns .995322265019 approx(erf(3)) returns .999977909503

Access: Toolbox, Math, 8. Special, 5. erf

See Also: erfc

#### erfc

Calculates the error compliment (erfc) function. The general formula for the error compliment function is:

erfc(x) = 1 - erf(x)

Syntax

erf(number)

The number can either be a real or complex number.

Input:

Home Mode - Algebraic Entry Home Mode - Textbook Entry Program Editor

CAS.erfc(number)

Home Mode - RPN Entry

1: number CAS.erfc(1), press Enter

CAS Mode

erfc(number)

Output: Result of the error complement function.

Home Mode: 1 - erf(number) is returned.

CAS Mode Only: If the number is an integer, 1 - erf(integer) is returned, which can be approximated. If the number is not an integer, an approximation is returned.

Examples:

CAS Mode: approx(erfc(2)) returns .00467773498105 approx(erfc(3)) returns 2.20904969837E-5

Access: Toolbox, Math, 8. Special, 6. erfc

See Also: erf

#### Ei

Calculates the exponential integral: Ei(x) = ∫ e^-t/t dt from x to ∞

Syntax

Ei(number)

The number can either be a real or complex number.

Input:

Home Mode - Algebraic Entry Home Mode - Textbook Entry Program Editor

CAS.Ei(number)

Home Mode - RPN Entry

1: number CAS.Ei(1), press Enter

CAS Mode

Ei(number)

Output: Result of the exponential function.

CAS Mode, Home Mode with Textbook or Algebraic Entry: If the number is an integer, then Ei(integer) or CAS.Ei(integer), respectively, is returned, which can be approximated. If the number is not an integer, or a complex number, then an approximation is returned.

Home Mode with RPN Entry: Ei(number) is returned if the number is an integer. Otherwise, an approximate answer is returned.

Examples:

CAS Mode: approx(Ei(2)) returns 4.954234356 approx(Ei(3)) returns 9.93383257063

Access: Toolbox, Math, 8. Special, 7. Ei

See Also: Si, Ci

#### Si

Calculates the sine integral: Si(x) = ∫ sin t/t dt from 0 to t

Syntax

Si(number)

The number must be a real number. A “Bad Argument Value” error occurs when the argument is a complex number.

Input:

Home Mode - Algebraic Entry Home Mode - Textbook Entry Program Editor

CAS.Si(number)

Home Mode - RPN Entry

1: number CAS.Si(1), press Enter

CAS Mode

Si(number)

Output: Result of the sine integral function.

CAS Mode, Home Mode with Textbook or Algebraic Entry: If the number is an integer, then Si(integer) or CAS.Si(integer), respectively, is returned, which can be approximated. If the number is not an integer, or a complex number, then an approximation is returned.

Home Mode with RPN Entry: Si(number) is returned.

Examples:

CAS Mode: approx(Si(2)) returns1.6054129768

Access: Toolbox, Math, 8. Special, 8. Si

See Also: Ei, Ci

#### Ci

Calculates the cosine integral: Ci(x) = euler_gamma + ln x + ∫ (cos t - t)/t dt from 0 to t where euler_gamma is the gamma constant, which is approximately 0.577215664902.

Syntax

Ci(number)

The number must be a real number. A “Bad Argument Value” error occurs when the argument is a complex number.

Input:

Home Mode - Algebraic Entry Home Mode - Textbook Entry Program Editor

CAS.Ci(number)

Home Mode - RPN Entry

1: number CAS.Ci(1), press Enter

CAS Mode

Ci(number)

Output: Result of the sine integral function.

CAS Mode, Home Mode with Textbook or Algebraic Entry: If the number is an integer, then Ci(integer) or CAS.Ci(integer), respectively, is returned, which can be approximated. If the number is not an integer, or a complex number, then an approximation is returned.

Home Mode with RPN Entry: Ci(number) is returned.

Examples:

CAS Mode: approx(Ci(2)) returns .422980828775

Access: Toolbox, Math, 8. Special,9. Ci

See Also: Ei, Si

Return to the Prime Programming Page: Prime Programming Language (PPL)

prime/programming/math-special_commands.txt · Last modified: 2013/10/06 13:51 by ed314