Subversion Repositories wimsdev

Rev

Rev 3265 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
20 reyssat 1
!if $wims_read_parm!=slib_header
2
 !goto proc
3
!endif
4
slib_title=Indefinite or definite integration of a function of one variable
5
slib_parms=4\
6
,the function\
7
x,the variable name\
8
,starting bound, optional\
9
,ending bound, optional
10
,option words in case of definite integral: numeric, fast
11
slib_author=Gang Xiao
12
slib_out=The value (empty if error)
13
slib_comment=This script uses Maxima. If one of the bounds is missing,\
14
 then indefinite integration (formal method) is tried. Otherwise \
15
 definite integration. It first tries the formal method.\
16
 If this fails, then a numerical method is tried.
17
slib_example=sin(x),x,0,5,numeric\
18
sin(x),x,0,5,fast\
19
sin(x),x
20
!exit
21
 
22
:proc
23
!distribute items $wims_read_parm into slib_fn,slib_var,slib_x1,slib_x2,slib_opt
24
slib_fn=!rawmath $slib_fn
25
slib_var=!varlist $slib_var
26
slib_var=!item 1 of $slib_var
27
!default slib_var=x
28
slib_out=
29
!if $slib_x1=$slib_empty or $slib_x2=$slib_empty
30
 slib_out=!exec maxima integrate($slib_fn,$slib_var);
31
 !exit
32
!endif
33
slib_test=$[($slib_x1)+($slib_x2)]
34
!if numeric notin $slib_opt
35
 slib_out=!exec maxima integrate($slib_fn,$slib_var,$slib_x1,$slib_x2);
36
!endif
37
!if ($slib_out=$empty or integrate isin $slib_out or i isvarof $slib_out) \
38
  and NaN notin $slib_test
39
 !if fast isin $slib_opt
40
  slib_out=!exec pari intnum($slib_var=$slib_x1,$slib_x2,$slib_fn)
41
 !else
42
  slib_out=!exec pari intnum($slib_var=$slib_x1,$slib_x2,$slib_fn,3)
43
 !endif
44
!endif
45