checkfile=$checkdir/number.proc
!if $rounding<10
    rounding=0
    !readproc $remarkdir/rounding.$taal
!endif
arglist=x
varlist=$empty
cols=10
rows=2
inputs=1
questiontype=0
n=$counter
!if $level=0
    R=$counter
!else
    R=$level
!endif
exotext=!record 19 of lang/remarks.$taal
exotext=<small>$exotext</small>
question$n=!record 3 of lang/remarks.$taal
lijn=!record 4 of lang/remarks.$taal

#functie=(Cx -A)(x+B)= Cx^2 +xCB -xA -AB = Cx^2 +x(CB-A) -AB
#a= C
#b= CB-A
#c= AB

!if $R = 1 
    A=!randitem 1,2,3,-1,-2,-3
    B=!randitem 1,2,3,-1,-2,-3
    C=!randitem 1,-1
!endif
!if $R = 2
    A=!randitem 4,5,6,7,8,-1,-2,-3
    B=!randitem 1,2,3,-4,-5,-6,-7,-8
    C=!randitem 1,-1
!endif
!if $R = 3
    A=!randitem -1,-2,-3,-4,-5,-6,-7,-8,1,2,3,4,5,6,7,8
    B=!randitem -1,-2,-3,-4,-5,-6,-7,-8,1,2,3,4,5,6,7,8
    C=!randitem -2,-3,-4,2,3,4
!endif
!if $R >3
    A=!randitem -1,-2,-3,-4,-5,-6,-7,-8,1,2,3,4,5,6,7,8
    B=!randitem -1,-2,-3,-4,-5,-6,-7,-8,1,2,3,4,5,6,7,8
    C=!randitem -1,-2,-3,-4,-5,-6,-7,-8,1,2,3,4,5,6,7,8
!endif
a=$C
b=$[$C*$B - $A]
c=$[$A*$B]
keuze=!randitem 1,0
functie=(($C)*x - ($A))*(x + ($B))
latex=!texmath $functie
!if $keuze=1
    F=!randitem f,g,h,k,p,w
    formula$n= $F(x)\,\,=\,$latex
    # \left( $C \cdot x - $A \right)\left( x + $B \right)
!else
    formula$n= y\,\,=\,$latex
    #\left( $C \cdot x - $A \right)\left( x + $B \right)
!endif

S=-1*($b)/(2*$a)

tot=!exec pari $S\
printtex($S) 

answer$n=!line 1 of $tot
texanswer$n=!line 2 of $tot
texanswer$n= x\,\,=\,\, $(texanswer$n)	
textanswer$n=$lijn x = $(answer$n)

!if $image=1 or $teaching=1
    XSIZE=150
    YSIZE=150
    plaatje=transparent white\
    xrange $[$(answer$n) - 3],$[$(answer$n) + 3]\
    yrange -40,40\
    vline 0,0,blue\
    hline 0,0,blue\
    linewidth 2\
    dvline $(answer$n),0,red\
    curve green,$functie
    
    !if $printexo=1
	draw=1
	plot=0
	image$n=$plaatje
    !else	
	insdraw_size=150,150
	!insdraw $plaatje
        helptext=!record 11 of lang/remarks.$taal
	#@Hier</a> staat een klein grafiekje van de functie
	#helptext=<a href="javascript:showimage();">$helptext
	helptext=<a onmouseover="this.T_OPACITY=85;this.T_PADDING=10;this.T_WIDTH=$XSIZE;this.T_BORDERCOLOR='gold';this.T_BORDERWIDTH=1;return escape('<img src= $wims_ref_name?&session=$session&module=$module&cmd=getins&special_parm=insert-1.gif>')"><font color=blue>$helptext</font>
        #helptext=<a onmouseover="return escape('<img src= $wims_ref_name?&session=$session&module=$module&cmd=getins&special_parm=insert-1.gif>')"><font color=blue>$helptext</font>
    !endif
!endif


