Subversion Repositories wimsdev

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
20 reyssat 1
!! Example of method definition file.
2
 
3
!! Title of the method, to be shown in the method menu. So must be short!
4
!set methtit=Multiply an inequality by a number
5
 
6
!! Title2 can be a bit longer than methtit, intended for exercise authors.
7
!! It defaults to methtit.
8
!set methtit2=Multiply an inequality by a non-zero number
9
 
10
!! Allowed environments.
11
!set methenv=ZZ QQ RR
12
 
13
!! Types of each parameter. Details in the source code of mathexp.
14
!set methparmtype=number,parm inequality
15
 
16
!! Help message. It is one definition, so all the lines must be escaped.
17
!set methhelp=This method transforms an inequality like \(A > B) to\
18
 the equivalent inequality \(A*n > B*n), where \(n) is a number\
19
 that must be non-zero in order to guarantee the equivalence between the\
20
 original inequality and the transformed one.
21
 
22
!if $wims_read_parm iswordof form check
23
 !goto $wims_read_parm
24
!endif
25
 
26
!! You can add more preliminary processing code here.
27
 
28
 
29
!exit
30
 
31
!! The content of the input form.
32
:form
33
 Multiply the inequality
34
 !read deduc/methparm.phtml 2
35
 by the number
36
 !read deduc/methparm.phtml 1,10
37
 
38
!exit
39
 
40
!! Main method processing code. Many parameter verifications are 
41
!! already done automatically.
42
:check
43
 !distribute items $methparmobj2 into data,left,sign,right
44
 !if $methparm1=0
45
  error=Multiply an inequality by 0 makes you lose information, and is therefore\
46
   prohibited.
47
  !advance penalty
48
  !exit
49
 !endif
50
 
51
!! methexp is the explanation of the method in the history list.
52
 methexp=Multiply \($left $sign $right) by \($methparm1)
53
 
54
!! call a standard script in deduc/sub.
55
 !read deduc/sub/simplify ($left) * ($methparm1)\
56
	($right) * ($methparm1)
57
 !distribute lines $out into newleft,newright
58
 !if $newleft=$empty or $newright=$empty
59
  error=bad_data
60
  !exit
61
 !endif
62
 !if $methparm1<0
63
  newsign=!translate internal <> to >< in $sign
64
 !else
65
  newsign=$sign
66
 !endif
67
 
68
!! oldobject=2 means that the new object can replace the second parameter
69
!! object, whenever possible.
70
 newobject2=$newleft $newsign $newright
71
 oldobject=2
72
 
73
!! These lines are used to ask the user for the good context.
74
!! Optional.
75
!! The first line must be the good choice.
76
 contextlist=$ct_Onlywhen the multiplier is non-zero,\
77
	$ct_Onlywhen the multiplier is positive,\
78
	$ct_Onlywhen the two sides are positive,\
79
	$ct_Onlywhen the two sides are of the same sign,\
80
	$ct_Onlywhen the inequality is strict
81
 
82
 badsign=!translate internal <> to >< in $newsign
83
 
84
!! These lines are used to ask the user for the good result.
85
!! Optional.
86
!! The first line must be the good choice.
87
 resultlist=$newobject2,\
88
	$newright $newsign $newleft,\
89
	$newleft $badsign $newright
90
!exit
91