Applications, Examples and Libraries

Share your work here

Um den Studierenden zu helfen, deren Mathematikkenntnisse nicht auf dem von Studienanfängern erwarteten Niveau waren, hat die TU Wien einen Auffrischungskurs mit Maple T.A. entwickelt.  Die vom Team der TU Wien ausgearbeiteten Fragen zu mathematischen Themen wie der Integralrechnung, linearen Funktionen, der Vektoranalysis, der Differentialrechnung und der Trigonometrie, sind in die Maple T.A. Cloud übernommen worden.  Außerdem haben wir diesen Inhalt als Kursmodul zur Verfügung gestellt.

Laden Sie das Kursmodul der TU Wien herunter.

Bei Interesse können Sie mehr über das Projekt der TU Wien in diesem Anwenderbericht lesen: Erfolgreiches Auffrischen von Mathematikkenntnissen an der Technischen Universität Wien mit Maple T.A.

Jonny
Maplesoft Product Manager, Maple T.A.

Here's a simple package for drawing knot diagrams and computing the Alexander polynomial. A typical usage case for the AlexanderPolynomial function is when a knot needs to be identified and only a visual representation of the knot is available. Then it's trivial to write down the Dowker sequence by hand and then the sequence can be used as an input for this package. The KnotDiagram function also takes the Dowker sequence as an input.

 

TorusKnot(p, q) and PretzelKnot(p, q, r) are accepted as an input as well and can also be passed to the DowkerNotation function.

 

The algorithm is fairly simple, it works as follows: represent each double point as a quadrilateral (two 'in' vertices and two 'out' vertices); connect the quads according to the Dowker specification; draw the result as a planar graph; erase the sides of each quad and draw its diagonals instead. This draws the intersections corresponding to the double points and guarantees that there are no other intersections. The knot polynomial is then computed from the diagram.

 

The diagrams work fairly well for pretzel knots, but for certain knots they can be difficult to read because some of the quads around the double points can become too small or too skewed. Also, the code doesn't check that the generated quadrilaterals are convex (which is an implicit assumption in the algorithm).

 

knot.txt

knot.mw

read "c:/math/prg/maple/knot.txt"

_m489214528

(1)

with(Knots)

[AlexanderPolynomial, DowkerNotation, KnotDiagram]

(2)

AlexanderPolynomial([6, 8, 10, 2, 4], t)

t^4-t^3+t^2-t+1

(3)

AlexanderPolynomial([4, 10, 14, 12, 2, 8, 6], t)

3*t^2-5*t+3

(4)

AlexanderPolynomial([6, 18, 16, 14, -20, 4, 2, 22, 12, -8, -10], t)

2*t^6-11*t^5+24*t^4-31*t^3+24*t^2-11*t+2

(5)

KnotDiagram([10, 12, -20, -16, -18, 2, 22, 24, -8, -4, -6, 14])

 

AlexanderPolynomial([10, 12, -20, -16, -18, 2, 22, 24, -8, -4, -6, 14], t)

t^10-t^9-t^8+6*t^7-11*t^6+13*t^5-11*t^4+6*t^3-t^2-t+1

(6)

AlexanderPolynomial([4, 8, 10, 16, 2, 18, 20, 22, 6, 14, 12], t)

2*t^6-11*t^5+25*t^4-31*t^3+25*t^2-11*t+2

(7)

DowkerNotation(TorusKnot(5, 4))

[-24, -10, 20, -30, -16, 26, -6, -22, 2, -12, -28, 8, -18, -4, 14]

(8)

KnotDiagram(TorusKnot(5, 4))

 

AlexanderPolynomial(TorusKnot(p, q), t); 1; simplify(subs([p = 5, q = 4], %))

(t^(p*q)-1)*(t-1)/((t^p-1)*(t^q-1))

 

t^12-t^11+t^8-t^6+t^4-t+1

(9)

DowkerNotation(PretzelKnot(3, -4, 5))

[-16, -14, 20, 22, 24, 18, -4, -2, 10, 12, 6, 8]

(10)

KnotDiagram(PretzelKnot(3, -4, 5))

 

AlexanderPolynomial(PretzelKnot(p, q, r), t)

piecewise(p::odd and q::odd and r::odd, piecewise(p*q+p*r+q*r <> -1, (1/4)*signum(p*q+p*r+q*r+1)*((p*q+p*r+q*r)*(t^2-2*t+1)+t^2+2*t+1), 1), AlexanderPolynomial(PretzelKnot(p, q, r), t))

(11)

eval(%, [p = 3, q = -4, r = 5])

2*t^8-3*t^7+2*t^6-t^5+t^4-t^3+2*t^2-3*t+2

