> restart;
 

> with(LinearAlgebra):
 

NVP Ø55, Ø62, Ø63 

> Determinant(<<2 | -1>, <1 | 1>>);
 

3 (1.1)
 

> Determinant(<<2 | -2 | 3>, <4 | 3 | 1>, <2 | 0 | 1>>);
 

-8 (1.2)
 

> Determinant(<<1 | 2 | 1>, <1 | sqrt(2) | 1>, <1 | 1/2 | 1>>);
 

0 (1.3)
 

> Determinant(<<1 | 0 | 0 | 1>, <2 | 2 | 2 | 2>, <3 | 3 | 0 | 4>, <4 | 0 | 0 | 8>>);
 

-24 (1.4)
 

> Determinant(<<1 | 2 | 3 | 4>, <0 | 2 | 3 | 0>, <0 | 2 | 0 | 0>, <1 | 2 | 4 | 8>>);
 

-24 (1.5)
 

> Determinant(<<-t | 1 | 1>, <1 | -t | 1>, <1 | 1 | -t>>);
 

`+`(`-`(`*`(`^`(t, 3))), `*`(3, `*`(t)), 2) (1.6)
 

> solve(%=0,t);
 

2, -1, -1 (1.7)
 

>
 

Determinantformler 2-5 

> Determinant(Matrix(2,2,symbol=a));
 

`+`(`*`(a[1, 1], `*`(a[2, 2])), `-`(`*`(a[1, 2], `*`(a[2, 1])))) (2.1)
 

> Determinant(Matrix(3,3,symbol=a));
 

