Rev 539 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 539 | bpr | 1 | |
| 2 | !goto $wims_read_parm |
||
| 3 | |||
| 4 | :def |
||
| 5 | title=Factorisation |
||
| 6 | synonyme=factoriser, factorise |
||
| 7 | input=function |
||
| 8 | !exit |
||
| 9 | |||
| 10 | :proc |
||
| 11 | vars=!varlist nofn $formula |
||
| 12 | !if $vars=$empty |
||
| 13 | result=!exec pari print(factor($formula)); |
||
| 14 | factor_html= |
||
| 15 | result=!translate ; to $\ |
||
| 16 | $ in $result |
||
| 17 | result=!trim $result |
||
| 18 | fn=!linecnt $result |
||
| 19 | !for k from 1 to $fn |
||
| 20 | ii=!line $k of $result |
||
| 21 | !distribute items $ii into base,power |
||
| 22 | !if $k>1 |
||
| 6055 | bpr | 23 | factor_html=$factor_html <span class="green">×</span> |
| 539 | bpr | 24 | !endif |
| 25 | factor_html=$factor_html $base |
||
| 26 | !ifval $power != 1 |
||
| 27 | factor_html=$factor_html<sup>$power</sup> |
||
| 28 | !endif |
||
| 29 | !next k |
||
| 30 | !else |
||
| 31 | result=!exec maxima factor($formula); |
||
| 32 | !endif |
||
| 33 | !exit |
||
| 34 | |||
| 35 | :output |
||
| 36 | !htmlmath $formula |
||
| 37 | = |
||
| 38 | !if $vars=$empty |
||
| 39 | $factor_html |
||
| 40 | !else |
||
| 41 | !htmlmath $result |
||
| 42 | !endif |
||
| 43 | !exit |
||
| 44 |