(12)

 

Download knot.mw

knot.txt

ABSTRACT. In this paper we demonstrate how the simulation of dynamic systems engineering has been implemented with graphics software algorithms using maple and MapleSim. Today, many of our researchers the computational modeling performed by inserting a piece of code from static work; with these packages we have implemented through the automation components of kinematics and dynamics of solids simple to complex.

It is very important to note that once developed equations study; recently we can move to the simulation; to thereby start the physical construction of the system. We will use mathematical and computational methods using the embedded buttons which lie in the dynamics leaves and viewing platform cloud of Maplesoft and power MapleNet for online evaluation of specialists in the area. Finally they will see some work done; which integrate various mechanical and computational concepts implemented for companies in real time and pattern of credibility.

 

Selasi_2015.pdf

(in spanish)

 

Lenin Araujo Castillo

 

 

I have two linear algebra texts [1, 2]  with examples of the process of constructing the transition matrix Q that brings a matrix A to its Jordan form J. In each, the authors make what seems to be arbitrary selections of basis vectors via processes that do not seem algorithmic. So recently, while looking at some other calculations in linear algebra, I decided to revisit these calculations in as orderly a way as possible.

 

First, I needed a matrix A with a prescribed Jordan form. Actually, I started with a Jordan form, and then constructed A via a similarity transform on J. To avoid introducing fractions, I sought transition matrices P with determinant 1.

 

Let's begin with J, obtained with Maple's JordanBlockMatrix command.

 

• 

Tools_Load Package: Linear Algebra

Loading LinearAlgebra

J := JordanBlockMatrix([[2, 3], [2, 2], [2, 1]])

Matrix([[2, 1, 0, 0, 0, 0], [0, 2, 1, 0, 0, 0], [0, 0, 2, 0, 0, 0], [0, 0, 0, 2, 1, 0], [0, 0, 0, 0, 2, 0], [0, 0, 0, 0, 0, 2]])

 

``

The eigenvalue lambda = 2 has algebraic multiplicity 6. There are sub-blocks of size 3×3, 2×2, and 1×1. Consequently, there will be three eigenvectors, supporting chains of generalized eigenvectors having total lengths 3, 2, and 1. Before delving further into structural theory, we next find a transition matrix P with which to fabricate A = P*J*(1/P).

 

The following code generates random 6×6 matrices of determinant 1, and with integer entries in the interval [-2, 2]. For each, the matrix A = P*J*(1/P) is computed. From these candidates, one A is then chosen.

 

L := NULL:

 

 

After several such trials, the matrix A was chosen as

 

A := Matrix(6, 6, {(1, 1) = -8, (1, 2) = -8, (1, 3) = 4, (1, 4) = -8, (1, 5) = -1, (1, 6) = 5, (2, 1) = -1, (2, 2) = 3, (2, 3) = 1, (2, 4) = -2, (2, 5) = 2, (2, 6) = -1, (3, 1) = -13, (3, 2) = -9, (3, 3) = 8, (3, 4) = -11, (3, 5) = 1, (3, 6) = 5, (4, 1) = 3, (4, 2) = 3, (4, 3) = -1, (4, 4) = 4, (4, 5) = 1, (4, 6) = -2, (5, 1) = 7, (5, 2) = 5, (5, 3) = -3, (5, 4) = 6, (5, 5) = 2, (5, 6) = -3, (6, 1) = -6, (6, 2) = -2, (6, 3) = 3, (6, 4) = -7, (6, 5) = 2, (6, 6) = 3})

 

 

for which the characteristic and minimal polynomials are

 

factor(CharacteristicPolynomial(A, lambda))

(lambda-2)^6

factor(MinimalPolynomial(A, lambda))

(lambda-2)^3

 

 

So, if we had started with just A, we'd now know that the algebraic multiplicity of its one eigenvalue lambda = 2 is 6, and there is at least one 3×3 sub-block in the Jordan form. We would not know if the other sub-blocks were all 1×1, or a 1×1 and a 2×2, or another 3×3. Here is where some additional theory must be invoked.

``

The null spaces M[k] of the matrices (A-2*I)^k are nested: `&sub;`(`&sub;`(M[1], M[2]), M[3]) .. (), as depicted in Figure 1, where the vectors a[k], k = 1, () .. (), 6, are basis vectors.

 

Figure 1   The nesting of the null spaces M[k] 

 

 

