n=$teller
!if $graad=0
    R=$teller
!else
    R=$graad
!endif  
!if $taal=nl
    nivo_title=Vergelijkingen oplossen
!else
    nivo_title=Solve an Equation
!endif
letter1=x
letter2=y
###!randitem f,g,h,k
wims_rawmath_variable=$letter1
color1=!randitem red,blue,green,orange,purple
soort=!randitem 1,2
!if $soort=1
    bewerking=bewerking3.proc
!else
    bewerking=bewerking5.proc
!endif
#soort=1 x=223
#soort=2 (1:0)
keuze=!randitem 1,2
a=!randitem 1,2,3,4,5
q=!randitem 2,3,4
b=$[$a+$q]

        
!if $R=1
    aantal_nulpunten=2
    !if $keuze=1
	vraag=($letter1 + $a)($letter1 - $b)
	curve=(x + $a)*(x - $b)
	!if $soort=1
	    GOED$n=$[-1*$a],$b
	!else
	    GOED$n=$[-1*$a],0,$b,0
	!endif    
	punten=points red,$[-1*$a],0,$b,0
	!if $taal=nl
	    parabool=parabool
	    antwoord$n=De waarden zijn <em>x=$b</em> en <em>x=$[-1*$a]</em> \
	    <br> dus de punten ($[-1*$a]:0) en ($b:0)
	!else
	    parabool=parabola
	    antwoord$n=The values  are <em>x=$b</em> and <em>x=$[-1*$a]</em> \
	    <br> and thus the points ($[-1*$a]:0) and ($b:0)
	!endif
	!if $wims_user=supervisor
	    !if $soort=1
	        G$n= x=$b and  x=$[-1*$a]
	    !else
	        G$n= ($[-1*$a]:0) and ($b:0)
	    !endif
	!endif
    !else
	vraag=($a - $letter1)($b + $letter1)
	curve=($a - x)*($b + x)
	!if $soort=1
	    GOED$n=$a,$[-1*$b]
	!else
	    GOED$n=$a,0,$[-1*$b],0
	!endif
	punten=points red,$[-1*$b],0,$a,0
	!if $taal=nl
	    parabool=parabool
	    antwoord$n=De waarden zijn <em>x=$[-1*$b]</em> en <em>x=$a</em> \
	    <br> dus de punten ($a:0) en ($[-1*$b]:0)
	!else
	    parabool=parabola
	    antwoord$n=The values  are <em>x=$b</em> and <em>x=$[-1*$a]</em> \
	    <br> and thus the points ($a:0) and ($[-1*$b]:0)
	!endif
	!if $wims_user=supervisor
    	    !if $soort=1
		G$n= x=$a  and x=$[-1*$b]
	    !else
		G$n= ($a:0) and ($[-1*$b]:0)
	    !endif
	!endif
    !endif
!endif

!if $R=2
    aantal_nulpunten=2
    !if $keuze=1
	curve=!exec pari (x + $a)*(x - $b)
	vraag=!replace internal * by $empty in $curve
	!if $soort=1
	    GOED$n=$[-1*$a],$b
    	!else
	    GOED$n=$[-1*$a],0,$b,0
	!endif
	punten=points red,$[-1*$a],0,$b,0
	!if $taal=nl
	    parabool=parabool
	    antwoord$n=De waarden zijn <em>x=$b</em> en <em>x=$[-1*$a]</em> \
	    <br> dus de punten ($[-1*$a]:0) en ($b:0)
	!else
	    parabool=parabola
	    antwoord$n=The values are <em>x=$b</em> and <em>x=$[-1*$a]</em> \
	    <br> and thus the points ($[-1*$a]:0) and ($b:0)	
	!endif
	!if $wims_user=supervisor
	    !if $soort=1
		G$n= x=$b and x=$[-1*$a]
	    !else
		G$n= ($[-1*$a]:0) and ($b:0)
	    !endif
	!endif
    !else
	curve=!exec pari ($a - x)*(x + $b)
	vraag=!replace internal * by  in $curve
	vraag=!replace internal x by $letter1 in $vraag
	!if $soort=1
	    GOED$n=$a,$[-1*$b]
	!else
	    GOED$n=$a,0,$[-1*$b],0
	!endif
	!if $taal=nl
	    parabool=parabool
	    antwoord$n=De waarden zijn <em>x=$a</em> en <em>x=$[-1*$b]</em> \
	    <br> dus de punten ($a:0) en ($[-1*$b]:0)
	!else
	    parabool=parabola
	    antwoord$n=The values are <em>x=$a</em> and <em>x=$[-1*$b]</em> \
	    <br> and thus the points ($a:0) and ($[-1*$b]:0)	
	!endif
	punten=points red,$a,0,$[-1*$b],0
	!if $wims_user=supervisor
	    !if $soort=1
		G$n= x=$a and x=$[-1*$b]
	    !else
		G$n= ($a:0) and ($[-1*$b]:0)
	    !endif
	!endif
    !endif	
