Вы находитесь на странице: 1из 11

# TAMUDFEQ 2.

2 Command Reference
COPYRIGHT c 2012 by Art Belmonte
Department of Mathematics, Texas A&M University
Sunday, 01 July 2012
the TAMUDFEQ package, refreshing libraries, and using preactivated templates.
3. For help, type h. in a template calculator app.
COL
Description The col function extracts a column from a matrix.
Access e.col library shortcut in the eigen group
Syntax e.col(M, k)
Input M: a matrix
k: a positive integer column index
Output the kth column of the matrix M
Example e.col
__
9 3
5 5
_
, 2
_
returns
_
3
5
_
.
CZP
Description The czp function computes the zeros of a polynomial along with their respective multiplicities.
Access l.czp library shortcut in the linear group
Syntax l.czp(q)
Input q: the coefcients of a polynomial in descending order (including zeros) expressed as a row vector or list; or a
polynomial in s
Output a table (matrix) with zeros of the polynomial in the rst column and respective multiplicities in the second column
Example Consider the polynomial s
5
s
4
+2s
3
2s
2
+s 1. The command l.czp
__
1 1 2 2 1 1
_
returns
_

_
"Zero" "Mult"
i 2
i 2
1 1
_

_
, as does l.czp({1, 1, 2, 2, 1, 1}) or l.czp
_
s
5
s
4
+2s
3
2s
2
+s 1
_
.
Note The acronym czp stands for (complex) zeros from a polynomial.
1
EIGENVECTS
Description The eigenvects function symbolically computes the eigenvector(s) associated with an eigenvalue of a matrix.
Access e.eigenvects library shortcut in the eigen group
Syntax e.eigenvects(A, r)
Input A: square matrix with constant elements
r: an eigenvalue of A
Output a basis for the eigenspace associated with the given eigenvalue as a matrix of column eigenvectors
Example Let A =
_

_
6 6 6 8
8 8 6 8
1 7 10 9
8 6 6 6
_

_
. The eigenvalues of A are 2, 2, 13i. (See the example for evmt.)
Then e.eigenvects(A, 2) returns
_

_
1 0
0 1
8 11
7 9
_

_
, the columns of which are eigenvectors of A associated with
the eigenvalue r =2. These eigenvectors form a basis for the eigenspace associated with this eigenvalue.
Analogously, e.eigenvects(A, 1+3i) returns
_

_
2
2
3i
2
_

_
.
Note This command invokes the corresponding command in the linalgcas library from Texas Instruments, then attempts
to provide fraction-free eigenvectors.
EVMT
Description The evmt function returns a table of the eigenvalues of a square matrix and their respective algebraic multiplicities.
Access e.evmt library shortcut in the eigen group
Syntax e.evmt(A)
Input A: square matrix with numerical elements
Output a table (matrix) with the eigenvalues of the matrix in the rst column and their respective algebraic multiplicities in
the second column
Example Let A =
_

_
6 6 6 8
8 8 6 8
1 7 10 9
8 6 6 6
_

_
. Then e.evmt(A) returns
_

_
"Eigvl" "Mult"
1+3i 1
13i 1
2 2
_

_
.
Note The acronym evmt stands for eigenvalue multiplicity table.
2
EXPMAT
Description The expmat function symbolically computes the matrix exponential function of a square matrix.
Access e.expmat library shortcut in the eigen group
Syntax e.expmat(A)
Input A: square matrix with constant coeffcients
Output the matrix exponential function e
tA
Example e.expmat(
_
1 1
4 5
_
) returns
_
(2t +1)e
3t
te
3t
4te
3t
(12t)e
3t
_
.
Note This command invokes the corresponding command in the linalgcas library from Texas Instruments.
GRAPH
Description The graph program prepares solutions of differential equations for graphing.
Access u.graph library shortcut in the utilities group
Syntax u.graph(solution)
Input solution: a scalar or a 21 column vector, possibly involving Heaviside unit step functions
Output For a scalar expression (t) or (x), the solution is stored into f 1(x) for function graphing.
For a column vector solution v(t) =
_
v
1
(t)
v
2
(t)
_
, the components of v are respectively stored into x1(t) and y1(t) for parametric
graphing.
Examples The commands u.graph(3t +4) or u.graph(y = 3t +4) or u.graph(3x +4) or u.graph(y = 3x +4) or u.graph({3z +4, z}) all
result in the expression 3x +4 being stored into f 1(x) for function graphing.
u.graph(
_
2cost
3sint
_
) results in 2cost and 3sint being respectively stored into x1(t) and y1(t) for parametric graphing.
See Also DESOLVE, MLT, SYSLAP (whose outputs can be fed into graph)
Note Function references to u() are changed to u(). The routine then denes the Heaviside unit step function as u(t) =
_
1, t 0
0, t < 0
.
ILAP
Description The ilap function computes the inverse Laplace transform of a scalar, vector, or matrix expression.
Access t.ilap library shortcut in the transform group
Syntax t.ilap(F)
Input F: a scalar, vector, or matrix expression in s
Output L
1
{F}, the inverse Laplace transform of F
Examples t.ilap
_
2s
_
s
2
+1
_
2
_
returns t sint.
t.ilap
_
_
_
_
_

