abs absolute value adj adjunct of matrix and logical and arccos arccosh arcsin arcsinh arctan arctanh arg argument of complex binomial break break out of a loop ceiling ceiling function check stop if false coeff coefficient of polynomial cofactor cofactor of matrix condense find subexpressions conj complex conjugate contract contract across tensor indices cos cosh d derivative and gradient deg degree of polynomial denominator denominator of expression det determinant of a matrix dim dimension of tensor index display display an expression do evaluate multiple expressions dot inner product of tensors draw draw a graph eigen erf error function erfc complementary error function eval normalize an expression exp exponential function expcos exponential cosine expsin exponential sine factor factor a number or polynomial factorial factorial function filter remove subexpressions float convert to floating point floor floor function for for loop gcd greatest common denominator hermite hermite polynomial hilbert hilbert matrix imag imaginary part of complex inner inner product of tensors integral inv invert a matrix isprime laguerre laguerre polynomial lcm least common multiple legendre legendre polynomial log natural logarithm mag magnitude of complex mod modulo function not logical negation numerator numerator of expression or logical or outer outer product of tensors polar convert to polar form prime product multiply over an index prog evaluate with scoped variables quote do not evaluate quotient divide polynomials rank rank of tensor rationalize combine fractions real real part of complex rect complex to rectangular return early return from a function roots find roots of a polynomial simfac simplify factorials simplify simplify an expression sin sinh sqrt square root stop stop running a script subst substitute expressions sum sum over an index tan tanh taylor taylor series test conditional evaluation trace trace of matrix transpose transpose tensor indices unit unit matrix wedge wedge product of tensors zero new zero tensor |
Trivia
|
Enter
abs((a,b,c))
Result
1/2
2 2 2
(a + b + c )
Enter
A = ((a,b),(c,d))
adj(A)
Result
d -b
-c a
The inverse of a matrix is equal to the adjunct divided by the determinant.
Enter
inv(A) - adj(A) / det(A)
Result
0
Example
and(A = B, B = C)
Enter arg(1 + exp(i pi/3)) Result 1/6 pi
Enter
binomial(10,5)
Result
252
Example
check(A = B)
Enter
2 a (x + 1)
Result
2 a + 2 a x
Enter
condense(last)
Result
2 a (x + 1)
Enter
conj(3 + 4 i)
Result
3 - 4 i
Enter
A = ((a,b),(c,d))
contract(A,1,2)
Result
a + d
Enter d(x^2,x) Result 2 xFor tensor f the derivative of each element is computed.
Enter
d((x,x^2),x)
Result
1
2 x
Functions with no arguments are treated as dependent on any variable.
Enter
d(f(),(x,y))
Result
d(f(),x)
d(f(),y)
Since partial derivatives commute, multi-derivatives are ordered to produce a
canonical form.
Enter
d(d(f(),y),x)
Result
d(d(f(),x),y)
The following table shows the various forms that can be used to compute
multiderivatives.
Form Equivalent form d(f,2) d(d(f,x),x) d(f,x,2) d(d(f,x),x) d(f,x,x) d(d(f,x),x) d(f,x,2,y,2) d(d(d(d(f,x),x),y),y) d(f,x,x,y,y) d(d(d(d(f,x),x),y),y)
Enter
denominator(a/b)
Result
b
Enter
A = ((a,b),(c,d))
det(A)
Result
a d - b c
Enter
A = (1,2,3,4)
dim(A)
Result
4
Enter
A = ((1,2,3),(4,5,6))
dim(A,1)
Result
2
Enter
dim(A,2)
Result
3
| Gamma | Γ | alpha | α | mu | μ | ||
| Delta | Δ | beta | β | nu | ν | ||
| Theta | Θ | gamma | γ | xi | ξ | ||
| Lambda | Λ | delta | δ | pi | π | ||
| Xi | Ξ | epsilon | ε | rho | ρ | ||
| Pi | Π | zeta | ζ | sigma | σ | ||
| Sigma | Σ | eta | η | tau | τ | ||
| Upsilon | Υ | theta | θ | upsilon | υ | ||
| Phi | Φ | iota | ι | phi | φ | ||
| Psi | Ψ | kappa | κ | chi | χ | ||
| Omega | Ω | lambda | λ | psi | ψ | ||
| omega | ω |
Enter
A = (A1,A2,A3)
B = (B1,B2,B3)
dot(A,B)
Result
A1 B1 + A2 B2 + A3 B3
The dot product is equivalent to an outer product followed by a contraction
across the inner indices.
Enter
A = hilbert(10)
dot(A,A) - contract(outer(A,A),2,3)
Result
0
Example 1.
Enter draw(5(cos(t),sin(t)))
Example 2.
Enter draw(5(cos(3t),sin(5t)))
Example 1. Check the relation AX = lambda X where lambda is an eigenvalue and X is the associated eigenvector.
Enter
A = hilbert(3)
eigen(A)
lambda = D[1,1]
X = Q[1]
dot(A,X) - lambda X
Result
-1.16435e-14
-6.46705e-15
-4.55191e-15
Example 2: Check the relation A = QTDQ.
Enter A - dot(transpose(Q),D,Q) Result 6.27365e-12 -1.58236e-11 1.81902e-11 -1.58236e-11 -1.95365e-11 2.56514e-12 1.81902e-11 2.56514e-12 1.32627e-11
Enter draw(erf(x))
Enter draw(erfc(x))
Enter
A = quote(sin(pi/6))
A
Result
1
sin(--- pi)
6
Enter
eval(A)
Result
1
---
2
Enter
exp(1.0)
Result
2.71828
Enter
exp(a) exp(b)
Result
exp(a + b)
Enter
expcos(x)
Result
1 1
--- exp(-i x) + --- exp(i x)
2 2
Enter
expsin(x)
Result
1 1
--- i exp(-i x) - --- i exp(i x)
2 2
Enter
factor(12345)
Result
3 5 823
The second form factors polynomial p in x.
The argument x can be omitted in which case the computer will
guess which symbol to use.
Enter
factor(x^3 + x^2 + x + 1)
Result
2
(1 + x) (1 + x )
Enter
factorial(100)
Result
93326215443944152681699238856266700490715968264381621468592963895217599993229915
608941463976156518286253697920827223758251185210916864000000000000000000000000
Enter
factorial(100) - 100!
Result
0
Enter
Y = A exp(-i k x) + B exp(i k x)
filter(Y exp(-i k x), x)
Result
B
Enter
float(100!)
Result
9.33262e+157
Enter
for(k,1,4,print(1/k,tab(10),1/k^2))
Result
1 1
1 1
--- ---
2 4
1 1
--- ---
3 9
1 1
--- ----
4 16
Enter
hermite(x,3)
Result
3
-12 x + 8 x
Enter
hilbert(3)
Result
1 1
1 --- ---
2 3
1 1 1
--- --- ---
2 3 4
1 1 1
--- --- ---
3 4 5
Enter imag(1 + exp(i pi/3)) Result 1/2 3^(1/2)
Enter
A = (A1,A2,A3)
B = (B1,B2,B3)
inner(A,B)
Result
A1 B1 + A2 B2 + A3 B3
Enter
integral(log(x),x)
Result
-x + x log(x)
Enter
A = ((a,b),(c,d))
inv(A)
Result
d b
----------- - -----------
a d - b c a d - b c
c a
- ----------- -----------
a d - b c a d - b c
Enter
isprime(9007199254740991)
Result
0
Enter
isprime(2^53 - 111)
Result
1
Enter
laguerre(x,2)
Result
1 2
1 - 2 x + --- x
2
Enter
laguerre(x,2,a)
Result
3 1 2 1 2
1 + --- a - 2 x - a x + --- a + --- x
2 2 2
Enter
lcm(4,6)
Result
12
Enter
lcm(4 x, 6 x y)
Result
12 x y
Enter
legendre(x,2)
Result
1 3 2
- --- + --- x
2 2
Enter
legendre(x,2,0)
Result
1 3 2
- --- + --- x
2 2
Enter
legendre(x,2,1)
Result
1/2
2
-3 x (1 - x )
Enter
log(-10.0)
Result
2.30259 + i π
Enter mag(1 + exp(i pi/3)) Result 3^(1/2)
Example
not(A = B)
Enter
numerator(a/b)
Result
a
Example
or(A = B, A = C)
Enter
A = (A1,A2,A3)
B = (B1,B2,B3)
outer(A,B)
Result
A1 B1 A1 B2 A1 B3
A2 B1 A2 B2 A2 B3
A3 B1 A3 B2 A3 B3
Enter
prime(1)
Result
2
Enter
prime(10000)
Result
104729
Enter
product(k,1,3,1/(1-(1/prime(k)^s)))
Result
1
----------------------------------
1 1 1
(1 - ----) (1 - ----) (1 - ----)
s s s
2 3 5
Enter
n = 3
n
Result
3
Enter
n = quote(n)
n
Result
n
Enter
U = (u1,u2,u3,u4)
rank(U)
Result
1
Enter
rationalize(1/x + 1/y)
Result
x + y
-------
x y
Rationalize can often simplify expressions.
Enter
A = ((a,b),(c,d))
B = inv(A)
dot(A,B)
Result
a d b c
----------- - ----------- 0
a d - b c a d - b c
a d b c
0 ----------- - -----------
a d - b c a d - b c
Enter
rationalize(last)
Result
1 0
0 1
Enter real(1 + exp(i pi/3)) Result 3/2
Enter rect(1 + exp(i pi/3)) Result 3/2 + 1/2 i 3^(1/2)
Enter
(x - 1/2) (x - 1/3) (x + 1/4) / x^3
Result
1 1 7
1 + ------- - ------- - ------
3 2 12 x
24 x 24 x
Enter
roots(last,x)
Result
1
- ---
4
1
---
3
1
---
2
Enter
roots(a x = b)
Result
b
---
a
Enter
roots(a x^2 + b x + c)
Result
1/2
2
b (-4 a c + b )
- ----- - ------------------
2 a 2 a
1/2
2
b (-4 a c + b )
- ----- + ------------------
2 a 2 a
This is converted to this n! / n (n - 1)! n (n - 1)! n! (n + 1)! / n! n + 1 (n + 2)! / n! (n + 1) (n + 2)Example 1.
Enter
F(n,k) = k binomial(n,k)
(F(n,k) + F(n,k-1)) / F(n+1,k)
Result
k! n! n! (1 - k + n)! k! n!
-------------------- + -------------------- - ----------------------
(-1 + k)! (1 + n)! (1 + n)! (-k + n)! k (-1 + k)! (1 + n)!
Enter
simfac
Result
1 1 - k + n 1
------- + ----------- - -------
1 + n 1 + n 1 + n
Enter
simplify
Result
n
-------
1 + n
Example 2. It may be necessary to rationalize or condense an expression first.
Enter
(n + 1) / (n + 1)!
Result
n 1
---------- + ----------
(1 + n)! (1 + n)!
Enter
simfac
Result
n 1
---------- + ----------
(1 + n)! (1 + n)!
Enter
rationalize
Result
1 + n
----------
(1 + n)!
Enter
simfac
Result
1
----
n!
Enter
(A-B)/(B-A)
Result
A B
-------- - --------
-A + B -A + B
Enter
simplify(last)
Result
-1
Enter
A = ((A11,A12),(A21,A22))
det(A) inv(A) - adj(A)
Result
((-A22 + A11 A22^2 / (A11 A22 - A12 A21) - A12 A21 A22 / (A11 A22 - A12 A21),
A12 - A11 A12 A22 / (A11 A22 - A12 A21) + A12^2 A21 / (A11 A22 - A12 A21)),
(A21 - A11 A21 A22 / (A11 A22 - A12 A21) + A12 A21^2 / (A11 A22 - A12 A21),
-A11 - A11 A12 A21 / (A11 A22 - A12 A21) + A11^2 A22 / (A11 A22 - A12 A21)))
Enter
simplify(last)
Result
0
The simplify function can return factored
(unexpanded)
expressions.
Factored expressions can fail in tests for equality.
The eval function can be used to expand factored expressions.
Enter
f = x^2
subst(sqrt(x),x,f)
Result
2
1/2
(x )
Enter
eval(last)
Result
x
Enter
sum(k,1,3,1/k^s)
Result
1 1
1 + ---- + ----
s s
2 3
Enter
taylor(1/cos(x),x,6)
Result
1 2 5 4 61 6
1 + --- x + ---- x + ----- x
2 24 720
Example
f(x) = test(x < 0, g(x), h(x))
Enter
A = ((a,b),(c,d))
trace(A)
Result
a + d
Note that trace is equivalent to contract.
Enter
trace(A) - contract(A,1,2)
Result
0
Enter
unit(4)
Result
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
Enter
u = (u1,u2,u3,u4)
v = (v1,v2,v3,v4)
wedge(u,v)
Result
0 u1 v2 - u2 v1 u1 v3 - u3 v1 u1 v4 - u4 v1
-u1 v2 + u2 v1 0 u2 v3 - u3 v2 u2 v4 - u4 v2
-u1 v3 + u3 v1 -u2 v3 + u3 v2 0 u3 v4 - u4 v3
-u1 v4 + u4 v1 -u2 v4 + u4 v2 -u3 v4 + u4 v3 0
Enter
wedge(u,v) + wedge(v,u)
Result
0
Enter
A = zero(2,2)
A[1,2] = a
A
Result
0 a
0 0