questiontype=0
n=$counter
R=$level
!if $level=0
    R=$counter
!endif
insplot_data=$empty
image=0
wordmax=30
math=0
cols=20
rows=3
## checkfile
checkfile=$checkdir/number.proc
varlist=$empty
arglist=$empty
varcnt=0
##
xlabel=x
ylabel=y
exotext=$empty
helptext=$empty
!if $rounding <1
    rounding=1000
    !readproc $remarkdir/rounding.$taal
!endif
!if $R=1
    a=!randitem -3,-2,-1,0,1,2
    x1=!randitem 0,1,4
    x1=$[$x1+$a]
    delta=!randint 1,10
    delta=$[$delta/100]
    x2=$[$x1+$delta]
    d=!randitem 1,2,3,4
    functie=$d*sqrt(x-($a))
    y1=$[$d*sqrt($x1-$a)]
    y2=$[$d*sqrt($x2-$a)]
    f=!rawmath x-$a
    formula$n=f\left( x \right) \,\,=\,\, $d \cdot \sqrt{$f}
    tot=!exec pari A=($y2-$y1)/($x2-$x1)\
    printtex(A)
    answer$n=!line 1 of $tot
    texanswer$n=!line 2 of $tot
    rnd=$[(round($rounding*$(answer$n)))/$rounding]
    texanswer$n=\frac{\Delta $ylabel}{\Delta $xlabel} \,=\, \frac{$y2-$y1}{$x2-$x1}\,\simeq \,$(texanswer$n) \simeq $rnd
    ss=!record 24 of lang/remarks.$taal
    #@ Bepaal de gemiddelde verandering van <em>f</em> op het interval <b>[ $x1 : $x2 ]</b> 
    question$n=$ss
    !if $teaching=1 or $image=1
	!readproc exos/image.proc
    !endif
!endif
!if $R=2
    x1=!randitem 0,1,2,3,4
    delta=!randint 1,10
    delta=$[$delta/100]
    x2=$[$x1+$delta]
    a=!randitem 1,2,3
    b=!randitem 8,9,10
    c=!randitem -1,-2
    functie=$c*(x-$a)*(x-$b)
    keuze=!randitem 1,0
    !if $keuze=0
	formula$n=f\left( x \right) \,\,=\,\, $c \cdot \left( x-$a \right)\left( x-$b \right)
    !else
	f=!exec  pari printtex($c*(x-$a)*(x-$b))
	formula$n=f\left( x \right) \,\,=\,\, $f 	
    !endif
    y1=$[$c*($x1-$a)*($x1-$b)]
    y2=$[$c*($x2-$a)*($x2-$b)]
    tot=!exec pari A=($y2-$y1)/($x2-$x1)\
    printtex(A)
    answer$n=!line 1 of $tot
    texanswer$n=!line 2 of $tot
    rnd=$[(round($rounding*$(answer$n)))/$rounding]
    texanswer$n=\frac{\Delta $ylabel}{\Delta $xlabel} \,=\, \frac{$y2-$y1}{$x2-$x1}\,=\,$(texanswer$n) \,\simeq $rnd
    ss=!record 24 of lang/remarks.$taal
    #@ Bepaal de gemiddelde verandering van <em>f</em> op het interval <b>[ $x1 : $x2 ]</b> 
    question$n=$ss
    !if $teaching=1 or $image=1
	!readproc exos/image.proc
    !endif
!endif
!if $R>2
    x1=!randitem 0,1,2,3,4
    delta=!randint 1,10
    delta=$[$delta/100]
    x2=$[$x1+$delta]
    a=!randitem 1,2,3
    b=!randitem 8,9,10
    c=!randitem -1,-2,1,2
    d=!randitem 7,8,9,10,11,12
    functie=$c*x*(x-$a)*(x-$b)+$d
    keuze=!randitem 1,0
    !if $keuze=0
	formula$n=f\left( x \right) \,\,=\,\, $c \cdot x \cdot \left( x-$a \right)\left( x-$b \right) + $d
    !else
	f=!exec  pari printtex($c*x*(x-$a)*(x-$b)+$d)
	formula$n=f\left( x \right) \,\,=\,\, $f 	
    !endif
    y1=$[$c*$x1*($x1-$a)*($x1-$b)+$d]
    y2=$[$c*$x2*($x2-$a)*($x2-$b)+$d]
    tot=!exec pari A=($y2-$y1)/($x2-$x1)\
    printtex(A)
    answer$n=!line 1 of $tot
    texanswer$n=!line 2 of $tot
    rnd=$[(round($rounding*$(answer$n)))/$rounding]
    texanswer$n=\frac{\Delta $ylabel}{\Delta $xlabel} \,=\, \frac{$y2-$y1}{$x2-$x1}\,=\,$(texanswer$n) \,\simeq\,$rnd
    ss=!record 24 of lang/remarks.$taal
    #@ Bepaal de gemiddelde verandering van <em>f</em> op het interval <b>[ $x1 : $x2 ]</b> 
    question$n=$ss
    !if $teaching=1 or $image=1
	!readproc exos/image.proc
    !endif
!endif