_
5s 1
(s 1)
2
4s 2
(s 1)
2
_

_
_
_
_
_
returns
_
(4t +5)e
t
(2t +4)e
t
_
.
Note This command contains a new implementation of inverse Laplace transformation.
3
JMATRIX
Description The jmatrix function computes the Jacobian matrix of a transformation.
Access u.jmatrix library shortcut in the utilities group
Syntax u.jmatrix(T, v)
Input T: a pair of expressions in x and y specied as a row vector, [ f (x, y), g(x, y)]
v: the row vector [x, y]
Output The Jacobian matrix J =
_
f
x
f
y
g
x
g
y
_
Example u.jmatrix(
_
y x +x
2
, y 2x y

## , [x, y]) returns

_
2x 1 1
2y 12x
_
.
KERNELBASIS
Description The kernelbasis function returns a basis for the nullspace of a matrix.
Access e.kernelbasis library shortcut in the eigen group
Syntax e.kernelbasis(M
p
)
Input M
p
: Typically, the input is a matrix M=ArI raised to a positive integer power p, where r is an eigenvalue of A,
a square matrix with constant elements, and I is the identity matrix. Moreover, the geometric multiplicity of r is
less than its algebraic multiplicity.
Output a basis for the nullspace of M
p
as a collection of [generalized] eigenvectors associated with r as referenced above
Example Let A=
_

_
42 90 40 0
24 43 20 4
9 0 2 9
40 90 40 2
_

_
. The eigenvalues of A are r =3, 2, 2, 2. The algebraic multiplicity of r = 2
is thus 3, whereas its geometric multiplicity is 2 since e.eigenvects(A,2) yields
_

_
1 0
0 4
1 9
1 0
_

_
, the columns of which
are two linearly independent eigenvectors associated with r = 2. Now for r = 2, form
M=ArI =
_

_
40 90 40 0
24 45 20 4
9 0 0 9
40 90 40 0
_

_
. Then e.kernelbasis(M
2
) returns
_

_
1 0 0
0 4 0
1 9 0
1 0 1
_

_
. Hence
_

_
0
0
0
1
_

_
is a
generalized eigenvector for r = 2.
Note This command invokes the corresponding command in the linalgcas library from Texas Instruments, then attempts
to provide fraction-free (generalized) eigenvectors.
4
LAP
Description The lap function computes the Laplace transform of a scalar, vector, or matrix expression.
Access t.lap library shortcut in the transform group
Syntax t.lap(f )
Input f : a scalar, vector, or matrix expression in t
Output L{f }, the Laplace transform of f
Example t.lap(t sin(t)) returns
2s
(s
2
+1)
2
and t.lap
__
(4t +5)e
t
(2t +4)e
t
__
gives
_

_
5s 1
(s 1)
2
4s 2
(s 1)
2
_

_
.
Note This command contains a new implementation of Laplace transformation.
LDO
Description The ldo function constructs a linear differential operator from a row vector of its coefcients along with the
independent and dependent variables in which it is expressed.
Access l.ldo library shortcut in the linear group
Syntax l.ldo(L, t, y)
Input L: a row vector [a
n
(t), a
n1
(t), . . . , a
1
(t), a
0
(t)]of the coefcients (usually constants or else functions of the
independent variable) of the linear differential operator in descending order by derivative, including zero
coefcients
t: the independent variable of the linear differential operator
y: the dependent variable of the linear differential operator
Output the linear differential operator
n

k=0
a
k
(t)y
(k)
(t), where y
(k)
(t) =
d
k
y
dt
k
and y
(0)
(t) = y(t)
Example The command l.ldo([1, 0, 1, t] , t, y) returns
d
3
dt
3
(y(t)) +
d
dt
(y(t)) +ty(t).
Note The acronym ldo stands for linear differential operator.
5
LDOEVAL
Description The ldoeval program displays the result obtained when a linear differential operator acts on a given function or
collection of functions.
Access l.ldoeval library shortcut in the linear group
Syntax l.ldoeval(f , L, t, y)
Input f : a scalar expression or a row vector of expressions in the independent variable
L: a linear differential operator,
n

k=0
a
k
(t)y
(k)
(t), where y
(k)
(t) =
d
k
y
dt
k
and y
(0)
(t) = y(t); more typically, a variable
containing a linear differential operator
t: the independent variable of the linear differential operator
y: the dependent variable of the linear differential operator
Output The scalar or vector expression
n

k=0
a
k
(t) f
(k)
(t) is displayed. It is obtained by substituting f for y in the linear
differential operator
n

k=0
a
k
(t)y
(k)
(t).
Example The command l.ldo([1, 0, 1, t] , t, y)L followed by the command l.ldoeval(sin(t), L, t, y) displays t sint.
Similarly, the command l.ldo([1, 1, 4, 4] , x, y)L followed by the command
l.ldoeval([e
x
, cos(2x), sin(2x)] , L, x, y) displays [0, 0, 0].
Note The name ldoeval stands for linear differential operator evaluation.
LMR
Description The lmr function converts an equation to an expression understood to be set to zero.
Access l.lmr library shortcut in the linear group
Syntax l.lmr(q)
Input q: an equation, a list of equations, or a row vector of equations
Output an expression understood to be set to zero
Example The command u.lmr( (5a+5b)cost +(5b5a)sint = 7sint ) returns (5a+5b)cost +(5a+5b7)sint.
Notes The expression is obtained by taking the left-hand side of the equation and subtracting its right-hand side. The
name lmr stands for left minus right. The routine is used to collect coefcients in method of undetermined
coefcients problems.
6
LTLDO
Description The ltldo function returns the Laplace transform of a linear differential operator with constant coefcients and
associated initial conditions at t = 0.
Access t.ltldo library shortcut in the transform group
Syntax t.ltldo(d, i )
Input d: a row vector of the constant coefcients of a linear differential operator in descending order by derivative,
including zero coefcients
i : initial conditions at t = 0 of an nth order initial value problem in ascending order by derivative, expressed as a
row vector OR a scalar if there is only one initial condition
Output the Laplace transform of the linear differential operator followed by substitution of the initial conditions
Examples Given the linear differential operator y

(t) +5y

## (t) +6y(t) with initial conditions y(0) = 2 and y

(0) = 3, the
command t.ltldo([1, 5, 6] , [2, 3]) yields s
2
+(5 2)s +6 13 or
_
s
2
+5s +6
_
2s 13, which stands for
_
s
2
+5s +6
_
Y (s) 2s 13, the Laplace transform of the linear differential operator followed by substitution of the
initial conditions. Here =Y (s) =L (y(t)).
Note The acronym ltldo stands for Laplace transform of a linear differential operator.
MLT
Description The mlt function returns the solution of a system of linear differential equations.
Access t.mlt library shortcut in the transform group
Syntax t.mlt(A, f, t
0
, x
0
)
Input A: square matrix with constant coefcients
f : the [non]homogeneous part of the system; a column vector OR 0 (signifying a zero column vector)
t
0
: initial time value; a scalar
x
0
: initial condition; a column vector
Output the unique solution x to the initial value problem x

= Ax+f, x(t
0
) = x
0
Example Let A=
_
0 2
1 3
_
, f =
_
e
t
e
t
_
, t
0
= 0, and x
0
=
_
5
4
_
. Then t.mlt(A, f, t
0
, x
0
) yields
_
(4t +5)e
t
(2t +4)e
t
_
,
the unique solution to x

= Ax+f, x(t
0
) = x
0
.
Note The acronym mlt signies solution via the matrix Laplace transform method.
7
ODENUM
Description The odenum program computes numerical approximations of the solution of a rst order differential equation
with an initial condition; y

## = f (t, y), y(t

0
) = y
0
.
Access u.odenum library shortcut in the utilities group
Syntax u.odenum(o, f, s, y
0
, h)
Input o: order/method (1=Euler, 2=RK2, 4=RK4; see Note at bottom)
f : a string containing the name of the function that expresses the derivative of the dependent variable in terms of
the independent and dependent variables; i.e., y

