Differences

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

Link to this comparison view

Next revision
Previous revision
documentation:language_reference:objects:matrix:functions:diagonal [2018/09/25 12:11] – created Simon Heinzedocumentation:language_reference:objects:matrix:functions:diagonal [2018/09/26 15:06] (current) – Added Code Example Simon Heinze
Line 4: Line 4:
 ### ###
 Matrix.Diagonal($\{x_1,x_2,...,x_n\}$) takes a list of $n$ numbers and returns an $n \times n$ diagonal matrix with the $x_i$ as entries. Matrix.Diagonal($\{x_1,x_2,...,x_n\}$) takes a list of $n$ numbers and returns an $n \times n$ diagonal matrix with the $x_i$ as entries.
 +
 +If the option "Userdata" is set to true (default is false) the output is returned as a pointer rather than a table of tables (compare //[[documentation:language_reference:objects:matrix:functions:ToUserdata|Matrix.ToUserdata()]]//).
 ### ###
  
 ===== Example ===== ===== Example =====
- 
-### 
-The day may come on which this documentation page has an example. 
-### 
  
 ==== Input ==== ==== Input ====
 <code Quanty Example.Quanty> <code Quanty Example.Quanty>
--- some example code+xlist = {17,3,-4*I, sqrt(6)} 
 +M = Matrix.Diagonal(xlist) 
 +print(M)
 </code> </code>
  
 ==== Result ==== ==== Result ====
 <file Quanty_Output> <file Quanty_Output>
-text produced as output+{ { 17 , 0 , 0 , 0 } ,  
 +  { 0 , 3 , 0 , 0 } ,  
 +  { 0 , 0 , (-0 - 4 I) , 0 } ,  
 +  { 0 , 0 , 0 , 2.4494897427832 } }
 </file> </file>
  
Print/export