Subversion Repositories wimsdev

Rev

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

Rev Author Line No. Line
11884 schaersvoo 1
# reply$n zijn vergelijkingen iets als x^2-4y+z=123 of y=x^2-4y+z,y=x^3-2y+z
2
# var1=varlist substitutes
3
# e.g. varlist=x,y,z ...daar hoort bij: var1=123,sqrt(3),sin(pi/3)
4
# x+3*y-z^2 = 23 --> $[ (123)+3*(sqrt(3))-(sin(pi/3))^2 -(23)]
5
# answer$n=list met vergelijkingen x+3*y-z^2 - 23,4*x+2*y-z - 3,...
6
# arglist is optional : dx/dt=4*t^2-56 of zet arglist=$empty als in de vraag het argument al is gegeven, zoals  f(x) = < input field >
7
# als arglist een getal is ...geef dan iets als arglist=@ en dus bij bij answer$n x^2+y^2=123 
8
# aantal subs-vergelijkingen niet beperkt
9
 
10
goback=0
11
errortext=$empty
12
n=$counter
13
math=0
14
extra=$empty
15
 
16
!if $(reply$n)=?
17
 reply$n=$dontknow
18
 remark$n=$NOK
19
 goback=0
20
 maxscore=0
21
 !exit
22
!endif
11899 schaersvoo 23
testvar2=!itemcnt $(reply$n)
24
testvar1=!itemcnt $(answer$n)
11884 schaersvoo 25
wims_rawmath_variables=$varlist
26
rep_list=$empty
11899 schaersvoo 27
 
28
!for p=1 to $testvar2
11884 schaersvoo 29
 org=!item $p of $(reply$n)
30
 rep=!tolower $org
31
 rep=!nospace $rep
32
 rep=!rawmath $rep
11899 schaersvoo 33
 rep=!replace internal = by , in $rep
34
 chk=!itemcnt $rep
11884 schaersvoo 35
 !if $arglist != $empty
11899 schaersvoo 36
 # dus het antwoord moet iets zijn als H=t^44-3*t
11884 schaersvoo 37
  !if $chk != 2
11899 schaersvoo 38
   errortext=!record 33 of $remarkdir/commonremarks.$taal
11884 schaersvoo 39
   goback=1
40
   maxscore=$[$P1*$maxscore]
41
   !exit
42
  !endif
43
  a1=!item 1 of $rep
44
  a2=!item 2 of $rep
45
  !if $a1 isin $arglist
46
    rep=$a2
47
  !else
48
   !if $a2 isin $arglist
49
    rep=$a1
50
   !else
11899 schaersvoo 51
    # het argument is een getal
52
    rep=$a2 - ($a1)
11884 schaersvoo 53
   !endif
54
  !endif
11899 schaersvoo 55
 !else
56
 # we hebben geen arglist gedefinieerd
57
  !if $chk != 1
58
   # maar de leerling heeft wel een '=' teken gebruikt...
59
   a2=!item -1 of $rep
60
   a1=!item 1 of $rep
61
   found=0
62
   !for v in $varlist
63
    !if $found=0
64
     !if $v isin $a2
65
      rep=$a2
66
      found=2
67
     !else
68
      !if $v isin $a1
69
       rep=$a1
70
       found=1
71
      !endif
72
     !endif
73
    !endif
74
   !next v
75
   !if $found=0
76
    testvar=$a1 = $a2
77
    errortext=!record 55 of $remarkdir/commonremarks.$taal
11901 schaersvoo 78
    goback=1
79
    !exit
11899 schaersvoo 80
   !else
81
    rep=$(a$found)
11900 schaersvoo 82
    extra=!append word $ <strike> $a1 = $a2 </strike> <br /> $youranswer:<em> $org </em> $ to $extra
11899 schaersvoo 83
   !endif
84
  !endif
11884 schaersvoo 85
 !endif
86
 !for f in sqrt,pi,acos,asin,atan,cos,sin,tan,log,ln,sec,abs,e
87
  F=!toupper $f
88
  rep=!replace internal $f by $F in $rep
89
 !next f
90
 i=1
91
 !for v in $varlist
92
  rep=!replace internal $v by ($(var1[$i])) in $rep
93
  !increase i
94
 !next v
95
 rep=!replace [a-z] by $empty in $rep
96
 rep=!tolower $rep
97
 rep=$[$rep]
98
 !if NaN notin $rep
99
  rep_list=!append item $rep to $rep_list
100
 !else
11899 schaersvoo 101
  ex=!record 39 of $remarkdir/commonremarks.$taal
11884 schaersvoo 102
  extra=!append word $ <span style="color:red">$ex</span><br /> $ to $extra
103
 !endif
104
!next p
105
 