= f (t, y)
s: a row vector [a, b] containing two numbers: the beginning and ending values of the independent variable for
which an approximate solution will be computed over the interval a t b
y
0
: the initial value of the dependent variable at t = a; either a number or a 21 column vector of numbers
h: the step size of the independent variable for the approximate solution
Output M: a matrix containing values of the approximate solution of the initial value problem, independent variable values
in the rst column, dependent variable values in the subsequent column(s)
tt: a list of independent variable values in ascending order from a to b in steps of h
yy: a list of dependent variable values corresponding to independent variable values (for the case of a scalar y) or a
list of the second dependent variable values (for the case of a vector y with two components)
xx: a list of rst dependent variable values corresponding to independent variable values (for the case of a vector y
with two components)
Examples Here are two problems, one scalar, one vector.
Let y

= f (t, y) = 5y, y(0) = 0, and h = 0.1. Then f(t,y):=5-y and u.odenum(1, f, [0.0, 0.5], 0, 0.1)
yield tt ={0.00, 0.10, 0.20, 0.30, 0.40, 0.50} and yy ={0.00, 0.50, 0.95, 1.36, 1.72, 2.05} to two decimal
places. The matrix M has t-values in the rst column and y-values in the second column.
Let x

= y, y

=x, x(0) = 1, y

