invet matrix (bis bis)
Posted: Thu Feb 17, 2005 10:04 am
Clearly Vesnim does'nt use the determinant of a matrix to compute the inverse.
Try the following tittle vensim program :
!****************************
liA:
(lia1-lia2)
~
~ |
"inv(mat a)"[cola,llA]=
invert matrix(mat A[llA,cola],ELMCOUNT(cola))
~
~ |
"mata *inv( mat A)"[liA,llA]=
SUM(mat A[liA,cola!]*"inv(mat a)"[cola!,llA])
~
~ ~ :SUPPLEMENTARY
|
cola:
(cola1-cola2)
~
~ |
mat A[liA,cola]=TABBED ARRAY(
6 12
1 2)
~
~ |
llA<->liA
~
~ |
**********************
The program computes the inverse of matrix A, then multiply A by invert (A). We should obtain a I matrix.
if A is singular (has determinant =0) as in the program you will obtained a wrong result because Vensim try to invert a singulat matrix. With a non singular A matrix the result is OK .
The question is : how to test non singularity of a matrix before using the INVERT MATRIX function ?
REgards
Try the following tittle vensim program :
!****************************
liA:
(lia1-lia2)
~
~ |
"inv(mat a)"[cola,llA]=
invert matrix(mat A[llA,cola],ELMCOUNT(cola))
~
~ |
"mata *inv( mat A)"[liA,llA]=
SUM(mat A[liA,cola!]*"inv(mat a)"[cola!,llA])
~
~ ~ :SUPPLEMENTARY
|
cola:
(cola1-cola2)
~
~ |
mat A[liA,cola]=TABBED ARRAY(
6 12
1 2)
~
~ |
llA<->liA
~
~ |
**********************
The program computes the inverse of matrix A, then multiply A by invert (A). We should obtain a I matrix.
if A is singular (has determinant =0) as in the program you will obtained a wrong result because Vensim try to invert a singulat matrix. With a non singular A matrix the result is OK .
The question is : how to test non singularity of a matrix before using the INVERT MATRIX function ?
REgards