Subversion Repositories wimsdev

Rev

Rev 16120 | 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 inequality
2
!set methenv=ZZ QQ RR
3
!set methparmtype=number,parm inequality
4
!set methhelp=This method transforms an inequality of the form \(a > b)\
5
 into an equivalent one \(a + n > b + n), where \(n) is a number.
6
 
7
!if $wims_read_parm iswordof form check
8
 !goto $wims_read_parm
9
!endif
10
 
11
!exit
12
:form
13
 Add the number
14
 !read deduc/methparm.phtml 1,15
15
 to the two sides of the inequality
16
 !read deduc/methparm.phtml 2
17
 
18
!exit
19
:check
20
 !distribute items $methparmobj2 into data,left,sign,right
21
 methexp=Add \(methparm1) to the two sides of \($left $sign $right)
22
 
23
 !read deduc/sub/simplify $left + ($methparm1)\
24
	$right + ($methparm1)
25
 !distribute lines $out into newleft,newright
26
 !if $newleft=$empty or $newright=$empty
27
  error=bad_data
28
  !exit
29
 !endif
30
 newsign=$sign
31
 newobject2=$newleft $newsign $newright
32
 oldobject=2
33
 
34
 contextlist=$ct_Always,\
35
	$ct_Onlywhen the number added is positive,\
36
	$ct_Onlywhen the inequality is strict,\
37
	$ct_Onlywhen the inequality is not strict
38
 
39
 !if $askresult>1
40
  !read deduc/sub/simplify $left - ($methparm1)\
41
	$right - ($methparm1)
42
  !distribute lines $out into badleft, badright
43
  badsign=!translate internal <> to >< in $newsign
44
 
45
  resultlist=$newobject2,\
46
	$newleft $newsign $badright,\
47
	$badleft $newsign $newright,\
48
	$newleft $badsign $newright,\
49
	$newleft $badsign $badright
50
 !endif
51
 
52
!exit
53