## (0) =1, and h = 0.1. Assign u

1
= x and u
2
= y. Then u

1
= u
2
, u

2
=u
1
,
u
1
(0) = 1, u
2
(0) =1, or in system form
u

=
_
0 1
1 0
_
u, u(0) =
_
1
1
_
.
Enter f(t,u) :=
_
0 1
1 0
_
u followed by u0:=[1;-1]. Then u.odenum(4, f, [0.0, 6.3], u0, 0.1) yields
lists xx and yy. These may then be graphed in a scatter plot to produce a dotted circle of radius r =

2
centered at the origin. Adjust plot attributes to connect the dots if desired. You may also nd Zoom
In/Out/Fit/Square useful in framing the plot.
Show every n
th
row of the table M with u.odeshow(M, n) where n is a positive integer.
Note Eulers method is a 1st order method. RK2 (Improved Eulers) is a second order method. RK4 is the classical
Runge-Kutta 4th order method.
POT
Description The pot function determines whether the differential equation Pdx +Qdy = 0 is exact.
Access u.pot library shortcut in the utilities group
Syntax u.pot(w, v)
Input w: the vector eld [P, Q]
v: a row vector of independent variables with the same number of components as w; or 2 for [x, y]
Output a potential function f for w (i.e., w =

## f ) if w is conservative, whence f (x, y) =C is a solution; otherwise, false

Example u.pot([1ysinx, cosx], [x, y]) returns x +ycosx, as does u.pot([1ysinx, cosx], 2).
8
ROOF
Description The roof function returns a second linearly independent solution to a homogeneous linear second order ordinary
differential equation using a reduction of order formula (hence the acronym).
Access l.roof library shortcut in the linear group
Syntax l.roof(f, p, t)
Input f : a solution to a given homogeneous linear second-order ordinary differential equation that is in standard linear
form (SLF), y

+ py

+qy = 0
p: the coefcient of the rst derivative of the dependent variable in the SLF of the differential equation
t: the independent variable in the differential equation
Output a second linearly independent solution to the differential equation, given by the reduction of order formula
y = f
_
e

_
pdt
f
2
dt
Example Given that y = e
t
is a solution of the differential equation y

2y

## +y = 0, the command l.roof(e

t
, 2, t) yields te
t
,
a second linearly independent solution.
SYSLAP
Description The syslap function computes the solution of a [system of nth order] linear differential equation(s) with constant
coefcients and initial conditions via Laplace transform methods.
Access t.syslap library shortcut in the transform group
Syntax t.syslap(P, f, t
0
, i )
Input P: matrix of coefcients of linear differential operator(s)
f : the [non]homogeneous part(s) of the linear differential equation(s)
t
0
: initial time value
i : row(s) of initial conditions in ascending order by dependent variable(s)
Output the solution of the initial value problem specied by the data
Example The command t.syslap([1, 5] , 2u(t 3), 0, 1) yields y(t) = e
5t
_
1
2e
15
u(t 3)
5
_
+
2u(t 3)
5
, the solution to
the initial value problem y

