0% found this document useful (0 votes)
78 views

Maple Matrix

The document demonstrates how to create and manipulate matrices in Maple. It shows how to: - Create matrices using various syntaxes - Get the dimensions, transpose, and perform operations like multiplication on matrices - Extract submatrices, minors, and the adjoint of a matrix - Calculate the trace, rank, determinant, and inverse of matrices - Create identity matrices of various sizes - Solve systems of linear equations using matrices
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views

Maple Matrix

The document demonstrates how to create and manipulate matrices in Maple. It shows how to: - Create matrices using various syntaxes - Get the dimensions, transpose, and perform operations like multiplication on matrices - Extract submatrices, minors, and the adjoint of a matrix - Calculate the trace, rank, determinant, and inverse of matrices - Create identity matrices of various sizes - Solve systems of linear equations using matrices
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

ΔΗΜΙΟΥΡΓΙΑ ΠΙΝΑΚΑ ΚΑΙ ΟΙ ΔΙΑΣΤΑΣΕΙΣ ΤΟΥ

> with(LinearAlgebra):
> A:=<<1,5,-3,9,7>|<-2,4,2,6,-3>|<8,5,6,3,-7>>;
⎡⎢ 1 -2 8⎤⎥
⎢⎢ 5 4 5⎥⎥
⎢ ⎥
A := ⎢⎢-3 2 6⎥⎥
⎢⎢ 9 6 3⎥⎥
⎢ ⎥
⎢⎣ 7 -3 -7⎥⎦

> A:=Matrix([[1,-2,8],[5,4,5],[-3,2,6],[9,6,3],[7,-3,-7]]);
⎡⎢ 1 -2 8⎤⎥
⎢⎢ 5 4 5⎥⎥
⎢ ⎥
A := ⎢⎢-3 2 6⎥⎥
⎢⎢ 9 6 3⎥⎥
⎢ ⎥
⎢⎣ 7 -3 -7⎥⎦

> m:=RowDimension(A);
m := 5
> n:=ColumnDimension(A);
n := 3
> m,n:=Dimension(A);
m, n := 5, 3

ΑΝΑΣΤΡΟΦΟΣ ΠΙΝΑΚΑΣ

> AN:=Transpose(A);
⎡⎢ 1 5 -3 9 7⎤⎥
AN := ⎢⎢-2 4 2 6 -3⎥⎥
⎢⎢ ⎥
⎣ 8 5 6 3 -7⎥⎦
ΠΡΑΞΕΙΣ ΠΙΝΑΚΩΝ

> M:=Multiply(A,AN);
⎡⎢ 69 37 41 21 -43⎤⎥
⎢⎢ 37 66 23 84 -12⎥⎥
⎢ ⎥
M := ⎢⎢ 41 23 49 3 -69⎥⎥
⎢⎢ 21 84 3 126 24⎥⎥
⎢⎢ ⎥⎥
⎣-43 -12 -69 24 107⎦
> N:=Multiply(AN,A);
⎡⎢165 45 -7⎤

N := ⎢⎢ 45 69 55⎥⎥
⎢⎢ ⎥
⎣ -7 55 183⎥⎦
> R:=Multiply(N,1/5);
⎡⎢ -7 ⎤⎥
33 9
⎢⎢ 5 ⎥⎥
⎢⎢ 69 ⎥⎥
R := ⎢⎢ 9 11 ⎥⎥
⎢⎢ 5 ⎥⎥
⎢⎢ -7 183 ⎥⎥
⎢ 11
⎣ 5 5 ⎥⎦
> T:=N-R;
⎡⎢ 132 -28 ⎤
36 ⎥
⎢⎢ 5 ⎥⎥
⎢⎢ 276 ⎥⎥
T := ⎢⎢ 36 44 ⎥⎥
⎢⎢ 5 ⎥⎥
⎢⎢ -28 732 ⎥⎥
44
⎢ 5
⎣ 5 ⎥⎦
> G:=T+R;
⎡⎢165 45 -7⎤

G := ⎢⎢ 45 69 55⎥⎥
⎢⎢ ⎥
⎣ -7 55 183⎥⎦
ΙΧΝΟΣ ΠΙΝΑΚΑ

> ta:=Trace(A);
Error, (in LinearAlgebra:-Trace) Matrix must be square

> B:=<<1,5,-3>|<-2,4,2>|<8,5,6>>;
⎡⎢ 1 -2 8⎤⎥
B := ⎢⎢ 5 4 5⎥⎥
⎢⎢ ⎥
⎣-3 2 6⎥⎦

> tb:=Trace(B);
tb := 11

ΒΑΘΜΟΣ ΠΙΝΑΚΑ

> ka:=Rank(A);
ka := 3
> kb:=Rank(B);
kb := 3

ΔΗΜΙΟΥΡΓΙΑ ΜΟΝΑΔΙΑΙΟΥ ΠΙΝΑΚΑ

> IdentityMatrix(4);
⎡⎢ 1 0 0 0⎤

