Subversion Repositories wimsdev

Rev

Rev 16135 | Go to most recent revision | Details | 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
7
 !goto $wims_read_parm
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
19
 !distribute items $methparmobj2 into data,left,sign,right
20
 methexp=Add \(methparm1) to two sides of \($left $sign $right)
21
 
22
 !read deduc/sub/simplify ($left + ($methparm1)\
23
	$right + ($methparm1)
24
 !distribute lines $out into newleft,newright
25
 !if $newleft=$empty or $newright=$empty
26
  error=bad_data
27
  !exit
28
 !endif
29
 newsign=$sign
30
 newobject2=$newleft $newsign $newright
31
 oldobject=2
32
 
33
 contextlist=$ct_Always,\
34
	$ct_Onlywhen the added number is of constant sign,\
35
	$ct_Onlywhen the added number is positive
36
 
37
 !if $askresult>1
38
  !read deduc/sub/simplify $left - ($methparm1)\
39
	$right - ($methparm1)
40
  !distribute lines $out into badleft, badright
41
  badsign=!translate internal <> to >< in $newsign
42
 
43
  resultlist=$newobject2,\
44
	$newleft $newsign $badright,\
45
	$badleft $newsign $newright
46
 !endif
47
 
48
!exit
49