TI-Basic Vault
"Some of the most elegant, compact, speedy and accurate math programs available for the TI-83 Plus." –Weregoose
Concepts
Arithmetic-Geometric Mean
Description
Computes the arithmetic-geometric mean of two real numbers.
Example
{1,2:prgmAGM ► 1.456791031
Program
PROGRAM:AGM
:While variance(Ans
:{mean(Ans),√(prod(Ans
:End
:min(Ans
Base Converter
Description
Translates integers between different bases (2–35).
Example
{16,10:prgmBASECONV
?7C
► 124
{30,32:prgmBASECONV
?132FILL
► NUMBER
Program
PROGRAM:BASECONV
:Input Str1
:Ans→A
:Ans(2→A
:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ→Str2
:length(Str1
:sum(seq(LA(1)^(Ans-A)(inString(Str2,sub(Str1,A,1))-1),A,1,Ans→B
:"░ // one space
:For(C,1,log(AB+1)/log(A
:sub(Str2,int(E5×√2+AfPart(B/A^C)),1)+Ans
:End
:Ans
Binomial Theorem
Description
Lists the coefficients of (Ax+By)^C in expanded form.
Example
1→A:2→B:3→C:prgmBINOMIAL ► {1 6 12 8}
‾3.2→A:4.5→B:2→C:prgmBINOMIAL ► {10.24 ‾28.8 20.25}
Program
PROGRAM:BINOMIAL
:A^Cseq(C nCr D(B/A)^D,D,0,C
Bernoulli Number
Description
Lists the first 22 Bernoulli numbers.
Example
prgmBERNOULI ► {1 ‾1/2 1/6 0 ‾1/30 0 1/42 0 ‾1/30 0 5/66 0 ‾691/2730 0 7/6 0 ‾3617/510 0 43867/798 0 ‾174611/330 0}
Program
PROGRAM:BERNOULI
:{1
:For(A,2,22
:augment(Ans,{‾A‾¹sum(AnsA nCr cumSum(not(not(Ans-1
:End
:Ansabs(1<43abs(Ans►Frac
Completing the Square
Description
Transforms the polynomial Ax²+Bx+C into A(x+B′)²+C′.
Example
2→A:4→B:5→C:prgmCTSQUARE ► {2 1 3}
1→A:‾5→B:6→C:prgmCTSQUARE ► {1 ‾5/2 ‾1/4}
Program
PROGRAM:CTSQUARE
:.5B/A
:{A,Ans,C-AAns²►Frac
Double Factorial
Description
Computes the double factorial of an integer.
Example
8:prgmDBLFACT ► 384
{1,7,13:prgmDBLFACT ► {1 105 135135}
Program
PROGRAM:DBLFACT
:.5Ans
:int(2^AnsAns!(2/π)^fPart(Ans
Euclidean Algorithm
Description
Computes the greatest common divisor of two real numbers.
Example
12→A:90→B:prgmGCD ► 6
‾5.36→A:7.84→B:prgmGCD ► .08
Program
PROGRAM:GCD
:A+Bi
:While real(round(Ans,8
:Ansi+real(AnsiPart(imag(Ans/real(Ans
:End
:abs(A/iPart(A/Ans
Euler Zigzag Number
Description
Computes the secant numbers for even inputs and tangent numbers for odd inputs.
Example
8:prgmEULERZG ► 1385
13:prgmEULERZG ► 22368256
Program
PROGRAM:EULERZG
:Ans→A
:{1
:For(A,2,A
:augment(Ans,{max(Ans
:cumSum(seq(Ans(A-B),B,1,A-1
:End
:max(Ans
Fibonacci Number
Description
Computes the nth Fibonacci number.
Example
30:prgmFIBNACCI ► 832040
{10,11,12:prgmFIBNACCI ► {55 89 144}
Program
PROGRAM:FIBNACCI
:int(round(√(.8)cosh(Anssinh‾¹(.5
Fraction Converter
Description
Lists the numerator and denominator of the input.
Example
.14632:prgmTOFRAC ► {1829 12500}
πe:prgmTOFRAC ► {3999687 468362}
42315/60:prgmTOFRAC ► {2821 4}
Program
PROGRAM:TOFRAC
:Ans→A
:{1,0→A
:abs(A→B
:0
:Repeat not(A-Ans‾¹round(AnsA,0
:{Ans,Ansint(B)+LA(1→A
:If fPart(B
:1/fPart(B→B
:max(LA
:End
:round(Ans{A,1
Gamma Function
Description
Evaluates the gamma function for real-valued inputs.
Example
5:prgmGAMMA ► 24
17/3:prgmGAMMA ► 68.65322228
‾.0340274496387:prgmGAMMA ► ‾30
Program
PROGRAM:GAMMA
:Ans→A
:9+abs(Ans
:Ans^Ans/prod(seq(A,A,Ans-9,Ans))√(2πAns/e^(2Ans-1/(6Ans+1/(5Ans+53/(42Ans+22/Ans
:If A<0
:‾π/(AnsAsin(πAr
:Ans
Heron's Formula
Description
Computes the area of a triangle given three side lengths.
Example
{51,52,53:prgmHERON ► 1170
{9,18,24:prgmHERON ► 68.79998183
Program
PROGRAM:HERON
:√(sum(.5Ans)prod(sum(.5Ans)-Ans
Lambert W Function
Description
Computes an A for which Ae^A equals the input.
Example
‾1/e:prgmLAMBERTW ► ‾1
‾.5π:prgmLAMBERTW ► 1.570796327i
72+640i/3:prgmLAMBERTW ► 4.000137616+1.000267067i
Program
PROGRAM:LAMBERTW
:Ans→A
:DelVar Bi
:While abs(Ans-B) and 1+real(B
:Ans→B
:(AAns+A)/(A+e^(Ans
:End
:Ans
Mode Calculator
Description
Lists the mode(s) of a list of two or more real numbers.
Example
{5.5,4.7,5.2,5.1,4.7:prgmMODE ► {4.7}
{0,‾7,‾2,0,‾8,1,10,9,8,‾2,9:prgmMODE ► {9 0 ‾2}
Program
PROGRAM:MODE
:Ans→A
:1+max(abs(Ans→A
:LA+Ans
:While max(Ans
:Ans→B
:SortD(LB
:LBaugment({0},not(ΔList(LB
:End
:sum(LB xor 0→dim(LB
:LB-A
Modular Exponentiation
Description
Computes B^E (mod M) for positive integer inputs.
Example
5→B:125→E:75→M:prgmMODEXP ► 50
880→B:268→E:143→M:prgmMODEXP ► 22
Program
PROGRAM:MODEXP
:1→C
:While Ans
:If fPart(.5E
:BC-Mint(BC/M→C
:B²-Mint(B²/M→B
:int(.5E→E
:End
:C
Quadratic Formula
Description
Lists the roots of Ax²+Bx+C=0.
Example
1→A:3→B:2→C:prgmQUADFORM ► {‾2 ‾1}
.08→A:‾.04→B:.01→C:prgmQUADFORM ► {.25-.25i .25+.25i}
Program
PROGRAM:QUADFORM
:‾2C/(B+{‾1,1}√(B²+4ACi²
Simplifying Square Roots
Description
Lists the coefficient and radicand of the simplified form of the input.
Example
√(12:prgmSIMPROOT ► {2 3}
√(63)√(21:prgmSIMPROOT ► {21 3}
Program
PROGRAM:SIMPROOT
:For(A,int(Ans),1,‾1
:If fPart(round(Ans²/A²
:End
:{A,Ans²/A²
Square Root Approximation
Description
Lists an A and B for which √(A)+B is close to the input.
Example
27.36278175:prgmNEARSQRT ► {5985 ‾50}
tan(πr/8:prgmNEARSQRT ► {2 ‾1}
Program
PROGRAM:NEARSQRT
:Ans→A
:fPart(Ans→B
:1/fPart(Ans‾¹→C
:BAns
:While fPart(round(Ans,4
:C+Ans
:End
:B+round(.5Ans/B,0
:{Ans²,A-Ans
Triangle Solver
Description
Computes the remaining possible sides and angles of a triangle given three known (nonzero) measurements.
Example
{27.1,30.5,0→L1:{34°,0,0→L2:prgmTRISOLVE
►
Triangle
a=27.1
b=30.5
c=46.34565289
A=34
B=39.00217905
C=106.9978209
Second Triangle
a=27.1
b=30.5
c=4.225639036
A=34
B=140.9978209
C=5.002179051
Program
PROGRAM:TRISOLVE
:If 3≠sum(not(augment(L1,L2
:Return
:DelVar Aa+bi
:not(L1)(L2+not(L2)(πr-sum(L2
:If max(L1
:max(L1)sin(Ans)/sin(sum(Ans+min(L1
:If 2=sum(not(Ans
:√(sum(L1²)-prod(L1+2not(L1)cos(max(L2
:If min(L1) or max(L1 and L2)≠sum(not(L1
:Then
:Goto 0
:End
:For(B,‾1,1,2
:max(L1not(L2
:Anscos(L2)-B√(L1²-Ans²sin(L2)²
:max(Ansnot(not(L2
:Lbl 0
:L1+Ansnot(L1
:If min(real(Ansnot(imag(Ans
:Then
:If sum(Ans)<2max(Ans
:Return
:If A
:Pause
:ClrHome
:Disp sub("Second Triangle",8-7A,7A+8
:For(C,0,1
:If C
:cos‾¹(Ans/prod(Ans)(.5sum(Ans²)-Ans²
:For(D,1,3
:Disp " "+sub("abcABC",3C+D,1)+"=
:Output(3C+D+1,4,Ans(D
:End
:End
:IS>(A,2
:End
:End
von Staudt-Clausen Theorem
Description
Computes the denominator of the nth Bernoulli number.
Example
6:prgmBERND ► 42
500:prgmBERND ► 8365830
Program
PROGRAM:BERND
:Ans→A
:{1
:For(B,1,A
:If not(fPart(A/B
:augment(Ans,1+B{1=max(gcd(B+1,seq(A,A,1,B
:End
:prod(Ansnot(1<AfPart(.5A
Backlinks
Send me an e-mail if you have a link pointing here, and I'll point back if it's to related material.
Copyright and Contact Information
Site design is copyright © 2011 Kenneth "Weregoose" Hammond.
Send a message to: weregoose@gmail.com.