§
Arbitrary-precision
arithmetic (GMP)
§
Calculus
§
Differential
and Recurrence Equations
§
Lists
§
Logic
§
Strings
w
Arbitrary-precision arithmetic (GMP)
§
GMPFMul(numstr1,numstr2)
does arbitrary-precision multiplication of the floating point real numbers given
in numstr1 and numstr2 and returns the result as a list {string,intdigits}
Needs: GMPMulDt
Example: GMPFMul("32.868852111489014254382668691",
"4.882915734918426996824267") Þ
{"160495835163896471004691233980227653746755621409924496999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998",3},
which means 160.4958…
Note: GMPFMul is experimental and currently has a small memory leak.
§
CPVInt(f(x),x,a,b)
returns the Cauchy principal value of the integral ò(f(x),x,a,b)
Examples: CPVInt(1/x,x,-1,2) Þ ln(2), CPVInt(1/(x+x2),x,-2,1) Þ -2×ln(2),
CPVInt(tan(x),x,p/4,3×p/4) Þ 0,
CPVInt(x/(x3-3),x,0,¥) Þ 0.302299894039
Note: CPVInt may not be able to handle some improper integrals (i.e. integrals
with one or both integration limits infinite) because it does not compute
residues.
§
ExactDif(flist,vars)
returns true if flist is an exact differential, else returns false or the
conditions that must be satisfied
Needs: FuncEval, list2eqn, Permut
Examples: ExactDif({f(x),g(y),h(z)},{x,y,z}) Þ true,
ExactDif({f(x,y),g(y),h(z)},{x,y,z}) Þ ![]()
§
FracDer(xpr,{x,ordr[,a]})
returns the fractional derivative (from Riemann-Liouville calculus) of xpr with
respect to variable x to order ordr
Needs: FreeQ, Gamma, IsCmplxN, MatchQ
Examples: FracDer(1,{x,-1/2}) Þ 2×Ö(x)/Ö(p),
FracDer(d(f(x),x),{x,-2/3})
Þ 0.664639300459×x5/3
Notes: The default for a is zero (a is what is called the ‘lower limit’). The
fractional derivative of a constant is not zero, as the first example shows.
Because the gamma function cannot be evaluated symbolically for many fractions,
you may get a numeric result, as shown in the second example. Weyl calculus is
a subset of Riemann-Liouville calculus.
§
GetExpLn(xpr)
is a subroutine for Risch that returns exponential or logarithmic
subexpressions
Needs: mand
§
Horowitz(numerator,denominator,var)
reduces an integral using the Horowitz method
Needs: Coef, Degree, list2eqn, Pad, PolyDiv, PolyGCD, Quotient, RTInt
Example: Horowitz(x,x4-1,x) Þ ln(x2-1)/4+(-ln(x2+1)/4)-p/4×i
Note: This is an experimental function.
§
ImpDifN(eq,x,y,n)
returns the nth implicit derivative of the equation eq
Example: ImpDifN(x4+y4=0,x,y,2) Þ -3×x6/y7-3×x2/y3
§
mTaylor(f(x,y,…),{x,y,…},{x0,y0,…},k)
returns the multivariate Taylor expansion of f(x,y,…) to order k
Needs: list2eqn
Examples: mTaylor(x2+x×y2, x,x0,5) Þ (x-x0)2 + (x-x0)×(y2+2×x0) + x0×y2 + x02
mTaylor(x2+y2,
{x,y},{x0,y0},2)
Þ x0×x2-2×x0×(x0-1)×x+y0×y2-2×y0×(y0-1)×y+x03-x02+y02×(y0-1)
§
nIntSub(f,x,a,b,n)
numerically integrates f from x=a to x=b by subdividing the interval into n
subintervals
Example: nIntSub(tan(x),x,0,1.5707,5) Þ 9.24776403537
§
Pade(f,x,x0,n,d)
returns the Padé approximant of f(x) about x=x0 with degrees n for
the numerator and d for the denominator
Examples: Pade(ex,x,0,1,2) Þ 2×(x+3)/(x2-4×x+6), Pade(xx,x,1,0,2) Þ -1/(x-2)
Note: Padé approximants are a kind of generalization of Taylor series and are a
good way of approximating functions that have poles.
§
Risch(xpr,var)
does indefinite integration
Needs: Coef, Degree, FreeQ, GetExpLn, list2eqn, mand, PolyGCD, Resultnt, Terms,
VarList
Examples: Risch(ln(x),x) Þ (ln(x)-1)×x,
Risch(1/ln(x),x) Þ "Not integrable in
terms of elementary functions"
Notes: Risch uses a partial implementation of the Risch algorithm, for
logarithmic and exponential extensions. The Risch algorithm builds a tower of
logarithmic, exponential, and algebraic extensions. Liouville’s principle,
which dates back to the 19th century, is an important part of the
Risch algorithm. Hermite reduction is applicable to arbitrary elementary
functions (functions that can be obtained from the rational functions in x
using a finite number of nested logarithms, exponentials, and algebraic numbers
or functions) in the algorithm. At this time, this (Risch) function is
experimental and should be seen as a framework for future functionality rather
than a currently useful tool.
§
RTInt(numerator,denominator,var)
computes ò(numerator/denominator,x)
using the Rothstein-Trager method
Needs: Degree, LeadCoef, PolyGCD, Resultnt, SqFreeQ
Example: RTInt(1,x3+x,x) Þ ln(x)-ln(x2+1)/2
Note: numerator and denominator should be polynomials. RTInt is an experimental
function.
§
TanPlane(f,vars,pt)
returns the equation of the tangent plane to the curve/surface f at the point
pt
Needs: list2eqn
Example: TanPlane(x2+y2,{x,y},{1,1}) Þ 2×x+2×y-4=0
§
Cyc2Perm(clist)
returns the permutation that has the cycle decomposition clist
Needs: Sort
Example: Cyc2Perm({cycle_={1},cycle_={3,2}}) Þ {1,3,2}
Note: Perm2Cyc and Cyc2Perm use the cycle_ = list structure because the AMS does
not allow arbitrary nesting of lists.
§
InvPerm(perm)
returns the inverse permutation of the permutation perm
Example: InvPerm({2,4,3,1}) Þ {4,1,3,2}
Note: InvPerm does not check that the permutation is valid.
§
isPermut(list)
returns true if list is a valid permutation, else false
Needs: Sort
Examples: isPermut({1,3,2}) Þ true, isPermut({2,3,2}) Þ false
Note: For valid permutations, the elements of the list must be numbers.
§
KSubsets(plist,k)
returns subsets of plist with k elements
Example: KSubsets({a,b,c},2) Þ [[a,b][a,c][b,c]]
§
LevCivit(indexlist,g)
returns the Levi-Civita symbol for the given metric
Needs: PermSig
Example: LevCivit({1,3,2},[[1,0,0][0,r2,0][0,0,r2×sin(q)2]]) Þ -|sin(q)|×r2
Note: LevCivit could be used for computing cross products.
§
Ordering(list)
returns the positions at which the elements of list occur when the list is
sorted
Needs: Sort
Example: Ordering({4,1,7,2}) Þ {2,4,1,3}
Note: For the example above, element #2 (1) occurs at position 1 in the sorted
list, element #4 (2) occurs at position 2, element #1 (4) occurs at position 3,
and element #3 (7) occurs at position 4.
§
Perm2Cyc(perm)
returns the cyclic decomposition for the permutation perm
Example: Perm2Cyc({1,3,2}) Þ {cycle_={1}, cycle_={3,2}}
Notes: Perm2Cyc does not check that the permutation is valid. Perm2Cyc and
Cyc2Perm use the cycle_ = list structure because the AMS does not allow
arbitrary nesting of lists.
§
PermSig(list)
returns the signature of the permutation (even = 1, odd = -1, invalid = 0)
given by list
Needs: isPermut, Position
Example: PermSig({3,2,1}) Þ -1 (this is an odd
permutation)
Notes: For valid permutations, the elements of the corresponding list must be
numbers. The permutation is even(odd) if an even(odd) number of element
transpositions will change the permutation to {1,2,3,…}; in the example, 321 ® 231 ® 213 ® 123 Þ 3 transpositions Þ odd permutation.
§
Permut(list)
returns all possible permutations of list
Needs: ListSwap
Example: Permut({a,b,c}) Þ
[[a,b,c][b,a,c][c,a,b][a,c,b][b,c,a][c,b,a]]
§
RandPerm(n)
returns a random permutation of {1,2,…,n}
Needs: Sort
Example: RandSeed 0:RandPerm(4) Þ {3,4,2,1}
§
CFracExp(num,ordr)
returns the continued fraction expansion of the number num to order ordr
Examples: CFracExp(p,5) Þ {3,7,15,1,292}, CFracExp(Ö(2),4) Þ {1,2,2,2},
CFracExp(5,11) Þ {5}, CFracExp(5,¥) Þ {5},
CFracExp(5/2,¥) Þ {2,2},
CFracExp(Ö(28),¥) Þ {5, rep={3,2,3,10}}
Note: Rational numbers have terminating continued fraction expansions, while
quadratic irrational numbers have eventually repeating continued fraction
representations. The continued fraction of Ö(n) is represented as {a,
rep={b1,b2, b3,…}}, where the bi are
cyclically repeated. Continued fractions are used in calendars and musical
theory, among other applications.
§
ContFrac({num(k),denom(k)},k,n)
returns the continued fraction num(k)/(denom(k)+num(k+1)/(denom(k+1)+…))
Example: ContFrac({-(k+a)×z/((k+1)×(k+b)), 1+(k+a)×z/((k+1)×(k+b))},k,2) Þ
![]()
§
ContFrc1(list) returns the continued fraction
list[1]+1/(list[2]+1/(list[3]+…
Example: approx(ContFrc1({3,7,15,1,292})) Þ 3.14159265301
§
DaubFilt(k)
returns the FIR coefficients for the Daubechies wavelets
Needs: Map, Reverse, Select
Example: factor(DaubFilt(4)) Þ {(Ö(3)+1)×Ö(2)/8, (Ö(3)+3)×Ö(2)/8,
-(Ö(3)-3)×Ö(2)/8, -(Ö(3)-1)×Ö(2)/8}
§
DCT(list/mat)
returns the discrete cosine transform of list/mat
Example: DCT({2+3×i, 2-3×i}) Þ {2×Ö(2), 3×Ö(2)×i}
§
DST(list/mat)
returns the discrete sine transform of list/mat
Example: DCT({2+3×i, 2-3×i}) Þ {0, 2×Ö(2)}
§
Fit(mat,f(par,vars),par,vars)
returns a least-squares fit of the model f with parameter par to the data in
mat
Needs: FuncEval, VarList
Example: {{0.3,1.28},{-0.61,1.19},{1.2,-0.5},{0.89,-0.98},{-1,-0.945}}®mat
Fit(mat,x2+y2-a2,a,{x,y}) Þ a = 1.33057 or a = -1.33057
Note: The data in mat is given in the form {{x1,y1,…},{x2,y2,…},...}. The number of
columns of mat should be equal to the number of variables vars.
§
Lagrange(mat,x)
returns the Lagrange interpolating polynomial for the data in mat
Example: Lagrange({{2,9},{4,833},{6,7129},{8,31233},{10,97001},
{12,243649}},x) Þ x5-3×x3+1
Note: The data matrix mat is in the form {{x1,y1},{x2,y2},…}.
§