The vectors a[1], a[2], a[3] are eigenvectors, and form a basis for the eigenspace M[1]. The vectors a[k], k = 1, () .. (), 5, form a basis for the subspace M[2], and the vectors a[k], k = 1, () .. (), 6, for a basis for the space M[3], but the vectors a[4], a[5], a[6] are not yet the generalized eigenvectors. The vector a[6] must be replaced with a vector b[6] that lies in M[3] but is not in M[2]. Once such a vector is found, then a[4] can be replaced with the generalized eigenvector `&equiv;`(b[4], (A-2*I)^2)*b[6], and a[1] can be replaced with `&equiv;`(b[1], A-2*I)*b[4]. The vectors b[1], b[4], b[6] are then said to form a chain, with b[1] being the eigenvector, and b[4] and b[6] being the generalized eigenvectors.

 

If we could carry out these steps, we'd be in the state depicted in Figure 2.

 

Figure 2   The null spaces M[k] with the longest chain determined

 

 

Next, basis vector a[5] is to be replaced with b[5], a vector in M[2] but not in M[1], and linearly independent of b[4]. If such a b[5] is found, then a[2] is replaced with the generalized eigenvector `&equiv;`(b[2], A-2*I)*b[5]. The vectors b[2] and b[5] would form a second chain, with b[2] as the eigenvector, and b[5] as the generalized eigenvector.

``

Define the matrix C = A-2*I by the Maple calculation

 

C := A-2

Matrix([[-10, -8, 4, -8, -1, 5], [-1, 1, 1, -2, 2, -1], [-13, -9, 6, -11, 1, 5], [3, 3, -1, 2, 1, -2], [7, 5, -3, 6, 0, -3], [-6, -2, 3, -7, 2, 1]])

 

``

and note

 

N := convert(NullSpace(C), list)

[Vector(6, {(1) = 1/2, (2) = 1/2, (3) = 1, (4) = 0, (5) = 0, (6) = 1}), Vector(6, {(1) = -1/2, (2) = -1/2, (3) = -2, (4) = 0, (5) = 1, (6) = 0}), Vector(6, {(1) = -2, (2) = 1, (3) = -1, (4) = 1, (5) = 0, (6) = 0})]

NN := convert(LinearAlgebra:-NullSpace(C^2), list)

[Vector(6, {(1) = 2/5, (2) = 0, (3) = 0, (4) = 0, (5) = 0, (6) = 1}), Vector(6, {(1) = 0, (2) = 0, (3) = 0, (4) = 0, (5) = 1, (6) = 0}), Vector(6, {(1) = -1, (2) = 0, (3) = 0, (4) = 1, (5) = 0, (6) = 0}), Vector(6, {(1) = 2/5, (2) = 0, (3) = 1, (4) = 0, (5) = 0, (6) = 0}), Vector(6, {(1) = -3/5, (2) = 1, (3) = 0, (4) = 0, (5) = 0, (6) = 0})]

 

``

The dimension of M[1] is 3, and of M[2], 5. However, the basis vectors Maple has chosen for M[2] do not include the exact basis vectors chosen for M[1].

 

We now come to the crucial step, finding b[6], a vector in M[3] that is not in M[2] (and consequently, not in M[1] either). The examples in [1, 2] are simple enough that the authors can "guess" at the vector to be taken as b[6]. What we will do is take an arbitrary vector in M[3] and project it onto the 5-dimensional subspace M[2], and take the orthogonal complement as b[6].

``

A general vector in M[3] is

 

Z := `<,>`(u || (1 .. 6))

Vector[column]([[u1], [u2], [u3], [u4], [u5], [u6]])

 

``

A matrix that projects onto M[2] is

 

P := ProjectionMatrix(NN)

Matrix([[42/67, -15/67, 10/67, -25/67, 0, 10/67], [-15/67, 58/67, 6/67, -15/67, 0, 6/67], [10/67, 6/67, 63/67, 10/67, 0, -4/67], [-25/67, -15/67, 10/67, 42/67, 0, 10/67], [0, 0, 0, 0, 1, 0], [10/67, 6/67, -4/67, 10/67, 0, 63/67]])

 

``

The orthogonal complement of the projection of Z onto M[2] is then -P*Z+Z. This vector can be simplified by choosing the parameters in Z appropriately. The result is taken as b[6].

 

b[6] := 67*(eval(Z-Typesetting:-delayDotProduct(P, Z), Equate(Z, UnitVector(1, 6))))*(1/5)

Vector[column]([[5], [3], [-2], [5], [0], [-2]])

NULL

 

``

The other two members of this chain are then

 

b[4] := Typesetting:-delayDotProduct(C, b[6])

Vector[column]([[-132], [-12], [-169], [40], [92], [-79]])

b[1] := Typesetting:-delayDotProduct(C, b[4])

Vector[column]([[-67], [134], [67], [67], [0], [134]])

 

``