+5y = 2u(t 3), y(0) = 1. Here u is the Heaviside unit step function.
Similarly, t.syslap([1, 5, 6] , e
t
cos(2t), 0, [2, 3]) yields the solution to the initial value problem
y

+5y

+6y = e
t
cos2t, y(0) = 2, y

(0) = 3;
namely,
y(t) =
2
65
e
t
cos2t +
7
130
e
t
sin2t +
114
13
e
2t

34
5
e
3t
.
9
TES
Description The tes function returns a truncated exponential series, as specied in the Output block below.
Access e.tes library shortcut in the eigen group
Syntax e.tes(A, r, w) or e.tes(A, r, I )
Input A: an nn square matrix with constant elements
r: an eigenvalue of A whose geometric multiplicity is less than its algebraic multiplicity
w: a generalized eigenvector associated with r
I : the nn identity matrix; or just enter 1 (one), which is much faster
Output The command returns either
e
rt
_
n1

k=0
t
k
k!
(ArI)
k
_
w,
a solution of x

= Ax, or
e
rt
_
n1

k=0
t
k
k!
(ArI)
k
_
I,
the latter of which gives the matrix exponential function e
tA
in the case that r is the lone eigenvalue of A.
Examples Let A=
_

_
42 90 40 0
24 43 20 4
9 0 2 9
40 90 40 2
_

_
. In the example for the kernelbasis command, w =
_

_
0
0
0
1
_

_
is seen to be a
generalized eigenvector for the eigenvalue r = 2 of A. Then e.tes(A, 2, w) yields
_

_
0
4te
2t
9te
2t
e
2t
_

_
, a linearly
independent solution of x

= Ax.
Similary, the matrix A=
_
1 1
4 5
_
has the lone eigenvalue r =3 with algebraic multiplicity 2 (for example,
via evmt). Then e.tes(A, 3, 1) yields e
tA
=
_
(2t +1)e
3t
te
3t
4te
3t
(12t)e
3t
_
. Note the shortcut 1 for the third
argument.
WRON
Description The wron function computes the Wronskian matrix of a fundamental solution set of an nth order linear differential
equation.
Access l.wron library shortcut in the linear group
Syntax l.wron(v, t)
Input v: a row vector whose elements constitute the fundamental solution set
t: the independent variable in which is v expressed
Output the Wronskian matrix consisting of the derivatives
d
k
v
dt
k
, k = 0, 1, . . . n1, as row vectors (zeroth derivative: v)
Example The command l.wron(
_
e
3t
, te
3t
, cos(2t), sin(2t)

, t) returns
_

_
e
3t
te
3t
cos2t sin2t
3e
3t
(3t +1)e
3t
2sin2t 2cos2t
9e
3t
(9t +6)e
3t
4cos2t 4sin2t
27e
3t
(27t +27)e
3t
8sin2t 8cos2t
_

_
.
10
YS
Description The ys function computes the Laplace transformY (s) =L {y(t)} of the solution y(t) of a constant coefcient
linear differential equation with initial conditions at zero.
Access t.ys library shortcut in the transform group
Syntax t.ys(d, f, i )
Input d: coefcients of left-hand side linear differential operator in descending order by derivative, including zeros
f : the [non]homogeneous right-hand side of the linear differential equation
i : a row vector of initial conditions at t = 0 in ascending order by derivative OR a scalar (if there is only one initial
condition)
Output the Laplace transformY (s) =L {y(t)} of the solution of the differential equation
Example The command t.ys(
_
1 5 6

, e
t
cos(2t),
_
2 3

) returns
2s
3
+9s
2
15s +64
(s
2
2s +5)(s
2
+5s +6)
.
See Also ILAP to obtain the solution y(t) from the transformY (s)
ZEXPAND
Description The zexpand function computes the complex partial fraction decomposition of a rational expression.
Access u.zexpand library shortcut in the utilities group
Syntax u.zexpand(r)
Input r: a rational expression in the variable s
Output the complex partial fraction decomposition of r
Example u.zexpand(
2s
3
+9s
2
15s +64
(s
2
2s +5)(s
2
+5s +6)
) returns
_
1
65
+
7
260
i
1
65

7
260
i
34
5
114
13
s 1+2i s 12i s +3 s +2
_
, which represents
1
65
+
7
260
i
s 1+2i
+
1
65

7
260
i
s 12i
+

34
5
s +3
+
114
13
s +2
.