Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2071 | zjchen | 1 | !goto $wims_read_parm |
2 | |||
3 | :def |
||
4 | title=Inverse matrix |
||
5 | synonyme=matrix inverse |
||
6 | input=square_matrix |
||
7 | !exit |
||
8 | |||
9 | :proc |
||
10 | |||
11 | result=!exec pari print([$mat]^-1) |
||
12 | result=!translate internal ; to $\ |
||
13 | $ in $result |
||
14 | !exit |
||
15 | |||
16 | :output |
||
17 | !set pars=$[max(min($rows,10),1)] |
||
18 | <center> |
||
19 | <table border=0 cellpadding=2> |
||
20 | !for i=1 to $rows |
||
21 | !set l=!line $i of $formula |
||
22 | !set v=!line $i of $result |
||
23 | <tr> |
||
24 | !if $i=1 |
||
25 | <td nowrap rowspan=$rows>$(m_leftpar$pars) |
||
26 | !endif |
||
27 | !for j=1 to $cols |
||
28 | !set k=!item $j of $l |
||
29 | <td nowrap align=center> |
||
30 | !htmlmath $k |
||
31 | !next j |
||
32 | !if $i=1 |
||
33 | <td nowrap rowspan=$rows>$(m_rightpar$pars) |
||
34 | <td nowrap rowspan=$rows valign=top><sup>-1</sup> |
||
35 | <td nowrap rowspan=$rows> = $(m_leftpar$pars) |
||
36 | !endif |
||
37 | !for j=1 to $cols |
||
38 | !set k=!item $j of $v |
||
39 | <td nowrap align=center> |
||
40 | !htmlmath $k |
||
41 | !next j |
||
42 | !if $i=1 |
||
43 | <td nowrap rowspan=$rows>$(m_rightpar$pars) |
||
44 | !endif |
||
45 | !next i |
||
46 | |||
47 | </table></center> |
||
48 | !exit |
||
49 |