Rev 16135 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
20 | reyssat | 1 | !set methtit=Add a number to the two sides of an equation |
2 | !set methparmtype=number,parm equation |
||
3 | !set methhelp=This method transforms an equation \(a = b)\ |
||
4 | into the equivalent equation \(a + n = b + n), where \(n) is a number. |
||
5 | |||
6 | !if $wims_read_parm iswordof form check |
||
16135 | bpr | 7 | !goto $wims_read_parm |
20 | reyssat | 8 | !endif |
9 | |||
10 | !exit |
||
11 | :form |
||
12 | Add the number |
||
13 | !read deduc/methparm.phtml 1,15 |
||
14 | to the two sides of the equation |
||
15 | !read deduc/methparm.phtml 2 |
||
16 | |||
17 | !exit |
||
18 | :check |
||
16209 | bpr | 19 | !distribute items $methparmobj2 into data,left,sign,right |
20 | methexp=Add \(methparm1) to two sides of \($left $sign $right) |
||
20 | reyssat | 21 | |
16209 | bpr | 22 | !read deduc/sub/simplify ($left + ($methparm1)\ |
20 | reyssat | 23 | $right + ($methparm1) |
16209 | bpr | 24 | !distribute lines $out into newleft,newright |
25 | !if $newleft=$empty or $newright=$empty |
||
20 | reyssat | 26 | error=bad_data |
27 | !exit |
||
16209 | bpr | 28 | !endif |
29 | newsign=$sign |
||
30 | newobject2=$newleft $newsign $newright |
||
31 | oldobject=2 |
||
16135 | bpr | 32 | |
16209 | bpr | 33 | contextlist=$ct_Always,\ |
20 | reyssat | 34 | $ct_Onlywhen the added number is of constant sign,\ |
35 | $ct_Onlywhen the added number is positive |
||
36 | |||
16209 | bpr | 37 | !if $askresult>1 |
20 | reyssat | 38 | !read deduc/sub/simplify $left - ($methparm1)\ |
16209 | bpr | 39 | $right - ($methparm1) |
20 | reyssat | 40 | !distribute lines $out into badleft, badright |
41 | badsign=!translate internal <> to >< in $newsign |
||
16135 | bpr | 42 | |
20 | reyssat | 43 | resultlist=$newobject2,\ |
16209 | bpr | 44 | $newleft $newsign $badright,\ |
45 | $badleft $newsign $newright |
||
46 | !endif |
||
20 | reyssat | 47 | |
48 | !exit |