Rev 20 | Rev 4158 | Go to most recent revision | Details | Compare with Previous | 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 |
||
3265 | bpr | 20 | slib_require=maxima, pari |
20 | reyssat | 21 | !exit |
22 | |||
23 | :proc |
||
24 | !distribute items $wims_read_parm into slib_fn,slib_var,slib_x1,slib_x2,slib_opt |
||
25 | slib_fn=!rawmath $slib_fn |
||
26 | slib_var=!varlist $slib_var |
||
27 | slib_var=!item 1 of $slib_var |
||
28 | !default slib_var=x |
||
29 | slib_out= |
||
30 | !if $slib_x1=$slib_empty or $slib_x2=$slib_empty |
||
31 | slib_out=!exec maxima integrate($slib_fn,$slib_var); |
||
32 | !exit |
||
33 | !endif |
||
34 | slib_test=$[($slib_x1)+($slib_x2)] |
||
35 | !if numeric notin $slib_opt |
||
36 | slib_out=!exec maxima integrate($slib_fn,$slib_var,$slib_x1,$slib_x2); |
||
37 | !endif |
||
38 | !if ($slib_out=$empty or integrate isin $slib_out or i isvarof $slib_out) \ |
||
39 | and NaN notin $slib_test |
||
40 | !if fast isin $slib_opt |
||
41 | slib_out=!exec pari intnum($slib_var=$slib_x1,$slib_x2,$slib_fn) |
||
42 | !else |
||
43 | slib_out=!exec pari intnum($slib_var=$slib_x1,$slib_x2,$slib_fn,3) |
||
44 | !endif |
||
45 | !endif |
||
46 |