n=$counter
!if $level=0
    R=$counter
!else
    R=$level
!endif
math=0
cols=15
rows=4
!if $rounding<10
    rounding=0
    !readproc $remarkdir/rounding.$taal
!endif
#rotzakken....
checkfile=$checkdir/number.proc
arglist=x
varlist=$empty
text=!record 9 of lang/remarks.$taal
#@ Bepaal de nulpunten,er zijn geen wortels ,de twee wortels zijn,en,de ene wortel is
exotext=!record 19 of lang/remarks.$taal
exotext=<small>$exotext</small>
question$n=!item 1 of $text
geen=!item 2 of $text
twee=!item 3 of $text
en=!item 4 of $text
ene=!item 5 of $text

#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,1
    b=!randitem -5,-4,-3,-2,-1,1,2,3,4,5
    c=!randitem -10,-8,-6,-4,-2,-1,1,2,4,6,8,10 
!endif
!if $R = 2
    a=!randitem -1,1
    b=!randitem -5,-4,-3,-2,-1,1,2,3,4,5
    c=!randitem -10,-8,-6,-4,-2,-1,1,2,4,6,8,10 
!endif
!if $R = 3
    a=!randitem -1,1
    b=!randitem -5,-4,-3,-2,-1,1,2,3,4,5
    c=!randitem -10,-8,-6,-4,-2,-1,1,2,4,6,8,10 
!endif
!if $R >3
    a=!randitem -1,1
    b=!randitem -5,-4,-3,-2,-1,1,2,3,4,5
    c=!randitem -10,-8,-6,-4,-2,-1,1,2,4,6,8,10 
!endif

functie=($a)*x^2 + ($b)*x + ($c)
!if $[$b*$b - 4*($a)*($c)] >= 0
    x1=(-1*$b + sqrt($b*$b - 4*($a)*($c)))/(2*($a))
    x2=(-1*$b - sqrt($b*$b - 4*($a)*($c)))/(2*($a))
    tot=!exec maxima expand($x1);\
    expand($x2);
    !if $[$b*$b - 4*($a)*($c)] > 0
	var1=2
	#extra$n=2
    !else
	var1=1
	#extra$n=1
    !endif    
!else
    textanswer$n=$geen
    answer$n=nil
    texanswer$n=\rightarrow \,\,\, \nexists
    var1=0
    #extra$n=0
!endif	
    
!if $var1>0
    x1=!line 1 of $tot
    x2=!line 2 of $tot
    X1tex=!texmath $x1
    X2tex=!texmath $x2
    !if $var1=2
	texanswer$n= \left[ \begin{array}{c}x_{1}= $X1tex\\ x_{2}= $X2tex\end{array}\right.
	answer$n=$x1,$x2
	punten=points red,$[$x1],0,$[$x2],0
	textanswer$n=$twee  x1=$x1 $en x2=$x2
    !else
	texanswer$n= x\,\,=\,\, $X1tex
	answer$n=$x1
	punten=point $[$x1],0,red
	textanswer$n=$ene x=$x1
    !endif
!else
    # $var1=0
    punten=$empty
!endif
    
keuze=!randitem 1,0
formula$n=!exec pari printtex($functie)    
F=!randitem f,g,h,k,p,w
formula$n=$F \left( x \right)\,\,=\,\,$(formula$n)

!if $image=1 or $teaching=1
    XSIZE=150
    YSIZE=150
    plaatje=\
    transparent white\
    xrange -10,10\
    yrange -100,100\
    vline 0,0,blue\
    hline 0,0,blue\
    linewidth 2\
    dvline $S,0,red\
    curve green,$functie\
    linewidth 6\
    $punten

    !if $printexo=1
	plot=0
	draw=1   
	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
