Subversion Repositories wimsdev

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2071 zjchen 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
12
 result=!exec pari print(factor($formula));
13
 factor_html=
14
 result=!translate ; to $\
15
$ in $result
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 <font color=green>&times;</font>
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
29
!else
30
 result=!exec maxima factor($formula);
31
!endif
32
!exit
33
 
34
:output
35
!htmlmath $formula
36
 =
37
!if $vars=$empty
38
 $factor_html
39
!else
40
 !htmlmath $result
41
!endif
42
!exit
43