!endif
!if $R=3
    aantal_nulpunten=3
    !if $keuze=1
	curve=x*(x + $a)*(x - $b)
	vraag=$letter1\cdot($letter1 + $a)($letter1 - $b)
	!if $soort=1
	    GOED$n=$[-1*$a],$b,0
	!else
	    GOED$n=$[-1*$a],0,$b,0,0,0
	!endif
	punten=points red,0,0,$[-1*$a],0,$b,0
	!if $taal=nl
	    parabool=derdemachts functie	    
	    antwoord$n=De waarden zijn <em>x=0</em> ,<em>x=$b</em> en <em>x=$[-1*$a]</em> \
	    <br> dus de punten (0:0) en ($b:0) en ($[-1*$a]:0)
	!else
	    parabool=graph of the function
	    antwoord$n=The values are <em>x=0</em> ,<em>x=$b</em> and <em>x=$[-1*$a]</em> \
	    <br> and thus the points (0:0) and ($b:0) and ($[-1*$a]:0)	
	!endif
	!if $wims_user=supervisor
	    !if $soort=1
		G$n= x=0 and x=$b and x=$[-1*$a]
	    !else
		G$n= (0:0) and ($b:0) and ($[-1*$a]:0)
    	    !endif
	!endif
    !else
	curve=x*($a - x)*(x + $b)
	vraag=$letter1\cdot($a - $letter1)($letter1 + $b)
	!if $soort=1
	    GOED$n=$a,$[-1*$b],0
	!else
	    GOED$n=$a,0,$[-1*$b],0,0,0
	!endif
	punten=points red,0,0,$[-1*$b],0,$a,0
	antwoord$n=The values are <em>x=0</em> ,<em>x=$a</em> and <em>x=$[-1*$b]</em> \
	<br> and thus the points (0:0) and ($a:0) and ($[-1*$b]:0)
	!if $wims_user=supervisor
	    !if $soort=1
		G$n=  x=0 and x=$a and x=$[-1*$b]
	    !else
		G$n= (0:0) and ($a:0) and ($[-1*$b]:0)
	    !endif
	!endif
    !endif	