⎢⎢ 0 1 0 0⎥⎥
⎢⎢ ⎥
⎢⎢ 0 0 1 0⎥⎥
⎣0 0 0 1⎥⎦

> IdentityMatrix(9);
⎡⎢1 0 0 0 0 0 0 0 0⎤

⎢⎢0 1 0 0 0 0 0 0 0⎥⎥
⎢⎢ ⎥
⎢⎢0 0 1 0 0 0 0 0 0⎥⎥
⎢⎢0 0 0 1 0 0 0 0 0⎥⎥
⎢⎢0 ⎥
0 0 0 1 0 0 0 0⎥⎥
⎢⎢ ⎥
⎢⎢0 0 0 0 0 1 0 0 0⎥⎥
⎢⎢0 ⎥
0 0 0 0 0 1 0 0⎥⎥
⎢⎢0 0 0 0 0 0 0 1 0⎥⎥
⎢⎢ ⎥
⎣0 0 0 0 0 0 0 0 1⎥⎦

> IdentityMatrix(3,5);
⎡⎢1 0 0 0 0⎤⎥
⎢⎢0 1 0 0 0⎥⎥
⎢⎢ ⎥
⎣0 0 1 0 0⎥⎦
> IdentityMatrix(5,3);
⎡⎢ 1 0 0⎤

⎢⎢ 0 1 0⎥⎥
⎢⎢ ⎥
⎢⎢ 0 0 1⎥⎥
⎢⎢ 0 0 0⎥⎥
⎢0 ⎥
⎣ 0 0⎥⎦

ΕΛΑΣΣΟΝΕΣ ΠΙΝΑΚΕΣ

> A11:=Minor(A,1,1);
⎡⎢ 4 5⎤⎥
⎢ 2 6⎥⎥
A11 := ⎢⎢
⎢⎢ 6 3⎥⎥⎥
⎢-3 -7⎥
⎣ ⎦
> A12:=Minor(A,1,2);
⎡⎢ 5 5⎤⎥
⎢-3 6⎥⎥
A12 := ⎢⎢
⎢⎢ 9 3⎥⎥⎥
⎢ 7 -7⎥
⎣ ⎦
> A13:=Minor(A,1,3);
⎡⎢ 5 4⎤⎥
⎢-3 2⎥⎥
A13 := ⎢⎢
⎢⎢ 9 6⎥⎥⎥
⎢ 7 -3⎥
⎣ ⎦
> A43:=Minor(A,4,3);
⎡⎢ 1 -2⎤⎥
⎢ 5 4⎥⎥
A43 := ⎢⎢
⎢⎢-3 2⎥⎥⎥
⎢⎣ 7 -3⎥⎦

> A52:=Minor(A,5,2);
⎡⎢ 1 8⎤

⎢ 5 5⎥⎥
A52 := ⎢⎢ ⎥
⎢⎢ -3 6⎥⎥
⎢⎣ 9 3⎥⎦

> B23:=Minor(B,2,3);
1 -2⎤
B23 := ⎡⎢⎢ ⎥
⎣-3 2⎥⎦
> B32:=Minor(B,3,2);
1 8⎤
B32 := ⎡⎢⎢ ⎥
⎣5 5⎥⎦

ΚΛΑΣΣΙΚΟΣ ΠΡΟΣΑΡΤΗΜΕΝΟΣ ΠΙΝΑΚΑΣ

> As:=Adjoint(A);
Error, (in LinearAlgebra:-LA_Main:-Adjoint) Matrix must be square

> Bs:=Adjoint(B);
⎡⎢ 14 28 -42⎤⎥
Bs := ⎢⎢-45 30 35⎥⎥
⎢⎢⎣ 22 4 14⎥⎥⎦
ΟΡΙΖΟΥΣΑ ΠΙΝΑΚΑ

> db:=Determinant(B);
db := 280

ΑΝΤΙΣΤΡΟΦΟΣ ΠΙΝΑΚΑΣ

> ANT:=MatrixInverse(B);
⎡⎢ 1 1 -3 ⎤⎥
⎢⎢ 20 10 20 ⎥⎥
⎢⎢ -9 3 1 ⎥⎥
ANT := ⎢⎢ ⎥⎥
⎢⎢ 56 28 8 ⎥⎥
⎢⎢ 11 1 1 ⎥⎥
⎢ 140 70 20 ⎥
⎣ ⎦

> Ant:=Multiply(Bs,1/280);

⎡⎢ 1 1 -3 ⎤⎥
⎢⎢ 20 10 20 ⎥⎥
⎢⎢ -9 3 1 ⎥⎥
Ant := ⎢⎢ ⎥⎥
⎢⎢ 56 28 8 ⎥⎥
⎢⎢ 11 1 1 ⎥⎥
⎢ 140 70 20 ⎥
⎣ ⎦
ΓΡΑΜΜΙΚΑ ΣΥΣΤΗΜΑΤΑ

2 x1 − x2 + x3 = 6
Πχ. −3 x1 + x2 + x3 = 4
x1 + 2 x2 − 2 x3 = −2