106
!if $rep_list=$empty or NaN isin $rep_list
11899 schaersvoo 107
 ex=!record 39 of $remarkdir/commonremarks.$taal
11884 schaersvoo 108
 goback=0
109
 maxscore=0
110
 remark$n=$NOK <br />$ex
111
!endif
112
 
113
ans_list=$empty
11899 schaersvoo 114
!for p=1 to $testvar1
11884 schaersvoo 115
 rep=!item $p of $(answer$n)
116
 !if $arglist != $empty
117
  rep=!replace internal = by , in $rep
118
  a1=!item 1 of $rep
119
  a2=!item 2 of $rep
120
  !if $a1 isin $arglist
121
    rep=$a2
122
  !else
123
   !if $a2 isin $arglist
124
    rep=$a1
125
   !else
126
     rep=$a2 - ($a1)
127
   !endif
128
  !endif
129
 !endif
130
 !for f in sqrt,pi,acos,asin,atan,cos,sin,tan,log,ln,sec,abs,e
131
  F=!toupper $f
132
  rep=!replace internal $f by $F in $rep
133
 !next f
134
 i=1
135
 !for v in $varlist
136
  rep=!replace internal $v by ($(var1[$i])) in $rep
137
  !increase i
138
 !next v
139
 rep=!replace [a-z] by $empty in $rep
140
 rep=!tolower $rep
141
 rep=$[$rep]
142
 !if NaN notin $rep
143
  ans_list=!append item $rep to $ans_list
11899 schaersvoo 144
 !else
145
  fck=!item $p of $(answer$n)
146
  errortext=Module ERROR<br />checkfile substeval.proc:<br />there is a problem with the correct answer $p: $fck = $rep
147
  goback=1
148
  !exit
11884 schaersvoo 149
 !endif
150
!next p
151
 
11899 schaersvoo 152
!if $rounding=0
153
 lim2=10^(-6)
11884 schaersvoo 154
!else
11899 schaersvoo 155
 lim2=$[0.5/$rounding]
11884 schaersvoo 156
!endif
11899 schaersvoo 157
your_ans=$empty
158
testvar1=!itemcnt $ans_list
159
testvar2=!itemcnt $rep_list
160
 
161
!if $testvar1 != $testvar2
162
 ex=!record 50 of remarkdir/commonremarks.$taal
163
 #je hebt $testvar2 antwoord(en) ingeleverd in plaats van $testvar1
164
 extra=!append word $ <span style="color:red">$ex</span><br /> $ to $extra
165
 maxscore=$[$P3*$maxscore]
166
!endif
11884 schaersvoo 167
found=$empty
168
this=0
11899 schaersvoo 169
!for p=1 to $testvar2
11884 schaersvoo 170
 rep=!item $p of $rep_list
171
 fun=!item $p of $(reply$n)
172
 this=0
11899 schaersvoo 173
 !for s=1 to $testvar1
174
  !if $p notitemof $found
11884 schaersvoo 175
   ans=!item $s of $ans_list
11899 schaersvoo 176
   absval=$[abs($ans-$rep)] 
177
   !if $absval < 10^(-15)
11884 schaersvoo 178
    !increase score
179
    this=1
11899 schaersvoo 180
    found=!append item $p to $found
11884 schaersvoo 181
    your_ans=!append word $ <span style="color:green">$fun</span><br /> $ to $your_ans
11899 schaersvoo 182
   !else
183
     !if $absval < $lim2
184
      score=$[$P5+$score]
185
      this=1
186
      found=!append item $p to $found
187
      your_ans=!append word $ <span style="color:orange">$fun</span><br /> $ to $your_ans
188
     !endif
11884 schaersvoo 189
   !endif
190
  !endif
191
 !next s
192
 !if $this=0
193
  your_ans=!append word $ <span style="color:red">$fun</span><br /> $ to $your_ans
194
 !endif
195
!next p
11899 schaersvoo 196
maxscore=$[$maxscore*$score/$testvar2]
11884 schaersvoo 197
modulescore=$[$modulescore + $maxscore]
198
 
11899 schaersvoo 199
reply$n=!append word $ <br />$your_ans  $ to $(reply$n)
11884 schaersvoo 200
 
201
!if $maxscore>0.9
11899 schaersvoo 202
 remark$n=$OK 
11884 schaersvoo 203
!else
11899 schaersvoo 204
 !if $maxscore >0.45
205
  remark$n=$BOK 
206
 !else
207
  remark$n=$NOK 
208
 !endif
11884 schaersvoo 209
!endif
11899 schaersvoo 210
!if $extra != $empty
211
 remark$n=!append line $ $extra $ to $(remark$n)
212
!endif
11884 schaersvoo 213
!exit