Rev 7477 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 7477 | Rev 14455 | ||
|---|---|---|---|
| Line 9... | Line 9... | ||
| 9 | # letop geen variabele "t" gebruiken...gaat mis vermoedelijk via de "t" in "sqrt" -> sqrT() -> sqr() -> () |
9 | # letop geen variabele "t" gebruiken...gaat mis vermoedelijk via de "t" in "sqrt" -> sqrT() -> sqr() -> () |
| 10 | # for instance: the simplify \frac{4x^{3}}{2x^{\frac{-1}{2}}} |
10 | # for instance: the simplify \frac{4x^{3}}{2x^{\frac{-1}{2}}} |
| 11 | # varlist=x |
11 | # varlist=x |
| 12 | # var1=4*x^3/(2*x^(-1/2)) |
12 | # var1=4*x^3/(2*x^(-1/2)) |
| 13 | # 1/2011 added !exec toascii $param1,$param2... |
13 | # 1/2011 added !exec toascii $param1,$param2... |
| - | 14 | # 11/2019 var2=1: reject 3sqrt(a*b) == sqrt(9)sqrt(a*b) != sqrt(9ab) |
|
| - | 15 | # gebruik alleen laatste gedeelte na " <==>,<=>,=>,<-->,<->,->,=" |
|
| 14 | 16 | ||
| 15 | goback=0 |
17 | goback=0 |
| 16 | errortext=$empty |
18 | errortext=$empty |
| 17 | 19 | ||
| 18 | !if $wims_user=supervisor |
20 | !if $wims_user=supervisor |
| Line 48... | Line 50... | ||
| 48 | !exit |
50 | !exit |
| 49 | !endif |
51 | !endif |
| 50 | 52 | ||
| 51 | 53 | ||
| 52 | AAA=!nospace $(reply$n) |
54 | AAA=!nospace $(reply$n) |
| - | 55 | !for p in <==>,<=>,=>,<-->,<->,->,= |
|
| - | 56 | AAA=!replace internal $p by , in $AAA |
|
| - | 57 | !next p |
|
| - | 58 | AAA=!item -1 of $AAA |
|
| 53 | AAA=!rawmath $AAA |
59 | AAA=!rawmath $AAA |
| 54 | AAA=!lower $AAA |
60 | AAA=!lower $AAA |
| 55 | AAA=!rawmath $AAA |
61 | AAA=!rawmath $AAA |
| 56 | var=!lower $varlist |
62 | var=!lower $varlist |
| 57 | va=!varlist $AAA |
63 | va=!varlist $AAA |
| Line 61... | Line 67... | ||
| 61 | !if $it=1 |
67 | !if $it=1 |
| 62 | # exclude sqrt,log... |
68 | # exclude sqrt,log... |
| 63 | !if $i notin $var |
69 | !if $i notin $var |
| 64 | testvar=!append line <b>$i</b> to $testvar |
70 | testvar=!append line <b>$i</b> to $testvar |
| 65 | !endif |
71 | !endif |
| 66 | !endif |
72 | !endif |
| 67 | !next i |
73 | !next i |
| 68 | 74 | ||
| 69 | !if $testvar!=$empty |
75 | !if $testvar!=$empty |
| 70 | ex=!record 77 of $remarkdir/commonremarks.$taal |
76 | ex=!record 77 of $remarkdir/commonremarks.$taal |
| 71 | !if $teaching=1 |
77 | !if $teaching=1 |
| Line 83... | Line 89... | ||
| 83 | 89 | ||
| 84 | !for i in $var |
90 | !for i in $var |
| 85 | !if $i notin $AAA |
91 | !if $i notin $AAA |
| 86 | testvar=$i |
92 | testvar=$i |
| 87 | ex=!record 32 of $remarkdir/commonremarks.$taal |
93 | ex=!record 32 of $remarkdir/commonremarks.$taal |
| 88 | !if $teaching=1 |
94 | !if $teaching=1 |
| 89 | goback=1 |
95 | goback=1 |
| 90 | errortext=$ex |
96 | errortext=$ex |
| 91 | # heavy pentalty... |
97 | # heavy pentalty... |
| 92 | maxscore=$[$P9*$maxscore] |
98 | maxscore=$[$P9*$maxscore] |
| 93 | !else |
99 | !else |
| 94 | remark$n=$NOK<br />$ex |
100 | remark$n=$NOK<br />$ex |
| Line 197... | Line 203... | ||
| 197 | !exit |
203 | !exit |
| 198 | !endif |
204 | !endif |
| 199 | !endif |
205 | !endif |
| 200 | !next p |
206 | !next p |
| 201 | !endif |
207 | !endif |
| 202 | !endif |
208 | !endif |
| 203 | 209 | ||
| 204 | # check on literal copying of the exo, this is important because |
210 | # check on literal copying of the exo, this is important because |
| 205 | # we use pari to check if the reply is the same as the answer |
211 | # we use pari to check if the reply is the same as the answer |
| 206 | a1=$AAA |
212 | a1=$AAA |
| 207 | o1=!lower $var1 |
213 | o1=!lower $var1 |
| Line 308... | Line 314... | ||
| 308 | !else |
314 | !else |
| 309 | extra=!append line $ $ex <br /> $ to $extra |
315 | extra=!append line $ $ex <br /> $ to $extra |
| 310 | !endif |
316 | !endif |
| 311 | !else |
317 | !else |
| 312 | t3=0 |
318 | t3=0 |
| 313 | !endif |
319 | !endif |
| 314 | !endif |
320 | !endif |
| 315 | !endif |
321 | !endif |
| 316 | !else |
322 | !else |
| 317 | t3=1 |
323 | t3=1 |
| 318 | !endif |
324 | !endif |
| 319 | # very expensive but te only way to compare "variables in powers" like x^a |
325 | # very expensive but te only way to compare "variables in powers" like x^a |
| 320 | tot=!exec maxima if rationalize(expand(float($AAA))) = rationalize(expand(float($(answer$n)))) then 1 else 0 ;\ |
326 | tot=!exec maxima if rationalize(expand(float($AAA))) = rationalize(expand(float($(answer$n)))) then 1 else 0 ;\ |
| 321 | if ratsimp($AAA) = ratsimp($(answer$n)) then 1 else 0 ;\ |
327 | if ratsimp($AAA) = ratsimp($(answer$n)) then 1 else 0 ;\ |
| 322 | expand($AAA);\ |
328 | expand($AAA);\ |
| 323 | ratsimp($AAA); |
329 | ratsimp($AAA);\ |
| - | 330 | radexpand:false;simp:false;\ |
|
| - | 331 | if $AAA = $(answer$n) then 1 else 0 ; |
|
| 324 | 332 | ||
| 325 | 333 | ||
| 326 | !if $wims_exec_error != $empty |
334 | !if $wims_exec_error != $empty |
| 327 | testvar=$(reply$n) |
335 | testvar=$(reply$n) |
| 328 | maxscore=$[$P4*$maxscore] |
336 | maxscore=$[$P4*$maxscore] |
| 329 | goback=1 |
337 | goback=1 |
| 330 | errortext=!record 26 of $remarkdir/commonremarks.$taal |
338 | errortext=!record 26 of $remarkdir/commonremarks.$taal |
| 331 | !exit |
339 | !exit |
| 332 | !endif |
340 | !endif |
| - | 341 | simpler1=0 |
|
| - | 342 | simpler2=0 |
|
| 333 | 343 | ||
| 334 | t1=!line 1 of $tot |
344 | t1=!line 1 of $tot |
| 335 | t2=!line 2 of $tot |
345 | t2=!line 2 of $tot |
| - | 346 | t5=!line 6 of $tot |
|
| - | 347 | ||
| 336 | !if $[$t1+$t2]>0 |
348 | !if $[$t1+$t2]>0 |
| 337 | tt=1 |
349 | tt=1 |
| 338 | t3=1 |
350 | t3=1 |
| 339 | #hmmm... sometimes substitution mysteriously goes wrong ?? |
351 | #hmmm... sometimes substitution mysteriously goes wrong ?? |
| 340 | !else |
352 | !else |
| 341 | tt=0 |
353 | tt=0 |
| 342 | !endif |
354 | !endif |
| - | 355 | ||
| 343 | 356 | ||
| 344 | # check if the answer can be simplified further on variable level? |
357 | # check if the answer can be simplified further on variable level? |
| 345 | a1=!line 3 of $tot |
358 | a1=!line 3 of $tot |
| 346 | a2=!line 4 of $tot |
359 | a2=!line 4 of $tot |
| 347 | !if $tt=1 |
360 | !if $tt=1 |
| 348 |
|
361 | # answer is technically correct |
| - | 362 | !if $t5=0 and $var2=1 |
|
| - | 363 | # maar kon nog verder sqrt(9*a) ==> 3sqrt(a) |
|
| - | 364 | testvar=<em>$AAA</em> |
|
| - | 365 | ex=!record 74 of $remarkdir/commonremarks.$taal |
|
| - | 366 | extra=!append line $ <br />$ex $ to $extra |
|
| 349 |
|
367 | # strafpunten ! |
| - | 368 | maxscore=$[$P5*$maxscore] |
|
| - | 369 | !else |
|
| 350 |
|
370 | !for p in $varlist |
| 351 |
|
371 | c1=!positionof char $p in $AAA |
| 352 |
|
372 | c3=!positionof char $p in $a2 |
| 353 |
|
373 | c1=!itemcnt $c1 |
| 354 |
|
374 | c3=!itemcnt $c3 |
| 355 |
|
375 | !if $[$c3-$c1]<0 |
| 356 |
|
376 | !increase simpler1 |
| 357 |
|
377 | !endif |
| 358 |
|
378 | !next p |
| 359 | simpler2=0 |
- | |
| 360 |
|
379 | !for p in $varlist |
| 361 |
|
380 | c1=!positionof char $p in $AAA |
| 362 |
|
381 | c3=!positionof char $p in $a1 |
| 363 |
|
382 | c1=!itemcnt $c1 |
| 364 |
|
383 | c3=!itemcnt $c3 |
| 365 |
|
384 | !if $[$c3-$c1]<0 |
| 366 |
|
385 | !increase simpler2 |
| 367 |
|
386 | !endif |
| 368 |
|
387 | !next p |
| 369 |
|
388 | !if $simpler1>0 and $simpler2>0 |
| 370 |
|
389 | # can the answer be further simplified on variable level? |
| 371 |
|
390 | ex=!record 74 of $remarkdir/commonremarks.$taal |
| 372 |
|
391 | testvar=<em>$AAA</em> |
| 373 |
|
392 | !if $teaching=1 |
| 374 |
|
393 | goback=1 |
| 375 |
|
394 | errortext=$ex |
| 376 |
|
395 | maxscore=$[$P7*$maxscore] |
| 377 |
|
396 | !else |
| 378 |
|
397 | # this answer will be wrong !!! no consideration |
| 379 |
|
398 | remark$n=$NOK<br />$ex |
| 380 |
|
399 | goback=0 |
| 381 |
|
400 | maxscore=0 |
| - | 401 | !endif |
|
| - | 402 | !exit |
|
| - | 403 | !endif |
|
| 382 |
|
404 | !endif |
| - | 405 | # in some cases we can "check" if the correct student answer (a fraction) can be written simpler... |
|
| - | 406 | !if / isin $AAA and / isin $(answer$n) |
|
| - | 407 | a=!replace internal / by , in $AAA |
|
| - | 408 | at=!itemcnt $a |
|
| - | 409 | g=!replace internal / by , in $(answer$n) |
|
| - | 410 | gt=!itemcnt $g |
|
| - | 411 | !if $at=2 and $gt=2 |
|
| - | 412 | a1=!item 1 of $a |
|
| - | 413 | a2=!item 2 of $a |
|
| - | 414 | g1=!item 1 of $g |
|
| - | 415 | g2=!item 2 of $g |
|
| - | 416 | rep1=0 |
|
| - | 417 | rep2=0 |
|
| - | 418 | !for p in $varlist |
|
| - | 419 | !if $p isin $a1 and $p isin $g1 |
|
| - | 420 | a1=!replace internal $p by (10) in $a1 |
|
| - | 421 | g1=!replace internal $p by (10) in $g1 |
|
| 383 |
|
422 | rep1=1 |
| 384 | !endif |
423 | !endif |
| 385 | - | ||
| 386 | # in some cases we can "check" if the correct student answer (a fraction) can be written simpler... |
- | |
| 387 | !if / isin $AAA and / isin $(answer$n) |
- | |
| 388 | a=!replace internal / by , in $AAA |
- | |
| 389 | at=!itemcnt $a |
- | |
| 390 | g=!replace internal / by , in $(answer$n) |
- | |
| 391 | gt=!itemcnt $g |
- | |
| 392 | !if $at=2 and $gt=2 |
- | |
| 393 | a1=!item 1 of $a |
- | |
| 394 | a2=!item 2 of $a |
- | |
| 395 | g1=!item 1 of $g |
- | |
| 396 | g2=!item 2 of $g |
- | |
| 397 | rep1=0 |
- | |
| 398 | rep2=0 |
- | |
| 399 | !for p in $varlist |
- | |
| 400 | !if $p isin $a1 and $p isin $g1 |
- | |
| 401 | a1=!replace internal $p by (10) in $a1 |
- | |
| 402 | g1=!replace internal $p by (10) in $g1 |
- | |
| 403 | rep1=1 |
- | |
| 404 | !endif |
- | |
| 405 |
|
424 | !if $p isin $a2 and $p isin $g2 |
| 406 |
|
425 | rep2=1 |
| 407 |
|
426 | a2=!replace internal $p by (11) in $a2 |
| 408 |
|
427 | g2=!replace internal $p by (11) in $g2 |
| 409 |
|
428 | !endif |
| 410 |
|
429 | !next p |
| 411 |
|
430 | !if $rep1=1 and $rep2=1 |
| 412 |
|
431 | a1=$[abs($a1)] |
| 413 |
|
432 | g1=$[abs($g1)] |
| 414 |
|
433 | a2=$[abs($a2)] |
| 415 |
|
434 | g2=$[abs($g2)] |
| 416 |
|
435 | !if NaN notin $a1$a2$g1$g2 |
| 417 |
|
436 | !if $a1 != $g1 or $a2 != $g2 |
| 418 |
|
437 | ex=!record 74 of $remarkdir/commonremarks.$taal |
| 419 |
|
438 | maxscore=$[$P6*$maxscore] |
| 420 | !if $extra=$empty |
- | |
| 421 | extra=$ex |
- | |
| 422 | !else |
- | |
| 423 | extra=!append line $ <br />$ex $ to $extra |
- | |
| 424 | !endif |
- | |
| 425 | !endif |
- | |
| 426 | !endif |
- | |
| 427 | !endif |
- | |
| 428 | !else |
- | |
| 429 | !if $at > $gt |
- | |
| 430 | ex=!record 74 of $remarkdir/commonremarks.$taal |
- | |
| 431 | maxscore=$[$maxscore*$P9] |
- | |
| 432 | !if $extra=$empty |
- | |
| 433 | extra=$ex |
- | |
| 434 | !else |
- | |
| 435 |
|
439 | extra=!append line $ <br />$ex $ to $extra |
| 436 | !endif |
- | |
| 437 |
|
440 | !endif |
| 438 | !endif |
- | |
| 439 | !endif |
441 | !endif |
| - | 442 | !endif |
|
| - | 443 | !else |
|
| - | 444 | !if $at > $gt |
|
| - | 445 | ex=!record 74 of $remarkdir/commonremarks.$taal |
|
| - | 446 | maxscore=$[$maxscore*$P9] |
|
| - | 447 | extra=!append line $ <br />$ex $ to $extra |
|
| - | 448 | !endif |
|
| - | 449 | !endif |
|
| - | 450 | !endif |
|
| 440 | !endif |
451 | !endif |
| - | 452 | #exotext=tot=$tot $var2=1 and $t5=0 simpler1=$simpler1 simp2=$simpler2 tt=$tt t3=$t3 extra=$extra |
|
| - | 453 | #goback=1 |
|
| - | 454 | #!exit |
|
| 441 | 455 | ||
| 442 | score=$[(9*$tt+$t3)/10] |
456 | score=$[(9*$tt+$t3)/10] |
| 443 | maxscore=$[$maxscore*$score] |
457 | maxscore=$[$maxscore*$score] |
| 444 | modulescore=$[$modulescore + $maxscore] |
458 | modulescore=$[$modulescore + $maxscore] |
| 445 | 459 | ||
| Line 452... | Line 466... | ||
| 452 | remark$n=$NOK |
466 | remark$n=$NOK |
| 453 | !endif |
467 | !endif |
| 454 | !endif |
468 | !endif |
| 455 | 469 | ||
| 456 | !if $extra != $empty |
470 | !if $extra != $empty |
| 457 | remark$n=!append line $ <br /> $extra $ to $(remark$n) |
471 | remark$n=!append line $ <br /> $extra $ to $(remark$n) |
| 458 | !endif |
472 | !endif |
| 459 | goback=0 |
473 | goback=0 |
| 460 | !exit |
474 | !exit |