!endif
!if $R>3
#bolleboosjes
    aantal_nulpunten=3
    !if $keuze=1
        curve=!exec pari x*(x + $a)*(x - $b)
	vraag=!replace internal * by  in $curve
	!if $soort=1
	    GOED$n=$[-1*$a],$b,0
	!else
	    GOED$n=$[-1*$a],0,$b,0,0,0
	!endif
	punten=points red,0,0,$[-1*$a],0,$b,0
	!if $taal=nl
	    parabool=derdemachts functie
	    antwoord$n=De waarden zijn <em>x=0</em> ,<em>x=$b</em> en <em>x=$[-1*$a]</em> \
	    <br> dus de punten (0:0) en ($b:0) en ($[-1*$a]:0)
	!else
	    parabool=graph of the function
	    antwoord$n=The values are <em>x=0</em> ,<em>x=$b</em> and <em>x=$[-1*$a]</em> \
	    <br> and thus the points (0:0) and ($b:0) and ($[-1*$a]:0)
	!endif
	!if $wims_user=supervisor
	    !if $soort=1
		G$n= x=0 and x=$b and x=$[-1*$a]
	    !else
		G$n= (0:0) and ($b:0) and ($[-1*$a]:0)
	    !endif
	!endif	
    !else
        curve=!exec pari x*($a - x)*(x + $b)
	vraag=!replace internal * by  in $curve
	vraag=!replace internal x by $letter1  in $vraag
	!if $soort=1
	    GOED$n=$[-1*$b],$a,0
	!else
	    GOED$n=$[-1*$b],0,$a,0,0,0
	!endif
	punten=points red,0,0,$[-1*$b],0,$a,0
	!if $taal=nl
	    parabool=derdemachts functie
	    antwoord$n=De waarden zijn <em>x=0</em> en <em>x=$a</em> an <em>x=$[-1*$b]</em> \
	    <br> en dus de snijpunten (0:0) en ($a:0) en ($[-1*$b]:0)
	    !if $wims_user=supervisor
		!if $soort=1
		    G$n= x=0 en x=$a en x=$[-1*$b]
		!else
		    G$n= (0:0) en ($a:0) en ($[-1*$b]:0)
		!endif
	    !endif
	!else
	    parabool=graph of the function
	    antwoord$n=The values are <em>x=0</em> ,<em>x=$a</em> and <em>x=$[-1*$b]</em> \
	    <br> and thus the points (0:0) and ($a:0) and ($[-1*$b]:0)
	    !if $wims_user=supervisor
		!if $soort=1
		    G$n= x=0 and x=$a and x=$[-1*$b]
		!else
		    G$n= (0:0) and ($a:0) and ($[-1*$b]:0)
		!endif
	    !endif	
	!endif
    !endif
!endif

!if $taal=nl
    !if $soort=1
	opgave$n=\left\{ \begin{array}{c}$letter2=$vraag\\\\$letter2=0\end{array}\right.
	somtekst$n=Los de onderstaande vergelijking op:<br>(Bereken dus x=.....)<br>
    !else
	opgave$n=$letter2=$vraag 
	somtekst$n=Bepaal de co&ouml;rdinaten van de snijpunten van de gegeven $parabool<br> met de <em>$letter1-as</em>:<br>
    !endif
!else
    !if $soort=1
	opgave$n=\left\{ \begin{array}{c}$letter2=$vraag\\\\$letter2=0\end{array}\right.
	somtekst$n=Solve the set of equations:<br>(calculate x=.....)<br>
    !else
	opgave$n=$letter2=$vraag 
	somtekst$n=Determine the co&ouml;rdinates of the intersection points of the $parabool<br> with the <em>$letter1-axis</em>:<br>
    !endif
!endif

!if $PLAATJE=1
    XSIZE=200
    YSIZE=200
    XRANGE=-10,10
    YRANGE=-50,50
    knipperen=1
    aantal_beeldjes=2
    goedeplaatje$n=$XSIZE,$YSIZE\
    transparent white\
    xrange $XRANGE\
    yrange $YRANGE\
    linewidth 1\
    vline 0,0,blue\
    hline 0,0,blue\
    linewidth 2\
    curve $color1,$curve\
    linewidth s*14\
    $punten
!endif


!if $HINT=1 
    !if $taal=nl
	hint=<div align="left"><font color=$fontcolor2>algemene hint<ul>\
	Voor co&ouml;rdinaten van de snijpunten met de <em>x-as</em> (ook wel nulpunten genoemd)\
	stel je de <em>y-waarde</em> van de functie op nul<br>\
	Dus stel we hebben de vergelijking<font color=$fontcolor1> <em>f(x)=x<sup><small>2</small></sup> - 4 &bull; x</em></font><br>\
	Om de nulpunten te vinden,stellen we dus <em>f(x)=0</em> ofwel x<sup><small>2</small></sup> - 4x = 0</em><br>\
	Dus:<font color=$fontcolor1> <em>x<sup><small>2</small></sup> - 4x = 0 --> x(x-4)=0 --> x=0 en x=4</em></font><br>\
	De <em>nulpunten</em> zijn dus <em>x=0 en x=4</em><br>\
	<em>co&ouml;rdinaten van de snijpunten</em> met de <em>x-as</em> zijn dus (0:0) en (4:0)<br>\
	snapje ,$voornaam?</div>
    !else
	hint=no hints.
    !endif
!endif    