A general vector in M[2] is a linear combination of the five vectors that span the null space of C^2, namely, the vectors in the list NN. We obtain this vector as

 

ZZ := add(u || k*NN[k], k = 1 .. 5)

Vector[column]([[(2/5)*u1-u3+(2/5)*u4-(3/5)*u5], [u5], [u4], [u3], [u2], [u1]])

 

``

A vector in M[2] that is not in M[1] is the orthogonal complement of the projection of ZZ onto the space spanned by the eigenvectors spanning M[1] and the vector b[4]. This projection matrix is

 

PP := LinearAlgebra:-ProjectionMatrix(convert(`union`(LinearAlgebra:-NullSpace(C), {b[4]}), list))

Matrix([[69/112, -33/112, 19/112, -17/56, 0, 19/112], [-33/112, 45/112, 25/112, 13/56, 0, 25/112], [19/112, 25/112, 101/112, 1/56, 0, -11/112], [-17/56, 13/56, 1/56, 5/28, 0, 1/56], [0, 0, 0, 0, 1, 0], [19/112, 25/112, -11/112, 1/56, 0, 101/112]])

 

``

The orthogonal complement of ZZ, taken as b[5], is then

 

b[5] := 560*(eval(ZZ-Typesetting:-delayDotProduct(PP, ZZ), Equate(`<,>`(u || (1 .. 5)), LinearAlgebra:-UnitVector(4, 5))))

Vector[column]([[-9], [-59], [17], [58], [0], [17]])

 

``

Replace the vector a[2] with b[2], obtained as

 

b[2] := Typesetting:-delayDotProduct(C, b[5])

Vector[column]([[251], [-166], [197], [-139], [-112], [-166]])

 

 

The columns of the transition matrix Q can be taken as the vectors b[1], b[4], b[6], b[2], b[5], and the eigenvector a[3]. Hence, Q is the matrix

 

Q := `<|>`(b[1], b[4], b[6], b[2], b[5], N[3])

Matrix([[-67, -132, 5, 251, -9, -2], [134, -12, 3, -166, -59, 1], [67, -169, -2, 197, 17, -1], [67, 40, 5, -139, 58, 1], [0, 92, 0, -112, 0, 0], [134, -79, -2, -166, 17, 0]])

 

``

Proof that this matrix Q indeed sends A to its Jordan form consists in the calculation

 

1/Q.A.Q = Matrix([[2, 1, 0, 0, 0, 0], [0, 2, 1, 0, 0, 0], [0, 0, 2, 0, 0, 0], [0, 0, 0, 2, 1, 0], [0, 0, 0, 0, 2, 0], [0, 0, 0, 0, 0, 2]])``

 

NULL

The bases for M[k], k = 1, 2, 3, are not unique. The columns of the matrix Q provide one set of basis vectors, but the columns of the transition matrix generated by Maple, shown below, provide another.

 

JordanForm(A, output = 'Q')

Matrix([[-5, -43/5, -9/5, 7/5, -14/5, -3/5], [10, -4/5, -6/25, 1/5, -6/25, -3/25], [5, -52/5, -78/25, 13/5, -78/25, -39/25], [5, 13/5, 38/25, -2/5, 38/25, 4/25], [0, 6, 42/25, -1, 42/25, 21/25], [10, -29/5, -11/25, 1/5, -11/25, 7/25]])

 

``

I've therefore added to my to-do list the investigation into Maple's algorithm for determining an appropriate set of basis vectors that will support the Jordan form of a matrix.

 

References

 

NULL

[1] Linear Algebra and Matrix Theory, Evar Nering, John Wiley and Sons, Inc., 1963

[2] Matrix Methods: An Introduction, Richard Bronson, Academic Press, 1969

 

NULL

``

Download JordanForm_blog.mw

Some time ago, @marc005 asked how he could send an email from the Maple command line.

Why would you want to do this? Using Maple's functionality, you could programatically construct an email - perhaps with the results of a computation - and email it yourself or someone else.

I originally posted a solution that involved communicating with a locally-installed SMTP server using the Sockets package. But of course, you need to set up an SMTP server and ensure the appropriate ports are open.

I recently found a better solution. Mailgun (http://mailgun.com) is a free email delivery service with an web-based API. You can communicate with this API via the URL package; simply send Mailgun a URL:-Post() message that contains account-specific information, and the text of your email.

The general steps and Maple commands are given below, and you can download the worksheet here.

Note: Maplesoft have no affiliation with Mailgun.

Step 1:
Sign up for a free Mailgun account.

Step 2:
In your Mailgun account, go to the Domains section - it should look like the screengrab below (account-specific information has been blanked).