Rev 18411 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
18136 | bpr | 1 | !! this file is an option for anstype litexp (or other) |
2 | !! it checks if wims_read_parm is a developped and reduced polynom of Z[x] |
||
17282 | guerimand | 3 | !! no bracket |
18136 | bpr | 4 | !! each term should have to be simplified using power of the variable (x*x not accepted for x^2) |
5 | !! each coefficient has to be calculated (3*5*x^2 not accepted) |
||
6 | !! only for polynom with one variable and coefficients in Z |
||
7 | !! |
||
17282 | guerimand | 8 | !! error checked : |
9 | !! - notreduced termealgsimp : x*x instead of x^2 |
||
18136 | bpr | 10 | !! - notreduced termesamepower : several terms with same power of variable |
11 | !! - notreduced termenumsimp : numerical coefficient of a term is not calculated |
||
17282 | guerimand | 12 | !! - notreduced parenthesis : use of parenthesis |
13 | !! - usedivide : use of / symbol |
||
18411 | bpr | 14 | !set var =!varlist nofn $wims_read_parm |
15 | !set varcnt =!itemcnt $var |
||
16 | !if $varcnt>1 |
||
17 | !exit |
||
18 | !endif |
||
18413 | bpr | 19 | !set pol_test=!exec pari denominator(content($wims_read_parm)) |
20 | !if $pol_test!=1 |
||
21 | !exit |
||
22 | !endif |
||
17282 | guerimand | 23 | nb_=!charcnt $wims_read_parm |
24 | nbt=0 |
||
18136 | bpr | 25 | !reset terme ltermes wrong checkd_ |
17282 | guerimand | 26 | k_=1 |
27 | !while ($k_<=$nb_ and $wrong=$empty) or $terme!=$empty |
||
17292 | guerimand | 28 | c_=!char $k_ of $wims_read_parm |
29 | !if ($c_=+ or $c_=-) or $k_>$nb_ |
||
30 | !if $terme!=$empty |
||
31 | !! analyse du terme |
||
32 | t_=!replace internal * by , in $terme |
||
33 | !distribute item 0,0 into flag_var,flag_num |
||
17356 | guerimand | 34 | !distribute item 1,0 into kk_,p_ |
17292 | guerimand | 35 | nb2_=!itemcnt $t_ |
36 | !while $kk_<=$nb2_ and $wrong=$empty |
||
37 | tt_=!item $kk_ of $t_ |
||
38 | ttt_=$[$tt_*1] |
||
39 | !if $ttt_=NaN |
||
40 | !if $flag_var=1 |
||
41 | !! check of produce of variable (not use of puissance) |
||
42 | wrong=badform notreduced termealgsimp $terme |
||
43 | !else |
||
44 | flag_var=1 |
||
17356 | guerimand | 45 | !!puissance check |
46 | ttt_=!replace internal ^ by , in $tt_ |
||
47 | ttt_=!item 2 of $ttt_ |
||
17360 | guerimand | 48 | !if $ttt_!=$empty and $ttt_<=1 |
17356 | guerimand | 49 | wrong=badform notreduced power0 $terme |
17292 | guerimand | 50 | !endif |
17356 | guerimand | 51 | !default ttt_=1 |
52 | p_=$[$p_+$ttt_] |
||
17292 | guerimand | 53 | !endif |
54 | !else |
||
55 | !if $flag_num=1 |
||
56 | wrong=badform notreduced termenumsimp $terme |
||
57 | !endif |
||
17356 | guerimand | 58 | !if $flag_var=1 |
59 | wrong=badform notreduced constantbefore $terme |
||
60 | !endif |
||
17292 | guerimand | 61 | flag_num=1 |
62 | !endif |
||
63 | !increase kk_ |
||
64 | !endwhile |
||
17360 | guerimand | 65 | !increase nbt |
66 | pp_=!positionof item $p_ in $checkd_ |
||
67 | !if $pp_!=$empty and $wrong=$empty |
||
68 | wrong=badform notreduced termesamepower $(ltermes[$pp_]),$terme |
||
17356 | guerimand | 69 | !else |
17511 | guerimand | 70 | checkd_=!append item $p_ to $checkd_ |
17356 | guerimand | 71 | !endif |
17292 | guerimand | 72 | ltermes=!append item $terme to $ltermes |
73 | !if $k_>$nb_ or $c_=+ |
||
74 | !reset terme |
||
75 | !else |
||
76 | terme=- |
||
77 | !endif |
||
78 | !endif |
||
79 | !else |
||
80 | !if $c_ isin () |
||
81 | wrong=badform notreduced parenthesis |
||
82 | !else |
||
83 | !if $c_=/ |
||
18206 | reyssat | 84 | wrong=badform usebadchar / |
17292 | guerimand | 85 | !else |
86 | terme=$terme$c_ |
||
87 | !endif |
||
88 | !endif |
||
89 | !endif |
||
18292 | reyssat | 90 | !if ($terme=$empty) and ($c_=-) |
91 | terme=- |
||
92 | !endif |
||
17292 | guerimand | 93 | !increase k_ |
17282 | guerimand | 94 | !endwhile |