Subversion Repositories wimsdev

Rev

Rev 16135 | Details | Compare with Previous | Last modification | View Log | RSS feed

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