Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
documentation:language_reference:objects:matrix:functions:expand [2024/12/12 16:53] Maurits W. Haverkortdocumentation:language_reference:objects:matrix:functions:expand [2024/12/12 17:39] (current) Maurits W. Haverkort
Line 3: Line 3:
  
 ### ###
-Matrix.Expand($M$, $n$, $x$) takes a quadratic matrix $M$ and adds diagonal entries with value $x$ to it until it is of size $n \times n$. If $x$ is not given in the input it is set to $1$.+Matrix.Expand($M$, $n$, $x$) takes a quadratic matrix $M$ of dimension $m$ by $m$ and enlarges the dimension by $n$ to $n+m$ by $n+m$. The new diagonal values are set to $x$. If $x$ is not given all new entries are set to 0.
 ### ###
  
 ===== Example ===== ===== Example =====
- 
-### 
-Has yet to be written. 
-### 
  
 ==== Input ==== ==== Input ====
 <code Quanty Example.Quanty> <code Quanty Example.Quanty>
--- some example code+A = Matrix.New({{1,2}, 
 +                {3,4}}) 
 +B = Matrix.Expand(A,4) 
 +C = Matrix.Expand(A,4,3) 
 +print(B) 
 +print(C) 
 </code> </code>
  
 ==== Result ==== ==== Result ====
 <file Quanty_Output> <file Quanty_Output>
-text produced as output+{ {  1      ,  2      ,  0      ,  0      } , 
 +  {  3      ,  4      ,  0      ,  0      } , 
 +  {  0      ,  0      ,  0      ,  0      } , 
 +  {  0      ,  0      ,  0      ,  0      } } 
 + 
 +{ {  1      ,  2      ,  0      ,  0      } , 
 +  {  3      ,  4      ,  0      ,  0      } , 
 +  {  0      ,  0      ,  3      ,  0      } , 
 +  {  0      ,  0      ,  0      ,  3      } }
 </file> </file>
  
Print/export