Rev 16120 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
20 | reyssat | 1 | !set methtit=Rewrite an inequality |
2 | !set methenv=ZZ QQ RR |
||
3 | !set methparmtype=parm inequality, function, choice 5, function |
||
4 | !set methhelp=You can use this method to transform an existing (in)equation\ |
||
5 | into an equivalent one, by a mixture of addition of terms, exchange of sides\ |
||
6 | and multiplication by a non-zero constant. |
||
7 | |||
8 | !if $wims_read_parm iswordof form check |
||
16120 | bpr | 9 | !goto $wims_read_parm |
20 | reyssat | 10 | !endif |
11 | |||
12 | !exit |
||
13 | :form |
||
14 | Rewrite the inequality |
||
16120 | bpr | 15 | !read deduc/methparm.phtml 1 |
17187 | bpr | 16 | to <br> |
17 | <input size="15" name="methparm2" value="$methparm2"> |
||
16120 | bpr | 18 | !formselect methparm3 from 1 to 5 prompt =,<,>,<=,>= |
17187 | bpr | 19 | <input size="15" name="methparm4" value="$methparm4"> |
16120 | bpr | 20 | !set methremark=Your new inequality must be equivalent to the original one. |
20 | reyssat | 21 | !exit |
22 | :check |
||
16120 | bpr | 23 | !distribute items $methparmobj1 into data,left1,sign1,right1 |
24 | sign2=!item $methparm3 of =,<,>,<=,>= |
||
25 | sign3=!item $methparm3 of =,>,<,>=,<= |
||
26 | !if $sign2 notsametext $sign1 and $sign3 notsametext $sign1 |
||
20 | reyssat | 27 | :badequiv |
28 | error=Your new inequality is not equivalent to the original one! |
||
29 | !advance penalty |
||
30 | !exit |
||
16120 | bpr | 31 | !endif |
32 | |||
33 | check1=($left1) - ($right1) |
||
34 | !if $sign2 issametext $sign1 |
||
20 | reyssat | 35 | check2=($methparm2) - ($methparm4) |
16120 | bpr | 36 | !else |
20 | reyssat | 37 | check2=($methparm4) - ($methparm2) |
16120 | bpr | 38 | !endif |
39 | |||
40 | !read deduc/sub/checkzero $check1\ |
||
20 | reyssat | 41 | $check2 |
16120 | bpr | 42 | !distribute line $out into out1, out2 |
43 | !read deduc/sub/_Simplify ($check1) / ($check2) |
||
44 | out3=$out |
||
45 | !if $out1=yes or $out2=yes |
||
20 | reyssat | 46 | !if $out1!=yes or $out2!=yes |
16120 | bpr | 47 | !goto badequiv |
20 | reyssat | 48 | !endif |
16120 | bpr | 49 | !else |
20 | reyssat | 50 | out3=$[$out3] |
51 | !if NaN isin $out3 or Inf isin $out3 |
||
16120 | bpr | 52 | !goto badequiv |
20 | reyssat | 53 | !endif |
54 | !if $out3<=0 and $sign2 notsametext $sign3 |
||
16120 | bpr | 55 | !goto badequiv |
20 | reyssat | 56 | !endif |
16120 | bpr | 57 | !endif |
58 | methexp=Rewriting of \($left1 $sign1 $right1) |
||
20 | reyssat | 59 | |
16120 | bpr | 60 | newobject1=$methparm2 $sign2 $methparm4 |
61 | oldobject=1 |
||
20 | reyssat | 62 | |
63 | !exit |