Subversion Repositories wimsdev

Rev

Rev 539 | 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=Factorization
6
input=function
7
!exit
8
 
9
:proc
10
vars=!varlist nofn $formula
11
!if $vars=$empty
14899 bpr 12
  result=!exec pari print(factor($formula));
13
  factor_html=
14
  result=!translate ; to $\
539 bpr 15
$ in $result
14899 bpr 16
  result=!trim $result
17
  fn=!linecnt $result
18
  !for k from 1 to $fn
19
    ii=!line $k of $result
20
    !distribute items $ii into base,power
21
    !if $k>1
22
      factor_html=$factor_html <span class="green">&times;</span>
23
    !endif
24
    factor_html=$factor_html $base
25
    !ifval $power != 1
26
      factor_html=$factor_html<sup>$power</sup>
27
    !endif
28
  !next k
539 bpr 29
!else
14899 bpr 30
  result=!exec maxima factor($formula);
539 bpr 31
!endif
32
!exit
33
 
34
:output
35
!htmlmath $formula
36
 =
37
!if $vars=$empty
14899 bpr 38
  $factor_html
539 bpr 39
!else
14899 bpr 40
  !htmlmath $result
539 bpr 41
!endif
42
!exit