Rev 16209 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
20 | reyssat | 1 | !set methtit=Rewrite an equation |
2 | !set methenv=ZZ QQ RR CC |
||
3 | !set methparmtype=parm equation, function, choice, function |
||
4 | !set methhelp=You can use this method to transform an existing equation\ |
||
5 | into an equivalent one, by a composition of addition of terms,\ |
||
6 | exchange of sides 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 |
||
16135 | bpr | 14 | Rewrite the equation |
15 | !read deduc/methparm.phtml 1 |
||
17187 | bpr | 16 | $ to <br> |
17 | <input size="15" name="methparm2" value="$methparm2"> |
||
16135 | bpr | 18 | = |
17187 | bpr | 19 | <input size="15" name="methparm4" value="$methparm4"> |
16135 | bpr | 20 | !set methremark=Your new equation 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== |
||
25 | sign3== |
||
26 | !if $sign2 notsametext $sign1 and $sign3 notsametext $sign1 |
||
20 | reyssat | 27 | :badequiv |
28 | error=Your new equation is not equivalent to the original one! |
||
29 | !advance penalty |
||
30 | !exit |
||
16120 | bpr | 31 | !endif |
32 | |||
16209 | bpr | 33 | check1=($left1) - ($right1) |
34 | check2=($methparm2) - ($methparm4) |
||
16120 | bpr | 35 | |
16209 | bpr | 36 | !read deduc/sub/checkzero $check1\ |
20 | reyssat | 37 | $check2 |
16209 | bpr | 38 | !distribute line $out into out1, out2 |
39 | !read deduc/sub/_Simplify ($check1) / ($check2) |
||
40 | out3=$out |
||
41 | !if $out1=yes or $out2=yes |
||
20 | reyssat | 42 | !if $out1!=yes or $out2!=yes |
16209 | bpr | 43 | !goto badequiv |
20 | reyssat | 44 | !endif |
16209 | bpr | 45 | !else |
20 | reyssat | 46 | out3=$[$out3] |
47 | !if NaN isin $out3 or Inf isin $out3 |
||
16209 | bpr | 48 | !goto badequiv |
20 | reyssat | 49 | !endif |
16209 | bpr | 50 | !endif |
51 | methexp=Rewriting of \($left1 = $right1) |
||
20 | reyssat | 52 | |
16209 | bpr | 53 | newobject1=$methparm2 = $methparm4 |
54 | oldobject=1 |
||
20 | reyssat | 55 | |
56 | !exit |