Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2071 | zjchen | 1 | !goto $wims_read_parm |
2 | |||
3 | :def |
||
4 | title=Trace |
||
5 | synonyme=trace of a matrix, matrix trace |
||
6 | input=square_matrix |
||
7 | !exit |
||
8 | |||
9 | :proc |
||
10 | |||
11 | result=!exec pari trace([$mat]) |
||
12 | !exit |
||
13 | |||
14 | :output |
||
15 | !set pars=$[max(min($rows,10),1)] |
||
16 | <center> |
||
17 | <table border=0 cellpadding=2> |
||
18 | !for i=1 to $rows |
||
19 | !set l=!line $i of $formula |
||
20 | <tr> |
||
21 | !if $i=1 |
||
22 | <td nowrap rowspan=$rows>trace $(m_leftpar$pars) |
||
23 | !endif |
||
24 | !for j=1 to $cols |
||
25 | !set k=!item $j of $l |
||
26 | <td nowrap align=center>$k |
||
27 | !next j |
||
28 | !if $i=1 |
||
29 | <td nowrap rowspan=$rows>$(m_rightpar$pars) = $result |
||
30 | !endif |
||
31 | !next i |
||
32 | |||
33 | </table></center> |
||
34 | !exit |
||
35 |