Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
20 | reyssat | 1 | !set methtit2=Multiplier une inégalité par une expression à signe constant |
2 | !set methtit=Multiplier une inégalité par une expression |
||
3 | !set methenv=ZZ QQ RR |
||
4 | !set methparmtype=function,parm inequality >,choice,parm inequality > |
||
5 | !set methparmrelax=4 |
||
6 | !set methhelp=Cette méthode transforme une inégalité du style \(A > B) en\ |
||
7 | une inégalité \(A*f > B*f) (ou \(A*f < B*f)),\ |
||
8 | où \(f) est une expression algébrique\ |
||
9 | de signe constant. La méthode permet à \(f) de s'annuler. De ce fait, il\ |
||
10 | n'y a pas forcément équivalence entre l'inégalité de départ et celle\ |
||
11 | transformée ; elle s'applique donc uniquement sur les hypothèses. |
||
12 | |||
13 | !if $wims_read_parm iswordof form check |
||
14 | !goto $wims_read_parm |
||
15 | !endif |
||
16 | |||
17 | !exit |
||
18 | :form |
||
19 | Multiplier l'inégalité |
||
20 | !read deduc/methparm.phtml 2 |
||
21 | par l'expression |
||
22 | !read deduc/methparm.phtml 1,10 |
||
23 | qui est |
||
24 | !formselect methparm3 list 0,-1,1 prompt \ |
||
25 | $ch_choose, négative ou nulle, positive ou nulle |
||
26 | parce que |
||
27 | !set ch_optional=c'est un nombre |
||
28 | !read deduc/methparm.phtml 4 |
||
29 | !exit |
||
30 | :check |
||
31 | !bound methparm3 within -1,0,1 default 0 |
||
32 | !if $methparm3=0 |
||
33 | error=empty_data |
||
34 | !exit |
||
35 | !endif |
||
36 | !distribute items $methparmobj2 into data,left,sign,right |
||
37 | !read deduc/sub/checkineq ($methparm1),=,0 |
||
38 | ztest=$out |
||
39 | !if $ztest=true |
||
40 | zr=zero |
||
41 | sign2=>= |
||
42 | !goto OK |
||
43 | !endif |
||
44 | !if $ztest=bad |
||
45 | !if $methparm4<1 |
||
46 | :bad |
||
47 | sens=!item ($methparm3+3)/2 of négatif, positif |
||
48 | error=Je ne vois pas pourquoi \($methparm1) est $sens. |
||
49 | !exit |
||
50 | !endif |
||
51 | !distribute items $methparmobj4 into data,left2,sign2,right2 |
||
52 | gt=> |
||
53 | lt=< |
||
54 | eq=$(empty)= |
||
55 | !if ($methparm3>0 and $lt isin $sign2) or \ |
||
56 | ($methparm3<0 and $gt isin $sign2) |
||
57 | !exchange left2,right2 |
||
58 | !endif |
||
59 | sens=!item ($methparm3+3)/2 of <,> |
||
60 | !read deduc/sub/checkineq ($methparm1) - ($left2) + ($right2),$sens=,0\ |
||
61 | ($methparm1) - ($left2) + ($right2),=,0 |
||
62 | !distribute line $out into sn,zr |
||
63 | !if $sn!=true |
||
64 | !goto bad |
||
65 | !endif |
||
66 | !else |
||
67 | !if ($methparm1)*$methparm3<0 |
||
68 | error=Erreur de signe ! |
||
69 | !exit |
||
70 | !endif |
||
71 | !endif |
||
72 | :OK |
||
73 | methexp=Multiplier \($left $sign $right) par \($methparm1) |
||
74 | |||
75 | !read deduc/sub/simplify ($left) * ($methparm1)\ |
||
76 | ($right) * ($methparm1) |
||
77 | !distribute lines $out into newleft,newright |
||
78 | !if $newleft=$empty or $newright=$empty |
||
79 | error=bad_data |
||
80 | !exit |
||
81 | !endif |
||
82 | !if $methparm3<0 |
||
83 | newsign=!translate internal <> to >< in $sign |
||
84 | !else |
||
85 | newsign=$sign |
||
86 | !endif |
||
87 | newobject2=$newleft $newsign $newright |
||
88 | !if $eq notin $sign and $zr=true and $eq isin $sign2 |
||
89 | newsign=$newsign= |
||
90 | newobject0=$newobject2 |
||
91 | oldobject=0 |
||
92 | !else |
||
93 | oldobject=2 |
||
94 | !endif |
||
95 | |||
96 | badsign=!translate internal <> to >< in $newsign |
||
97 | resultlist=$newobject2,\ |
||
98 | $newright $newsign $newleft,\ |
||
99 | $newleft $badsign $newright |
||
100 | !exit |
||
101 |