login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit
Download: pdf dvi ps src tex log


Some or all of this page may not have rendered properly, because of the following error:
dvips: cd '/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/'; /usr/bin/dvips -z -o 'SandBoxComplementsdalgebrelineaire.ps' 'SandBoxComplementsdalgebrelineaire.dvi'
This is dvips(k) 2022.1 (TeX Live 2022)  Copyright 2022 Radical Eye Software (www.radicaleye.com)
/usr/bin/dvips: DVI file can't be opened: SandBoxComplementsdalgebrelineaire.dvi: No such file or directory

fricas
(1) -> ---
--- linalg.input
--- Francois Maltey - janvier 2008
---
---
--- A  partir de rowEchelon
---
sameSizeVectors? Lb ==
 null Lb => true
 n := #(first Lb)
 every? (t +-> #t=n, rest Lb)
Type: Void
fricas
basis mat ==
 mat2 := rowEchelon mat
 basis := []
 indrow : Integer := 1
 n : Integer := ncols mat
 m : Integer := nrows mat
 for k in 1..n repeat
   if indrow <= m and mat2.(indrow,k) ~= 0
     then
       basis := cons (column (mat, k), basis)
       indrow := indrow + 1
 reverse basis
Type: Void
fricas
basisLV Lv ==
 null Lv => []
 not (sameSizeVectors? Lv) => error "vectors have not the same size"
 basis transpose matrix Lv
Type: Void
fricas
basisMat mat == basis mat
Type: Void
fricas
sumBasisLLV LLv == basisLV concat LLv
Type: Void
fricas
sumBasis2 (Lv1, Lv2) == basisLV concat (Lv1, Lv2)
Type: Void
fricas
kernelMat mat ==
 lv := nullSpace mat
 #lv = 1 and lv.1 = 0*lv.1 => []
 lv
Type: Void
fricas
subVector (v, a, b) == vector (elt (entries v, a..b))
Type: Void
fricas
linearVector (t, Lv) == reduce (+, [t.i*Lv.i for i in 1..#t])
Type: Void
fricas
intBasis2 (Lv1, Lv2) ==
 Lb1 := basisLV Lv1
 Lb2 := basisLV Lv2
 null Lb1 => []
 null Lb2 => []
 #(first Lb1) ~= #(first Lb2) => error "vectors have not the same size"
 lkv := kernelMat transpose matrix concat (Lb2, Lb1)
 d1 := #Lb1
 d2 := #Lb2
 LcoeffV1 := [subVector (kv, d2+1, d1+d2) for kv in lkv]
 [linearVector (cc, Lb1) for cc in LcoeffV1]
Type: Void
fricas
intBasisLLV LLv ==
 #LLv = 0 => error "no space to intersect"
 #LLv = 1 => LLv.1
--reduce (intBasis2, LLv)
 intBasis2 (LLv.1, intBasisLLV rest LLv)
Type: Void

fricas
---
--- inversegeneralisee.input
--- Francois Maltey - janvier 2008
---
--- inverse generalisee
---
--- a partir du livre Algebre lineaire par Joseph Grifone p.375
--- applique pas à pas la méthode du livre à l'exemple
A := matrix [[2,1,-1,1],[1,1,0,1],[3,2,-1,2]]

\label{eq1}\left[ 
\begin{array}{cccc}
2 & 1 & - 1 & 1 
\
1 & 1 & 0 & 1 
\
3 & 2 & - 1 & 2 
(1)
Type: Matrix(Integer)
fricas
--- kerA est une base de ker f ou f est definie par la matrice A
KerA := kernelMat A
fricas
Compiling function kernelMat with type Matrix(Integer) -> List(
      Vector(Integer))

\label{eq2}\left[{\left[ 1, \: - 1, \: 1, \: 0 \right]}, \:{\left[ 0, \: - 1, \: 0, \: 1 \right]}\right](2)
Type: List(Vector(Integer))
fricas
--- Le noyau de la matrice dont les lignes sont des vecteurs generateurs
--- d'un sev est le sev orthogonal. C'est un sous-espace supplementaire.
--- baseF est une base d'un sous-espace supplémentaire de ker f
baseF := kernelMat matrix KerA

\label{eq3}\left[{\left[ - 1, \: 0, \: 1, \: 0 \right]}, \:{\left[ 1, \: 1, \: 0, \: 1 \right]}\right](3)
Type: List(Vector(Integer))
fricas
--- les vecteurs colonnes de A engendre l'image Im f.
--- baseImA est une base de l'image de f calculee a partir de la matrice A
baseImA := basis A
Function definition for basis is being overwritten. The type of the local variable basis has changed in the computation. We will attempt to interpret the code. Compiled code for basis has been cleared.

\label{eq4}\left[{\left[ 2, \: 1, \: 3 \right]}, \:{\left[ 1, \: 1, \: 2 \right]}\right](4)
Type: List(Vector(Integer))
fricas
--- baseG et baseG2 sont deux bases d'un sous-espace supplementaire de Im f
--- l'une calculee a partir de la matrice A, l'autre d'une base de Im f.
baseG := kernelMat transpose A

\label{eq5}\left[{\left[ - 1, \: - 1, \: 1 \right]}\right](5)
Type: List(Vector(Integer))
fricas
baseG2:= kernelMat matrix baseImA

\label{eq6}\left[{\left[ - 1, \: - 1, \: 1 \right]}\right](6)
Type: List(Vector(Integer))
fricas
--- La restriction g de f est un isomorphisme du supplementaire F de ker f
--- dans Im f. La matrice de g dans les bases de F et de Im f est obtenue
--- en decomposant dans Im f les images des vecteurs de la base de F.
--- La commande particularSolution effectue cette decomposition.
MP := transpose matrix baseImA

\label{eq7}\left[ 
\begin{array}{cc}
2 & 1 
\
1 & 1 
\
3 & 2 
(7)
Type: Matrix(Integer)
fricas
map (X +-> A*X, baseF)

\label{eq8}\left[{\left[ - 3, \: - 1, \: - 4 \right]}, \:{\left[ 4, \: 3, \: 7 \right]}\right](8)
Type: List(Vector(Integer))
fricas
map (X +-> particularSolution (MP, A*X), baseF)

\label{eq9}\left[{\left[ - 2, \: 1 \right]}, \:{\left[ 1, \: 2 \right]}\right](9)
Type: List(Union(Vector(Fraction(Integer)),"failed"))
fricas
B := transpose matrix map (X +-> particularSolution (MP, A*X), baseF)

\label{eq10}\left[ 
\begin{array}{cc}
- 2 & 1 
\
1 & 2 
(10)
Type: Matrix(Fraction(Integer))
fricas
--- La matrice C est celle de l'isomorphisme reciproque dans ces bases.
C := B^-1

\label{eq11}\left[ 
\begin{array}{cc}
-{\frac{2}{5}}&{\frac{1}{5}}
\
{\frac{1}{5}}&{\frac{2}{5}}
(11)
Type: Matrix(Fraction(Integer))
fricas
--- la projection orthogonale de E' sur Im f peut être obtenue
--- à partir d'une base orthonormee de Im f.
--- baseImA est une base de Im f, la fonction gramschmidt construit
--- la bon associee.
GS := gramschmidt (baseImA::List Vector Expression Integer)

\label{eq12}\begin{array}{@{}l}
\displaystyle
\left[{\left[ 
\begin{array}{c}
-{\frac{2}{7 \ {\sqrt{\frac{3}{14}}}}}
\
{\frac{5}{{14}\ {\sqrt{\frac{3}{14}}}}}
\
{\frac{1}{{14}\ {\sqrt{\frac{3}{14}}}}}
(12)
Type: List(Matrix(Expression(Integer)))
fricas
bonImA := map (M +-> column (M, 1), GS)

\label{eq13}\begin{array}{@{}l}
\displaystyle
\left[{
\begin{array}{@{}l}
\displaystyle
\left[ -{\frac{2}{7 \ {\sqrt{\frac{3}{14}}}}}, \:{\frac{5}{{1
4}\ {\sqrt{\frac{3}{14}}}}}, \: \right.
\
\
\displaystyle
\left.{\frac{1}{{14}\ {\sqrt{\frac{3}{14}}}}}\right] 
(13)
Type: List(Vector(Expression(Integer)))
fricas
projortho X ==
 reduce (+, map (V +-> dot (V, X::Vector Expression Integer) * V, bonImA))
Type: Void
fricas
--- exemple de projection orthogonale sur Im f.
projortho vector [1,2,4]
fricas
Compiling function projortho with type Vector(PositiveInteger) -> 
      Vector(Expression(Integer))

\label{eq14}\left[{\frac{4}{3}}, \:{\frac{7}{3}}, \:{\frac{11}{3}}\right](14)
Type: Vector(Expression(Integer))
fricas
--- construction de la composition g^-1 o p de E' dans E
--- en calculant les images des vecteurs de la base canonique de E'
--- puis passage des coordonnees de g^-1 o p de la base de F
--- à la base canonique de E.
Id3 := diagonalMatrix [1 for i in 1..3]

\label{eq15}\left[ 
\begin{array}{ccc}
1 & 0 & 0 
\
0 & 1 & 0 
\
0 & 0 & 1 
(15)
Type: Matrix(Integer)
fricas
RES1 := [projortho column (Id3, i) for i in 1..3]
fricas
Compiling function projortho with type Vector(Integer) -> Vector(
      Expression(Integer))

\label{eq16}\begin{array}{@{}l}
\displaystyle
\left[{\left[{\frac{2}{3}}, \: -{\frac{1}{3}}, \:{\frac{1}{3}}\right]}, \:{\left[ -{\frac{1}{3}}, \:{\frac{2}{3}}, \:{\frac{1}{3}}\right]}, \: \right.
\
\
\displaystyle
\left.{\left[{\frac{1}{3}}, \:{\frac{1}{3}}, \:{\frac{2}{3}}\right]}\right] (16)
Type: List(Vector(Expression(Integer)))
fricas
RES2 := [X::Vector Fraction Integer for X in RES1]

\label{eq17}\begin{array}{@{}l}
\displaystyle
\left[{\left[{\frac{2}{3}}, \: -{\frac{1}{3}}, \:{\frac{1}{3}}\right]}, \:{\left[ -{\frac{1}{3}}, \:{\frac{2}{3}}, \:{\frac{1}{3}}\right]}, \: \right.
\
\
\displaystyle
\left.{\left[{\frac{1}{3}}, \:{\frac{1}{3}}, \:{\frac{2}{3}}\right]}\right] (17)
Type: List(Vector(Fraction(Integer)))
fricas
RES3 := [particularSolution (MP, X) for X in RES2]

\label{eq18}\left[{\left[ 1, \: -{\frac{4}{3}}\right]}, \:{\left[ - 1, \:{\frac{5}{3}}\right]}, \:{\left[ 0, \:{\frac{1}{3}}\right]}\right](18)
Type: List(Union(Vector(Fraction(Integer)),"failed"))
fricas
RES := [C * X for X in RES3::List Vector Fraction Integer]

\label{eq19}\begin{array}{@{}l}
\displaystyle
\left[{\left[ -{\frac{2}{3}}, \: -{\frac{1}{3}}\right]}, \:{\left[{\frac{1
1}{15}}, \:{\frac{7}{15}}\right]}, \: \right.
\
\
\displaystyle
\left.{\left[{\frac{1}{15}}, \:{\frac{2}{15}}\right]}\right] (19)
Type: List(Vector(Fraction(Integer)))
fricas
AA := transpose matrix baseF * transpose matrix RES

\label{eq20}\left[ 
\begin{array}{ccc}
{\frac{1}{3}}& -{\frac{4}{15}}&{\frac{1}{15}}
\
-{\frac{1}{3}}&{\frac{7}{15}}&{\frac{2}{15}}
\
-{\frac{2}{3}}&{\frac{11}{15}}&{\frac{1}{15}}
\
-{\frac{1}{3}}&{\frac{7}{15}}&{\frac{2}{15}}
(20)
Type: Matrix(Fraction(Integer))
fricas
--- vérifications de quelques propriétés : A AA A = A et AA A AA = AA
--- transpose (A AA) = A AA : car les sev choisis sont des orthogonaux
AA * A * AA - AA

\label{eq21}\left[ 
\begin{array}{ccc}
0 & 0 & 0 
\
0 & 0 & 0 
\
0 & 0 & 0 
\
0 & 0 & 0 
(21)
Type: Matrix(Fraction(Integer))
fricas
A * AA * A - A

\label{eq22}\left[ 
\begin{array}{cccc}
0 & 0 & 0 & 0 
\
0 & 0 & 0 & 0 
\
0 & 0 & 0 & 0 
(22)
Type: Matrix(Fraction(Integer))
fricas
transpose (AA * A) - AA * A

\label{eq23}\left[ 
\begin{array}{cccc}
0 & 0 & 0 & 0 
\
0 & 0 & 0 & 0 
\
0 & 0 & 0 & 0 
\
0 & 0 & 0 & 0 
(23)
Type: Matrix(Fraction(Integer))
fricas
transpose (A * AA) - A * AA

\label{eq24}\left[ 
\begin{array}{ccc}
0 & 0 & 0 
\
0 & 0 & 0 
\
0 & 0 & 0 
(24)
Type: Matrix(Fraction(Integer))




  Subject:   Be Bold !!
  ( 15 subscribers )  
Please rate this page: