Rev 5807 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 338 | schaersvoo | 1 | # checkt x1=sqrt(123) and x2=sqrt[5](1/3) and x3=4^(1/5) and x4=2*sqrt[7](4)/5 |
| 2 | # checkt x1=1/2+sqrt(123)/2 and x2=3-5sqrt[5](1/3)-4 |
||
| 3 | # sin,cos,tan... |
||
| 4 | # niet voor complex? |
||
| 5 | # powersyntax 3e+3 => 3*10^3 |
||
| 6 | # 3*10**3 => 3*10^3 |
||
| 7 | # error bij "x=sqrt(4)+sqrt(5](5)" dus bij meerdere wortels/sqrt |
||
| 8 | # checkt op doublures x1=sqrt(2) x2=(2)^(1/2) |
||
| 9 | # mag afronden via $rounding |
||
| 10 | # arglist=x ofiets anders als goede antwoord is x=123 checkt dus op "x=" |
||
| 11 | # goede antwoord is komma lijst met goede oplossingen answer$n |
||
| 12 | # exact met maxima |
||
| 13 | # afgerond met pari |
||
| 14 | ############################### |
||
| 15 | # levert een modulescore !!!! # |
||
| 16 | ############################## |
||
| 17 | |||
| 18 | n=$counter |
||
| 19 | errortext=$empty |
||
| 362 | schaersvoo | 20 | goback=0 |
| 338 | schaersvoo | 21 | !if $AAA=$empty |
| 22 | !if ? isin $(reply$n) |
||
| 23 | remark$n=$NOK |
||
| 24 | goback=0 |
||
| 2093 | schaersvoo | 25 | maxscore=0 |
| 338 | schaersvoo | 26 | !exit |
| 27 | !endif |
||
| 28 | AAA=!lower $(reply$n) |
||
| 29 | !endif |
||
| 30 | |||
| 31 | !if $arglist != $empty |
||
| 32 | !for p in $arglist |
||
| 33 | AAA=!replace $p[_0-9]*= by @ in $AAA |
||
| 34 | !next p |
||
| 35 | !if @ notin $AAA |
||
| 36 | testvar=<b>$arglist= ?</b> |
||
| 37 | errortext=!record 53 of $remarkdir/commonremarks.$taal |
||
| 5807 | schaersvoo | 38 | #@Je moet het antwoord wel netjes opschrijven...<br />Wat dacht je van <b>x=</b> je antwoord ? |
| 338 | schaersvoo | 39 | maxscore=$[$P1*$maxscore] |
| 40 | goback=1 |
||
| 41 | !exit |
||
| 42 | !endif |
||
| 43 | AAA=!replace internal @ by , in $AAA |
||
| 44 | !else |
||
| 45 | !if $AAA=$empty |
||
| 46 | errortext=!record 37 of $remarkdir/commonremarks.$taal |
||
| 47 | goback=1 |
||
| 48 | maxscore=$[$P4*$maxscore] |
||
| 49 | !exit |
||
| 50 | !endif |
||
| 51 | !endif |
||
| 52 | |||
| 53 | AAA=!words2items $AAA |
||
| 54 | AAA=!nospace $AAA |
||
| 55 | |||
| 56 | !for p=1 to 5 |
||
| 57 | AAA=!replace internal ,, by , in $AAA |
||
| 58 | !next p |
||
| 59 | |||
| 60 | t=!char 1 of $AAA |
||
| 61 | !if t=, |
||
| 62 | AAA=!char 2 to -1 of $AAA |
||
| 63 | !endif |
||
| 64 | |||
| 65 | t=!char -1 of $AAA |
||
| 66 | !if t=, |
||
| 67 | AAA=!char 1 to -2 of $AAA |
||
| 68 | !endif |
||
| 69 | |||
| 70 | !if $AAA=, |
||
| 71 | errortext=!record 37 of $remarkdir/commonremarks.$taal |
||
| 72 | goback=1 |
||
| 73 | maxscore=$[$P4*$maxscore] |
||
| 74 | !exit |
||
| 75 | !endif |
||
| 76 | |||
| 77 | ### power syntax |
||
| 78 | !if x10 isin $AAA |
||
| 79 | ex=!record 68 of $remarkdir/commonremarks.$taal |
||
| 80 | maxscore=$[$P1*$maxscore] |
||
| 81 | !if $teaching=1 |
||
| 82 | goback=1 |
||
| 83 | errortext=$ex |
||
| 84 | !exit |
||
| 85 | !else |
||
| 86 | !if $extra=$empty |
||
| 87 | extra=$ex |
||
| 88 | !else |
||
| 5807 | schaersvoo | 89 | extra=$extra<br />$ex |
| 338 | schaersvoo | 90 | !endif |
| 91 | AAA=!replace internal x10 by *10 in $AAA |
||
| 92 | !endif |
||
| 93 | !else |
||
| 94 | test=!replace [0-9]e[0-9] by @ in $AAA |
||
| 95 | !if @ isin $test |
||
| 96 | maxscore=$[$P1*$maxscore] |
||
| 97 | testvar1=!replace internal e by e+ in $AAA |
||
| 5857 | schaersvoo | 98 | testvar1=<span color=green>$testvar1</span> |
| 99 | testvar2=<br /><span color=red>$AAA</span> |
||
| 338 | schaersvoo | 100 | errortext=!record 16 of $remarkdir/commonremarks.$taal |
| 101 | goback=1 |
||
| 102 | !exit |
||
| 103 | !endif |
||
| 104 | AAA=!replace internal ** by ^ in $AAA |
||
| 105 | AAA=!replace internal e+ by *10^ in $AAA |
||
| 106 | AAA=!replace internal e- by *10^- in $AAA |
||
| 107 | !for p=1 to 3 |
||
| 108 | AAA=!replace internal ** by * in $AAA |
||
| 109 | !next p |
||
| 110 | t=!char 1 of $AAA |
||
| 111 | !if $t=* |
||
| 112 | AAA=!char 2 to -1 of $AAA |
||
| 113 | !endif |
||
| 114 | !endif |
||
| 115 | |||
| 116 | # rest |
||
| 117 | !if $varlist = $empty |
||
| 118 | vars=x |
||
| 119 | # hmmm |
||
| 120 | !else |
||
| 121 | vars=!words2items $varlist |
||
| 122 | !endif |
||
| 123 | |||
| 124 | !for p in sin,tan,cos,abs,sqrt,pi,i,e,$vars |
||
| 125 | P=!toupper $p |
||
| 126 | AAA=!replace internal $p by $P in $AAA |
||
| 127 | !next p |
||
| 128 | |||
| 129 | AAA=!replace [a-z\@\#\!\%\&\:\;\"\'\_\#\=] by $empty in $AAA |
||
| 130 | AAA=!lower $AAA |
||
| 131 | |||
| 132 | # nu zou AAA een getal moeten zijn? |
||
| 133 | !if $AAA=$empty |
||
| 134 | errortext=!record 37 of $remarkdir/commonremarks.$taal |
||
| 135 | goback=1 |
||
| 136 | maxscore=$[$P4*$maxscore] |
||
| 137 | !exit |
||
| 138 | !endif |
||
| 139 | |||
| 140 | ta=!itemcnt $AAA |
||
| 141 | aaa=$empty |
||
| 142 | !for p=1 to $ta |
||
| 143 | A=!item $p of $AAA |
||
| 144 | !if $A != $empty |
||
| 145 | !if sqrt isin $A |
||
| 146 | ### try to convert AAA= x*sqrt[p](y) => aaa= x*(y)^(1/p) |
||
| 147 | chk=!positionof sqrt[ in $A |
||
| 148 | chk=!itemcnt $chk |
||
| 149 | !if $chk>1 |
||
| 150 | errortext=!record 74 of $remarkdir/commonremarks.$taal |
||
| 5807 | schaersvoo | 151 | #@Dit programma kan geen antwoorden met meerdere wortels erin nakijken<br />Je kunt $A toch echt wel wat wiskundiger/korter schrijven ?<br />Zo niet dan is dit een "fout in de opdracht" en moet je me maar even mailen... |
| 338 | schaersvoo | 152 | goback=1 |
| 153 | !exit |
||
| 154 | !else |
||
| 155 | # special syntax sqrt[]() |
||
| 156 | !if $chk=1 |
||
| 157 | test=!replace internal sqrt[ by @ in $A |
||
| 158 | !if @ isin $test |
||
| 159 | # ook |
||
| 160 | test=!replace internal ] by @ in $test |
||
| 161 | t=!positionof char @ in $test |
||
| 162 | t1=!item 1 of $t |
||
| 163 | t2=!item 2 of $t |
||
| 164 | power=!char $[$t1+1] to $[$t2-1] of $test |
||
| 165 | tt=!nospace sqrt [ $power ] |
||
| 166 | A=!replace internal $tt by sqrt in $A |
||
| 167 | !else |
||
| 168 | # this is nonsens here |
||
| 169 | power=2 |
||
| 170 | # dus 2 == 1/2 (ofwel gewone wortel) |
||
| 171 | !endif |
||
| 172 | test=!replace internal sqrt( by @# in $A |
||
| 173 | test=!replace internal ( by # in $test |
||
| 174 | test=!replace internal ) by % in $test |
||
| 175 | begin=!positionof char @ in $test |
||
| 176 | tot=!charcnt $test |
||
| 177 | wait=0 |
||
| 178 | got=0 |
||
| 179 | end=0 |
||
| 180 | !for s=$begin to $tot |
||
| 181 | !if $end=0 |
||
| 182 | ch=!char $s of $test |
||
| 183 | !if $ch=# |
||
| 184 | !increase wait |
||
| 185 | !endif |
||
| 186 | !if $ch=% |
||
| 187 | !increase got |
||
| 188 | !endif |
||
| 189 | !if $got !=0 |
||
| 190 | !if $wait=$got |
||
| 191 | end=$s |
||
| 192 | !endif |
||
| 193 | !endif |
||
| 194 | !endif |
||
| 195 | !next s |
||
| 196 | sqrt=!char $[$begin+2] to $[$end-1] of $test |
||
| 197 | sqrt=!replace internal # by ( in $sqrt |
||
| 198 | sqrt=!replace internal % by ) in $sqrt |
||
| 199 | A=!replace internal sqrt($sqrt) by ($sqrt)^(1/$power) in $A |
||
| 200 | !endif |
||
| 201 | !endif |
||
| 202 | !endif |
||
| 203 | A=!rawmath $A |
||
| 204 | aaa=!append item $A to $aaa |
||
| 205 | !endif |
||
| 206 | !next p |
||
| 207 | |||
| 208 | |||
| 209 | g=!itemcnt $(answer$n) |
||
| 210 | a=!itemcnt $aaa |
||
| 211 | |||
| 212 | # corrigeren de score voor vergeten of teveel gevonden antwoorden... |
||
| 213 | !if $g != $a |
||
| 214 | !if $a>$g |
||
| 215 | maxscore=$[$maxscore*$g/$a] |
||
| 216 | !else |
||
| 217 | maxscore=$[$maxscore*$a/$g] |
||
| 218 | !endif |
||
| 219 | !endif |
||
| 220 | |||
| 221 | klaar=0 |
||
| 222 | !if $rounding<1 |
||
| 223 | # exact (0) of nvt (-1) |
||
| 224 | maximastring=$empty |
||
| 225 | !for i=1 to $g |
||
| 226 | G=!item $i of $(answer$n) |
||
| 227 | !for s=1 to $a |
||
| 228 | A=!item $s of $aaa |
||
| 229 | maximastring=!append line if rationalize(expand($A)) = rationalize(expand($G)) then 1 else 0; to $maximastring |
||
| 230 | !next s |
||
| 231 | !next i |
||
| 232 | test=!exec maxima $maximastring |
||
| 233 | !else |
||
| 234 | paristring=$empty |
||
| 235 | !for i=1 to $g |
||
| 236 | G=!item $i of $(answer$n) |
||
| 237 | G=$[(round($rounding*($G)))/$rounding] |
||
| 238 | !for s=1 to $a |
||
| 239 | A=!item $s of $aaa |
||
| 240 | A=$[(round($rounding*($A)))/$rounding] |
||
| 241 | paristring=!append line if($A==$G,1,0) to $paristring |
||
| 242 | !next s |
||
| 243 | !next i |
||
| 244 | test=!exec pari $paristring |
||
| 245 | !endif |
||
| 246 | |||
| 247 | #errortext=aaa=$aaa ? sqrt=$sqrt maximasrtin=$maximastring TEST=$test |
||
| 248 | #goback=1 |
||
| 249 | #!exit |
||
| 250 | |||
| 251 | !if $wims_exec_error != $empty |
||
| 252 | goback=1 |
||
| 253 | maxscore=$[$P1*$maxscore] |
||
| 254 | errortext=!record 39 of $remarkdir/commonremarks.$taal |
||
| 255 | #@ je antwoord $(reply$n) is in deze vorm niet na te kijken |
||
| 256 | !exit |
||
| 257 | !endif |
||
| 258 | |||
| 259 | duplicate=0 |
||
| 260 | cnt=$[$g*$a] |
||
| 261 | tot=0 |
||
| 262 | |||
| 263 | # test=1 0 0 0 1 0 0 0 1 |
||
| 264 | # g=3 a=3 |
||
| 265 | !for i=1 to $cnt step $g |
||
| 266 | t=0 |
||
| 267 | !for s=$i to $[$i+$a-1] |
||
| 268 | p=!line $s of $test |
||
| 269 | !ifval $p=1 |
||
| 270 | !increase t |
||
| 271 | !endif |
||
| 272 | !next s |
||
| 273 | !ifval $t=1 |
||
| 274 | tot=$[$tot+$t] |
||
| 275 | !else |
||
| 276 | !if $t>1 |
||
| 277 | duplicate=$[$duplicate+1] |
||
| 278 | !endif |
||
| 279 | !endif |
||
| 280 | !next i |
||
| 281 | !if $duplicate !=0 |
||
| 282 | testvar=$[2*$duplicate] |
||
| 283 | ex=!record 51 of $remarkdir/commonremarks.$taal |
||
| 284 | !if $extra=$empty |
||
| 285 | extra=$ex |
||
| 286 | !else |
||
| 5807 | schaersvoo | 287 | extra=$extra <br />$ex |
| 338 | schaersvoo | 288 | !endif |
| 289 | !endif |
||
| 290 | |||
| 291 | |||
| 292 | maxscore=$[$maxscore*($tot)/($g)] |
||
| 293 | modulescore=$[$modulescore + $maxscore] |
||
| 294 | |||
| 295 | !if $maxscore>0.9 |
||
| 296 | remark$n=$OK |
||
| 297 | !else |
||
| 298 | !if $maxscore>0.45 |
||
| 299 | remark$n=$BOK |
||
| 300 | !else |
||
| 301 | remark$n=$NOK |
||
| 302 | !endif |
||
| 303 | !endif |
||
| 304 | |||
| 305 | !if $extra != $empty |
||
| 5807 | schaersvoo | 306 | remark$n=$(remark$n)<br />$extra |
| 338 | schaersvoo | 307 | !endif |
| 308 | |||
| 309 | !exit |