`+`(`*`(a[1, 1], `*`(a[2, 2], `*`(a[3, 3]))), `-`(`*`(a[1, 1], `*`(a[2, 3], `*`(a[3, 2])))), `*`(a[2, 1], `*`(a[3, 2], `*`(a[1, 3]))), `-`(`*`(a[2, 1], `*`(a[1, 2], `*`(a[3, 3])))), `*`(a[3, 1], `*`(a... (2.2)
 

> Determinant(Matrix(4,4,symbol=a));
 

`+`(`*`(a[1, 1], `*`(a[2, 2], `*`(a[3, 3], `*`(a[4, 4])))), `-`(`*`(a[1, 1], `*`(a[2, 2], `*`(a[3, 4], `*`(a[4, 3]))))), `*`(a[1, 1], `*`(a[3, 2], `*`(a[4, 3], `*`(a[2, 4])))), `-`(`*`(a[1, 1], `*`(a[...
`+`(`*`(a[1, 1], `*`(a[2, 2], `*`(a[3, 3], `*`(a[4, 4])))), `-`(`*`(a[1, 1], `*`(a[2, 2], `*`(a[3, 4], `*`(a[4, 3]))))), `*`(a[1, 1], `*`(a[3, 2], `*`(a[4, 3], `*`(a[2, 4])))), `-`(`*`(a[1, 1], `*`(a[...
`+`(`*`(a[1, 1], `*`(a[2, 2], `*`(a[3, 3], `*`(a[4, 4])))), `-`(`*`(a[1, 1], `*`(a[2, 2], `*`(a[3, 4], `*`(a[4, 3]))))), `*`(a[1, 1], `*`(a[3, 2], `*`(a[4, 3], `*`(a[2, 4])))), `-`(`*`(a[1, 1], `*`(a[...
`+`(`*`(a[1, 1], `*`(a[2, 2], `*`(a[3, 3], `*`(a[4, 4])))), `-`(`*`(a[1, 1], `*`(a[2, 2], `*`(a[3, 4], `*`(a[4, 3]))))), `*`(a[1, 1], `*`(a[3, 2], `*`(a[4, 3], `*`(a[2, 4])))), `-`(`*`(a[1, 1], `*`(a[...
`+`(`*`(a[1, 1], `*`(a[2, 2], `*`(a[3, 3], `*`(a[4, 4])))), `-`(`*`(a[1, 1], `*`(a[2, 2], `*`(a[3, 4], `*`(a[4, 3]))))), `*`(a[1, 1], `*`(a[3, 2], `*`(a[4, 3], `*`(a[2, 4])))), `-`(`*`(a[1, 1], `*`(a[...
`+`(`*`(a[1, 1], `*`(a[2, 2], `*`(a[3, 3], `*`(a[4, 4])))), `-`(`*`(a[1, 1], `*`(a[2, 2], `*`(a[3, 4], `*`(a[4, 3]))))), `*`(a[1, 1], `*`(a[3, 2], `*`(a[4, 3], `*`(a[2, 4])))), `-`(`*`(a[1, 1], `*`(a[...
(2.3)
 

> Determinant(Matrix(5,5,symbol=a));
 

Illustrer2 

Vi definerer en funktion til at illustrere determinanters betydning for lineære afbildninger  

> with(plots):
 

> futhark:=[<0,0>,<0,3>,<1,2>,<0,1>,<1,0>];
 

[Vector[column](%id = 51502920), Vector[column](%id = 51502984), Vector[column](%id = 51503048), Vector[column](%id = 51503112), Vector[column](%id = 51503176)] (3.1)
 

> tegn:=(LL,farve)->plot([seq([LL[i][1],LL[i][2]],i=1..5)],scaling=constrained,view=[-10..10,-10..10],thickness=3,color=farve);
 

proc (LL, farve) options operator, arrow; plot([seq([LL[i][1], LL[i][2]], i = 1 .. 5)], scaling = constrained, view = [-10 .. 10, -10 .. 10], thickness = 3, color = farve) end proc
proc (LL, farve) options operator, arrow; plot([seq([LL[i][1], LL[i][2]], i = 1 .. 5)], scaling = constrained, view = [-10 .. 10, -10 .. 10], thickness = 3, color = farve) end proc
(3.2)
 

> illustrermedet:=(A,farve)->plots[display]([tegn(futhark,black),tegn(map(unapply(A.x,x),futhark),farve),plots[textplot]([8,10,A[1,1]],font=[HELVETICA,BOLD ,24]),plots[textplot]([10,10,A[1,2]],font=[HELVETICA,BOLD ,24]),plots[textplot]([8,8,A[2,1]],font=[HELVETICA,BOLD ,24]),plots[textplot]([10,8,A[2,2]],font=[HELVETICA,BOLD ,24]),plots[textplot]([9,5,Determinant(A)],font=[HELVETICA,BOLD ,24])]);
 

proc (A, farve) options operator, arrow; plots[plots:-display]([tegn(futhark, black), tegn(map(unapply(`.`(A, x), x), futhark), farve), plots[plots:-textplot]([8, 10, A[1, 1]], font = [HELVETICA, BOLD...
proc (A, farve) options operator, arrow; plots[plots:-display]([tegn(futhark, black), tegn(map(unapply(`.`(A, x), x), futhark), farve), plots[plots:-textplot]([8, 10, A[1, 1]], font = [HELVETICA, BOLD...
proc (A, farve) options operator, arrow; plots[plots:-display]([tegn(futhark, black), tegn(map(unapply(`.`(A, x), x), futhark), farve), plots[plots:-textplot]([8, 10, A[1, 1]], font = [HELVETICA, BOLD...
proc (A, farve) options operator, arrow; plots[plots:-display]([tegn(futhark, black), tegn(map(unapply(`.`(A, x), x), futhark), farve), plots[plots:-textplot]([8, 10, A[1, 1]], font = [HELVETICA, BOLD...
proc (A, farve) options operator, arrow; plots[plots:-display]([tegn(futhark, black), tegn(map(unapply(`.`(A, x), x), futhark), farve), plots[plots:-textplot]([8, 10, A[1, 1]], font = [HELVETICA, BOLD...
(3.3)
 

> illustrer2:=n->display([seq(illustrermedet(RandomMatrix(2,2,generator=rand(-3..3)),COLOR(HUE,rand()/10^10)),i=1..n)],insequence=true);
 

proc (n) options operator, arrow; plots:-display([seq(illustrermedet(LinearAlgebra:-RandomMatrix(2, 2, generator = rand(-3 .. 3)), COLOR(HUE, `+`(`*`(`/`(1, 10000000000), `*`(rand()))))), i = 1 .. n)]...
proc (n) options operator, arrow; plots:-display([seq(illustrermedet(LinearAlgebra:-RandomMatrix(2, 2, generator = rand(-3 .. 3)), COLOR(HUE, `+`(`*`(`/`(1, 10000000000), `*`(rand()))))), i = 1 .. n)]...
(3.4)
 

Ved at skrive illustrer2(N) producerer vi en tegnefilm der viser effekten på R, samt matricen og determinanten af denne for N tilfældige lineære afbildninger: 

> illustrer2(10);
 

Plot_2d
 

Matricer med mange nuller 

Matricer med mange nuller kan defineres ved brug af Matrix.Fx kan vi definere operationsmatricerne (jf. NVP, p. 46) direkte ved 

> M:=(n,i,c)->Matrix(n,n,{(i,i)=c,seq((k,k)=1,k=1..i-1),seq((k,k)=1,k=i+1..n)});
 

proc (n, i, c) options operator, arrow; Matrix(n, n, {seq((k, k) = 1, k = 1 .. `+`(i, `-`(1))), seq((k, k) = 1, k = `+`(1, i) .. n), (i, i) = c}) end proc (4.1)
 

(man kunne også have benyttet formlerne nederst samme side, men denne metode kan give ideer til løsning af ugeopgave 3.1). Dette fungerer ved at generere en liste som fx 

> {(2,2)=c,seq((k,k)=1,k=1..2-1),seq((k,k)=1,k=2+1..4)};
 

{(1, 1) = 1, (2, 2) = c, (3, 3) = 1, (4, 4) = 1} (4.2)
 

der fortæller Maple på hvilke pladser man ønsker en værdi der ikke er nul. Så: 

> M(4,2,c);
 

Matrix(%id = 54014416) (4.3)
 

> B:=(n,i,j)->Matrix(n,n,{(i,j)=1,(j,i)=1,seq((k,k)=1,k=1..min(i,j)-1),seq((k,k)=1,k=max(i,j)+1..n),seq((k,k)=1,k=min(i,j)+1..max(i,j)-1)});
 

proc (n, i, j) options operator, arrow; Matrix(n, n, {seq((k, k) = 1, k = 1 .. `+`(min(i, j), `-`(1))), seq((k, k) = 1, k = `+`(max(i, j), 1) .. n), seq((k, k) = 1, k = `+`(min(i, j), 1) .. `+`(max(i,...
proc (n, i, j) options operator, arrow; Matrix(n, n, {seq((k, k) = 1, k = 1 .. `+`(min(i, j), `-`(1))), seq((k, k) = 1, k = `+`(max(i, j), 1) .. n), seq((k, k) = 1, k = `+`(min(i, j), 1) .. `+`(max(i,...
(4.4)
 

> B(4,2,4);
 

Matrix(%id = 53209944) (4.5)
 

> S:=(n,i,j,c)->Matrix(n,n,{(i,j)=c,seq((k,k)=1,k=1..n)});
 

proc (n, i, j, c) options operator, arrow; Matrix(n, n, {seq((k, k) = 1, k = 1 .. n), (i, j) = c}) end proc (4.6)
 

> S(4,2,4,c);
 

Matrix(%id = 51166100) (4.7)
 

> Matrix(5,4,{(1,1)=83,(2,4)=p});
 

Matrix(%id = 51326820) (4.8)
 

>
 

>