n=$counter
!if $rounding=-1
    rounding=0
    !readproc $remarkdir/rounding.$taal
!endif
mathviewpanel=$module_title:x_1=:and:x_2=:sqrt()
impossible=0
questiontype=0
checkfile=$checkdir/number.proc
arglist=x
cols=15
rows=4
kleuren=red,blue,green,orange,purple
kleuren=!shuffle $kleuren
color1=!item 1 of $kleuren
color2=!item 2 of $kleuren
exotext=$empty
question$n=!record 2 of lang/remarks.$taal
sometext=!record 6 of lang/remarks.$taal
helptext=!record 23 of lang/remarks.$taal
stext=!record 24 of lang/remarks.$taal
helptext=<a onmouseover="return escape('$helptext')">$stext</a>
raaklijn=!item 1 of $sometext
raken=!item 2 of $sometext
!if $usage=2
    image=0
!endif

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

!if $R=1
    #(x+a)(x+b)=0
    a=!randitem -9,-8,-7,-6,-5,-4,-3,-2,-1,2,3,4,5,6,7,8,9
    b=!randitem -9,-8,-7,-6,-5,-4,-3,-2,-1,2,3,4,5,6,7,8,9
    !if $a=$b
	a=$[$a-1]
    !endif
    curve1=(x+$a)*(x+$b)
    C1=!htmlmath $curve1 = 0
    form1=!exec pari printtex($curve1) 
    formula$n= $form1 \,=\, 0
    x1=$[-1*$a]
    x2=$[-1*$b]
    tex_x1=$x1
    tex_x2=$x2
    y1=0
    y2=0
    textanswer$n=!record 5 of lang/remarks.$taal
    #@ We ontbinden de vergelijking eerst in factoren, <br>dus de vergelijking wordt dan $C1 <br>
    texanswer$n=\left[ \begin{array}{l} x_1 = $tex_x1\\ x_2 = $tex_x2  \end{array}\right.
    answer$n=$x1,$x2
    !if $image=1 or $teaching=1
	XRANGE=-15,15
	YRANGE=-50,50
	curve1=curve $color1,$curve1
	curve2=hline 0,0,$color2
	!readproc exos/image1.proc
    !endif
  !exit
!endif

!if $R=2
    #(x+a)(x+b)=x^2+(a+b)x +ab=0
    #x^2+ex+f = cx+ d
    # x^2+x(e-c)+ (f-d)=0
    #keuze=1 dan d=0, keuze=2 c=0
    keuze=!randitem 1,2
    a=!randitem -9,-8,-7,-6,-5,-4,-3,-2,-1,2,3,4,5,6,7,8,9
    b=!randitem -9,-8,-7,-6,-5,-4,-3,-2,-1,2,3,4,5,6,7,8,9
    c=!randitem -5,-4,-3,-2,-1,2,3,4,5
    d=!randitem -9,-8,-7,-6,-5,-4,-3,-2,-1,2,3,4,5,6,7,8,9
    !if $keuze=1
	e=$[($a) + ($b) + ($c)]
	!if $e=0
	    a=-2
	    b=4
	    c=3
	    e=5
	!endif
	f=$[($a)*($b)]
	d=0
    !else
	e=$[($a) + ($b)]
	!if $e=0
	    a=-2
	    b=4
	    e=2
	!endif
	f=$[($a)*($b)+($d)]
	c=0
    !endif
    tot=!exec pari printtex( x^2 + ($e)*x + ($f) )\
    printtex(($c)*x + ($d))
    form1=!line 1 of $tot
    form2=!line 2 of $tot
    formula$n= $form1 \,=\, $form2
    x1=$[-1*$a]  
    x2=$[-1*$b]
    tex_x1=$x1
    tex_x2=$x2    
    y1=$[$c*$x1+($d)]
    y2=$[$c*$x2+($d)]
    !if $a=$b
	texanswer$n= \overrightarrow{ $raaklijn }\,\,\,\,\,\,  x_1 \,\,=\,\, $tex_x2 
	answer$n=$x1
    !else
	texanswer$n=\left[ \begin{array}{l} x_1 = $tex_x1\\ x_2 = $tex_x2  \end{array}\right.
	answer$n=$x1,$x2
    !endif	
#    antwoord=$a\cdot x^{2}+$b\cdot x+$c=$c \Longleftrightarrow  x\left($a\cdot x+$b\right)=$c-$c \Longrightarrow  
    !if $image=1 or $teaching=1
	curve1=x^2+($e)*x+($f)
	curve2=($c)*x+($d)
	XRANGE=-15,15
	YRANGE=-80,80
	curve1=curve $color1,$curve1
	curve2=curve $color2,$curve2
	!readproc exos/image1.proc
    !endif
  !exit
!endif

!if $R=3
    #(x+a)(x+b)=x^2+(a+b)x +ab=0
    #x^2+ex+f = cx+ d
    # x^2+x(e-c)+ (f-d)=0
    keuze=!randitem 1,2
    a=!randitem -9,-8,-7,-6,-5,-4,-3,-2,-1,2,3,4,5,6,7,8,9
    b=!randitem -9,-8,-7,-6,-5,-4,-3,-2,-1,2,3,4,5,6,7,8,9
    c=!randitem -5,-4,-3,-2,-1,2,3,4,5
    d=!randitem -9,-8,-7,-6,-5,-4,-3,-2,-1,2,3,4,5,6,7,8,9
    e=$[($a) + ($b) + ($c)]
    !if $e=0
	a=-2
	b=4
	c=3
	e=5
    !endif
    f=$[($a)*($b)+($d)]
    tot=!exec pari printtex( x^2 + ($e)*x + ($f) )\
    printtex(($c)*x + ($d))
    form1=!line 1 of $tot
    form2=!line 2 of $tot
    formula$n= $form1 \,=\, $form2
    x1=$[-1*$a]  
    x2=$[-1*$b]
    tex_x1=$x1
    tex_x2=$x2    
    y1=$[$c*$x1+($d)]
    y2=$[$c*$x2+($d)]
    !if $a=$b
	texanswer$n= \overrightarrow{ $raaklijn }\,\,\,\,\,\,  x_1 \,\,=\,\, $tex_x2 
	answer$n=$x1
    !else
	texanswer$n=\left[ \begin{array}{l} x_1 = $tex_x1\\ x_2 = $tex_x2  \end{array}\right.
	answer$n=$x1,$x2
    !endif	
#    antwoord=$a\cdot x^{2}+$b\cdot x+$c=$c \Longleftrightarrow  x\left($a\cdot x+$b\right)=$c-$c \Longrightarrow  
    !if $image=1 or $teaching=1
	curve1=x^2+($e)*x+($f)
	curve2=($c)*x+($d)
	XRANGE=-15,15
	YRANGE=-80,80
	curve1=curve $color1,$curve1
	curve2=curve $color2,$curve2
	!readproc exos/image1.proc
    !endif
  !exit
!endif

!if $R>3
    #(x+a)(x+b)=x^2+(a+b)x +ab=0
    #x^2+ex+f = cx+ d
    # x^2+x(e-c)+ (f-d)=0
    keuze=!randitem 1,2
    a=!randitem -9,-8,-7,-6,-5,-4,-3,-2,-1,2,3,4,5,6,7,8,9
    b=!randitem -9,-8,-7,-6,-5,-4,-3,-2,-1,2,3,4,5,6,7,8,9
    c=!randitem -5,-4,-3,-2,-1,2,3,4,5
    h=!randitem -4,-3,-2,-1,1,2,3,4
    k=!randitem -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,1,2,3,4,5,6,7,8,9,10
    e=$[($a) + ($b) + ($c)]
    !if $e=0
	a=-2
	b=4
	c=3
	e=5
    !endif
    !if $keuze=1
	g=$c
	d=$[$g*$h]
	func2=!texmath ($g)*(x + ($h))	
    !else
	g=$[-1*$c]
	d=$[$k-$g*$h]
	func2=!texmath $k - ($g)*(x + ($h))
    !endif
    f=$[($a)*($b)+($d)]
    func1=!texmath x^2+($e)*x+($f)
    formula$n=$func1 \,\,=\,\, $func2
    x1=$[-1*$a]  
    x2=$[-1*$b]
    tex_x1=$x1
    tex_x2=$x2    
    y1=$[$c*$x1+($d)]
    y2=$[$c*$x2+($d)]
    !if $a=$b
	texanswer$n= \overrightarrow{ $raaklijn }\,\,\,\,\,\,  x_1 \,\,=\,\, $tex_x2 
	answer$n=$x1
    !else
	texanswer$n=\left[ \begin{array}{l} x_1 = $tex_x1\\ x_2 = $tex_x2  \end{array}\right.
	answer$n=$x1,$x2
    !endif	
#    antwoord=$a\cdot x^{2}+$b\cdot x+$c=$c \Longleftrightarrow  x\left($a\cdot x+$b\right)=$c-$c \Longrightarrow  
    !if $image=1 or $teaching=1
	curve1=x^2+($e)*x+($f)
	curve2=($c)*x+($d)
	XRANGE=-15,15
	YRANGE=-80,80
	curve1=curve $color1,$curve1
	curve2=curve $color2,$curve2
	punten=points green,$x1,$y1,$x2,$y2
	!readproc exos/image1.proc
    !endif
  !exit
!endif

