image=0
multiimage=0
n=$counter
# Determine the derivative of the polynomial ;
F=f\left(x\right)\,\,=\,\,
Fa=f'\left(x\right)\,\,=\,\,

R=$level
!if $level=0
    R=$counter
!endif    
	


pm=!randitem +,-
mp=!randitem +,-

!if $questiontype=0
    exotext=!record 25 of lang/remarks.$taal
    sometext=!record 26 of lang/remarks.$taal
    exotext=<p><a onmouseover="return escape('$sometext')">$exotext
    helptext=$empty
    ss=!record 1 of lang/remarks.$taal
    question$n=$ss
    checkfile=exos/checkfile1.proc
    a=!randitem 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
    b=!randitem 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16    
    c=!randitem 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
    d=!randitem 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16    
    e=!randitem 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16    
    !if $b=$d
	b=$[$b+1]
    !endif	

    !if $R = 1  
	functie=$a*x^$b $pm $e
	formula$n=$F $a\cdot x^{$b} $pm $e
	!goto READY
    !endif
    !if $R = 2 	
	functie=$a*x^$b $pm $c*x $mp $e
        formula$n=$F $a\cdot x^{$b} $pm $c\cdot x $mp $e
        !goto READY
    !endif
    !if $R = 3 
	functie=$a*x^$b $pm $c*x^$d 
	formula$n=$F $a\cdot x^{$b} $pm $c\cdot x^{$d}
	!goto READY
    !endif
    !if $R > 3 
	functie=$a*x^$b $pm $c*x^$d $mp $e
	formula$n=$F $a\cdot x^{$b} $pm $c\cdot x^{$d} $mp $e
    !endif
    :READY
    sommen=!exec pari deriv($functie ,x)\
    printtex(deriv($functie,x))
    answer$n=!line 1 of $sommen
    texanswer$n=!line 2 of $sommen
    texanswer$n=$Fa $(texanswer$n)
 !exit
!endif

!if $questiontype isin 1,2
    # multiple choice
    checkfile=$checkdir/multiplechoice.proc
    !if $questiontype=2
	rr=!record 15 of lang/remarks.$taal
    !else
	rr=!record 16 of lang/remarks.$taal
    !endif
    exotext=$rr
    ss=!record 1 of lang/remarks.$taal
    question$n=$ss
    math=1
    plot=0
    draw=0
    image=0
    aa=!shuffle 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
    cc=!shuffle 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
    ee=!shuffle 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
    total=$empty
    b=!randitem 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16    
    d=!randitem 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16    
    !if $b=$d
	b=$[$b+1]
    !endif	
    !if $options<3 or $options>10
	options=5
    !endif
    answer$n=!randint 1,$options
    !for p=1 to $options
	a=!item $p of $aa
	c=!item $p of $cc
	e=!item $p of $ee
	!if $R=1
	    functie=$a*x^$b $pm $e
	    !if $p=$(answer$n)
		formula$n= $F $a\cdot x^{$b} $pm $e
	    !endif
	!endif
	!if $R=2
	    functie=$a*x^$b $pm $c*x $mp $e
    	    !if $p=$(answer$n)
		formula$n=$F $a\cdot x^{$b} $pm $c\cdot x $mp $e
	    !endif
	!endif
	!if $R=3
	    functie=$a*x^$b $pm $c*x^$d
	    !if $p=$(answer$n) 
		formula$n=$F $a\cdot x^{$b} $pm $c\cdot x^{$d}
	    !endif
	!endif
	!if $R>3
	    functie=$a*x^$b $pm $c*x^$d $mp $e
	    !if $p=$(answer$n)
		formula$n=$F $a\cdot x^{$b} $pm $c\cdot x^{$d} $mp $e
	    !endif
	!endif
	total=!append line printtex(deriv($functie,x)) to $total
    !next p
    sommen=!exec pari $total
    !for p=1 to $options
	ex=!line $p of $sommen
	ex$p=f'(x)\,\,=\,\, $ex
    !next p
    s=$(answer$n)
    texanswer$n=$(ex$s)
 !exit
!endif