> with(LinearAlgebra):
sys := [ 2*x[1]-x[2]+x[3] = 6,
-3*x[1]+x[2]+x[3]= 4,
x[1]+2*x[2]-2*x[3]= -2 ]:
var := [ x[1], x[2], x[3] ]:
(A, b) := GenerateMatrix( sys, var );

⎡⎢ 2 -1 1⎤⎥ ⎡⎢ 6⎤⎥
A, b := ⎢⎢-3 1 1⎥⎥, ⎢⎢ 4⎥⎥
⎢⎢ ⎥ ⎢ ⎥
⎣ 1 2 -2⎥⎦ ⎢⎣ -2⎥⎦
> A . Vector(var) = b;
⎡⎢ 2 x1 − x2 + x3 ⎤⎥ ⎡ 6⎤
⎢⎢ −3 x + x + x ⎥⎥ ⎢⎢ ⎥⎥
⎢⎢ 1 2 3 ⎥ = ⎢ 4⎥
⎢ ⎥
⎢⎢x + 2 x − 2 x ⎥⎥⎥ ⎢⎣ -2⎥⎦
⎣ 1 2 3⎦

Γράφω άμμεσα τον πίνακα Α και το διάνυσμα b

> A:=<<2,-1,3>|<-1,1,2>|<1,1,-2>>;
⎡⎢ 2 -1 1⎤⎥
A := ⎢⎢-1 1 1⎥⎥
⎢⎢ ⎥
⎣ 3 2 -2⎥⎦
> b:=<6,4,-2>;
⎡⎢ 6⎤⎥
b := ⎢⎢ 4⎥⎥
⎢⎢ ⎥⎥
⎣ -2⎦

> GenerateEquations(A,[x1,x2,x3],b);
[ 2 x1 − x2 + x3 = 6, −x1 + x2 + x3 = 4, 3 x1 + 2 x2 − 2 x3 = -2 ]
Δημιουργία του επαυξημένου πίνακα A b

> Ab=<A|b>;
⎡⎢ 2 -1 1 6⎤⎥
Ab = ⎢⎢-3 1 1 4⎥⎥
⎢⎢ ⎥
⎣ 1 2 -2 -2⎥⎦

Εύρεση των λύσεων

> LinearSolve(A,b);
⎡⎢ 2⎤⎥
⎢⎢ 4⎥⎥
⎢⎢ ⎥⎥
⎣ 6⎦

Εύρεση των λύσεων με τη μέθοδο του GAUSS

> ReducedRowEchelonForm(<A|b>);

⎡⎢ 1 0 0 2⎤⎥
⎢⎢ 0 1 0 4⎥⎥
⎢⎢ ⎥
⎣ 0 0 1 6⎥⎦
ΧΑΡΑΚΤΗΡΙΣΤΙΚΕΣ ΡΙΖΕΣ ΚΑΙ ΧΑΡΑΚΤΗΡΙΣΤΙΚΑ ΔΙΑΝΥΣΜΑΤΑ

> A:=<<1,4,0>|<1,1,0>|<5,3,1>>;
⎡⎢ 1 1 5⎤

A := ⎢⎢ 4 1 3⎥⎥
⎢⎢ ⎥
⎣0 0 1⎥⎦
Χαρακτηριστικός πίνακας

> C:=CharacteristicMatrix(A,lambda);

⎡⎢−λ + 1 1 5 ⎤


C := ⎢ 4 −λ + 1 3 ⎥⎥
⎢⎢ ⎥
⎣ 0 0 −λ + 1⎥⎦

Χαρακτηριστικό πολυώνυμο
> P(lambda):=CharacteristicPolynomial(A,lambda);
P( λ ) := λ 3 − 3 λ 2 − λ + 3

Χαρακτηριστικές τιμές ή ρίζες


> Eigenvalues(A);
⎡⎢ -1⎤⎥
⎢⎢ 1⎥⎥
⎢⎢ ⎥⎥
⎣ 3⎦

Χαρακτηριστικά διανύσματα

> Eigenvectors(A);
⎡⎢ 1 1 1⎤
⎥⎥
⎡⎢ 1⎤ ⎢⎢ 20
⎥ 2 -2⎥⎥
⎢⎢ 3⎥⎥, ⎢⎢ 3 ⎥⎥
⎢⎢ ⎥ ⎢ ⎥
-1⎥⎦ ⎢⎢ -4
⎣ ⎢⎢ 0 0⎥⎥⎥
⎣ 3 ⎦
Θετικά και αρνητικά ορισμένος πίνακας

> A:=<<1,4,0>|<1,1,0>|<5,3,1>>;
⎡⎢ 1 1 5⎤

A := ⎢⎢ 4 1 3⎥⎥
⎢⎢ ⎥
⎣0 0 1⎥⎦

> IsDefinite(A, ‘query’ = ‘positive_definite’);

false

> IsDefinite(A, ‘query’ = ‘positive_semidefinite’);

false

> IsDefinite(A, ‘query’ = ‘negative_definite’);

false

> IsDefinite(A, ‘query’ = ‘negative_semidefinite’);

false

You might also like