Rev 362 | Rev 1094 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
# this file expects a reply$n and returns a modulescore
# the answer is an Equation
# arglist: f(x) y F(x) f:x-> is a list of function 'args'
# varlist=x,y,z
# varcnt=1 : just 1 variable, for now...
# this checkfile will return the exercise with penalties more often than is wanted
# because it's very tricky to let students fill in freestyle equations
goback=0
errortext=$empty
!if $wims_user=supervisor
!if $arglist=$empty
errortext=YOU SHOULD PROVIDE : <br>arglist= f(x)= y= f:x->
goback=1
!exit
!endif
!if $varlist=$empty
errortext=YOU SHOULD DECLARE : <br>varlist=x or varlist=yield
goback=1
!exit
!endif
varcnt=!itemcnt $varlist
!if $varcnt=0 or $varcnt>1
goback=1
errortext=FOR NOW WE ONLY HANDLE ONE VARIABLE <br>like x or y ,Z,yield,profit,H,G)
!exit
!endif
!endif
n=$counter
test=!wordcnt $(reply$n)
!if $test=0
goback=1
maxscore=$[$P9*$maxscore]
errortext=!record 37 of $remarkdir/commonremarks.$taal
!exit
!endif
!if ? isin $(reply$n)
remark$n=$NOK
goback=0
maxscore=0
modulescore=$[$modulescore + 0.1]
!exit
!endif
AAA=!nospace $(reply$n)
AAA=!lower $AAA
var=!lower $varlist
!if $varlist != nil
!for i in $var
!if $var notin $AAA
testvar=$varlist
errortext=!record 32 of $remarkdir/commonremarks.$taal
goback=1
# heavy pentalty...
maxscore=$[$P6*$maxscore]
!exit
!endif
!next i
!endif
# Check is the answer is an equation: something like
# y=5x+4
# f(x)=5x+4
# f:x->5x+4
# f:x-->5x+4
# provided mustbe $arglist= y f(x) f:x
#
test=!replace internal = by , in $AAA
test=!replace internal --> by , in $test
test=!replace internal -> by , in $test
t1=!itemcnt $test
!if $t1 <2
errortext=!record 33 of $remarkdir/commonremarks.$taal
goback=1
maxscore=$[$maxscore*$P2]
!exit
!endif
!if $t1 >2
errortext=!record 34 of $remarkdir/commonremarks.$taal
goback=1
maxscore=$[$maxscore*$P2]
!exit
!endif
wims_rawmath_variables=$varlist
# f(x)=x^2 --> A1=f(x) A2=x^2
A1=!item 1 of $test
A2=!item 2 of $test
con=0
noc=0
arglist=!lower $arglist
!for s in $arglist
!if $s isin $A1
!increase con
!endif
!if $s isin $A2
!increase noc
!endif
!next s
!if $con=0 and $noc=0
testvar1=!randitem $arglist
testvar2=$varlist
errortext=!record 35 of $remarkdir/commonremarks.$taal
goback=1
maxscore=$[$maxscore*$P3]
!exit
!endif
!if $con > 0 and $noc=0
# normale vergelijking y=4x+5 -> A1=y A2=4x+5
!for i in *,+,-,+,/
!if $i isin $A1
testvar1=!randitem $arglist
testvar2=$varlist
errortext=!record 35 of $remarkdir/commonremarks.$taal
goback=1
maxscore=$[$maxscore*$P3]
!exit
!endif
!next i
!if $varlist != nil
!if $var isin $A2
# controle op "x" in 4x+5
AAA=!rawmath $A2
!else
testvar=$(reply$n)
errortext=!record 26 of $remarkdir/commonremarks.$taal
goback=1
maxscore=$[$maxscore*$P6]
!exit
!endif
!else
AAA=!rawmath $A2
!endif
!else
!if $teaching=1
testvar2=$varlist
testvar1=!randitem $arglist
errortext=!record 35 of $remarkdir/commonremarks.$taal
goback=1
maxscore=$[$maxscore*$P8]
!exit
!else
!if $varlist != nil
!if $var isin $A1
testvar=$A2
!for i in *,+,-,+,/
!if $i isin $A2
errortext=!record 35 of $remarkdir/commonremarks.$taal
goback=1
maxscore=$[$maxscore*$P7]
!exit
!endif
!next i
AAA=!rawmath $A1
!else
errortext=!record 36 of $remarkdir/commonremarks.$taal
goback=1
maxscore=$[$maxscore*$P6]
!exit
!endif
!else
AAA=!rawmath $A1
!endif
!endif
!endif
!if $varlist != nil
!for i in sin,cos,tan,ln,sqrt,log
!if $i isin $AAA
test=!replace internal $i( by # in $AAA
# haakjes om alles sin(x),cos(x),tan(x),ln(x),sqrt(x),log(x)
!if # notin $test
testvar2=!nospace $i $varlist
testvar1=!nospace $i ( $varlist )
errortext=!record 19 of $remarkdir/commonremarks.$taal
goback=1
!exit
!endif
I=!toupper $i
!if $i=ln
# pari en ln -> log
AAA=!replace internal $i by LOG in $AAA
GGG=!replace internal $i by log in $GGG
!else
AAA=!replace internal $i by $I in $AAA
# sin(x) -> SIN(x)
!endif
!endif
!next i
!endif
GGG=!lower $(answer$n)
GGG=!nospace $GGG
GGG=!replace internal $varlist by x in $GGG
AAA=!replace internal $var by X in $AAA
AAA=!replace [a-z\~!@#$%&_'"] by $empty in $AAA
AAA=!lower $AAA
AAA=!rawmath $AAA
AAA=!nospace $AAA
#T1=!evalsubst x=10 in $AAA
#T2=!evalsubst x=10 in $GGG
test=!exec maxima if ratsimp($AAA) = ratsimp($GGG) then 1 else 0;
#test2=!exec pari if( 1.0*($AAA) == 1.0*($GGG) ,1,0)
!if $wims_exec_error!= $empty
errortext=!record 26 of $remarkdir/commonremarks.$taal
goback=1
maxscore=$[$maxscore*$P1]
!exit
!endif
maxscore=$[$maxscore*$test]
!if $maxscore>0.9
remark$n=$OK
!else
!if $maxscore>0.5
remark$n=$BOK
!else
remark$n=$NOK
!endif
!endif
modulescore=$[$modulescore + $maxscore]
goback=0
!exit