n=$teller
bewerking=bewerking4.proc
!if $graad=0
    R=$teller
!else
    R=$graad
!endif  

letter1=x
letter2=!randitem f,g,h,k
letter3=!randitem j,m,n,s,t,v,w
wims_rawmath_variable=$letter1

kleuren=red@rooie,blue@blauwe,green@groene,orange@oranje,purple@paarse
kleuren=!shuffle $kleuren
k1=!item 1 of $kleuren
k2=!item 2 of $kleuren
k1=!replace internal @ by , in $k1
k2=!replace internal @ by , in $k2
kleur1=!item 2 of $k1
color1=!item 1 of $k1
kleur2=!item 2 of $k2
color2=!item 1 of $k2


        
!if $R=1
    Xmin=-5
    Xmax=5
    Ymin=-80
    Ymax=80
#snijpunt met de simpelste horziontale lijn 
    a=!randitem -3,-2,2,3
    b=!randitem 2,3,4,6,8,10
    pm=!randitem +,-
    X1=!randitem -4,-3,-2,-1
    X2=$[-1*$X1]
    Y1=$[$a*$X1*$X1 $pm $b ]
    Y2=$Y1
    parabool=$a\cdot x^2  $pm $b
    curve1=$a*x^2 $pm $b
    punten=points red,$X1,$Y1,$X2,$Y2
    curve2=$Y1
    lijn=$Y1
    GOED$n=$X1,$Y1,$X2,$Y2
!endif

!if $R=2 or $R=3
    Xmin=-10
    Xmax=10
    Ymin=-100
    Ymax=100
    b=!randitem 2,3,4,5
    pm=!randitem +,-
    X1=!randitem -9,-8,-7,-6,-5,-4,-3,-2,-1
    !if $R=2
	X2=$[-1*$X1]
    !else
	X2=!randitem 1,2,3,4,5,6,7,8,9
    !endif
    Y1=$[$X1*$X1 $pm $b*$X1 ]
    Y2=$[$X2*$X2 $pm $b*$X2 ]
    parabool=x^2 $pm $b\cdot x
    curve1=x^2 $pm $b*x
    punten=points red,$X1,$Y1,$X2,$Y2
    tussen=!exec pari ((($Y1)-($Y2))/(($X1)-($X2)))*x + ($Y1) -($X1)*(($Y1)-($Y2))/(($X1)-($X2))\
    printtex((($Y1-$Y2)/($X1-$X2))*x + $Y1 -$X1*($Y1-$Y2)/($X1-$X2)) 
    curve2=!line 1 of $tussen
    lijn=!line 2 of $tussen
    GOED$n=$X1,$Y1,$X2,$Y2
!endif
!if $R>3
#bolleboosjes
    Xmin=-7
    Xmax=7
    Ymin=-300
    Ymax=300
    b=!randitem 2,3,4,5
    a=!randitem 2,3,4,5,-2,-3,-4,-5
    c=!randitem 4,6,8,10,12
    pm=!randitem +,-
    X1=!randitem -6,-5,-4,-3,-2,-1
    !if $R=1
	X2=$[-1*$X1]
    !else
	X2=!randitem 1,2,3,4,5,6
    !endif
    Y1=$[$a*$X1*$X1 $pm $b*$X1 - $c ]
    Y2=$[$a*$X2*$X2 $pm $b*$X2 -$c ]
    parabool=$a\cdot x^2 $pm $b\cdot x - $c
    curve1=$a*x^2 $pm $b*x - $c
    punten=points red,$X1,$Y1,$X2,$Y2
    tussen=!exec pari ((($Y1)-($Y2))/(($X1)-($X2)))*x + ($Y1) -($X1)*(($Y1)-($Y2))/(($X1)-($X2))\
    printtex((($Y1-$Y2)/($X1-$X2))*x + $Y1 -$X1*($Y1-$Y2)/($X1-$X2)) 
    curve2=!line 1 of $tussen
    lijn=!line 2 of $tussen
    GOED$n=$X1,$Y1,$X2,$Y2
!endif

    opgave$n=\left\{ \begin{array}{c}$letter2\left($letter1\right)=$parabool\\\\$letter3\left($letter1\right)=$lijn\end{array}\right.

!if $taal=nl
    !if $PLAATJE=1
	somtekst$n=<br>Bereken de <em>co&ouml;rdinaten van de snijpunten</em> van<ul>\
	<li>parabool <em>$letter2</em><font color=$color1> ($kleur1 curve)</font>\
	<li>met de lijn <em>$letter3</em><font color=$color2> ($kleur2 lijn)</font></ul>
    !else
	somtekst$n=<br>Bereken de <em>co&ouml;rdinaten van de snijpunten</em> van<ul>\
	<li>parabool <em>$letter2</em></font>\
	<li>met de lijn <em>$letter3</em></font></ul>
    !endif
    G$n= de snijpunten zijn dus ($X1:$Y1) en ($X2:$Y2)
    nivo_title=Bepaal de co&ouml;rdinaten van de snijpunten tussen lijn en parabool
    !if $HINT=1
	hint=<div align="left"><font color=$fontcolor2>algemene hint<ul>\
	De co&ouml;rdinaten van de snijpunten van een parabool met een rechte lijn:\
	<br>\
	Stel we hebben de parabool <font color=$fontcolor1> <em>f(x)=x<sup><small>2</small></sup> + 2&bull;x</em></font><br>\
	Stel we hebben de rechte lijn <em>g(x)= 3</em><br>\
	voor de co&ouml;rdinaten van de snijpunten geldt dat: <em>f(x)=g(x)</em> ofwel<br>\
	x<sup><small>2</small></sup> + 2x = 3</em><br>\
	Dus:<font color=$fontcolor1> <em>x<sup><small>2</small></sup> + 2x = 3 &hArr;<em>x<sup><small>2</small></sup> + 2x - 3 = 0 -->\
	(x-1)(x+3)=0 --> x=1 en x=-3</em></font></em><br>\
	<em>x-co&ouml;rdinaten </em> zijn dus <em>x=1 en x=-3</em><br>\
	De bijhorende <em>y=co&ouml;rdinaten</em> zijn <em>y=3 en y=3</em>\
	De <em>co&ouml;rdinaten van de snijpunten</em> zijn dus (1:3) en (-3:3)<br>\
	was wel een gemakkelijk voorbeeldje he?</div>
    !endif	
!else
    !if $PLAATJE=1
	somtekst$n=<br>Determine the <em>co&ouml;rdinates of the intersection points </em> of<ul>\
	<li>parabola <em>$letter2</em><font color=$color1> ($color1 curve)</font>\
	<li>and the line <em>$letter3</em><font color=$color2> ($color2 line)</font></ul>
    !else
	somtekst$n=<br>Determine the <em>co&ouml;rdinates of the intersection points </em> of<ul>\
	<li>parabola <em>$letter2</em></font>\
	<li>and the line <em>$letter3</em></font></ul>
    !endif
    G$n=the points are ($X1:$Y1) and ($X2:$Y2)
    nivo_title=Determine the intersection points of line and parabola
    !if $HINT=1
	hint=no hints.
    !endif	
!endif
antwoord$n=$(somtekst$n) <br>$(G$n)
!if $PLAATJE=1
    XSIZE=300
    YSIZE=300
    knipperen=1
    aantal_beeldjes=2
    goedeplaatje$n=$XSIZE,$YSIZE\
    transparent white\
    xrange $Xmin,$Xmax\
    yrange $Ymin,$Ymax\
    linewidth 1\
    vline 0,0,blue\
    hline 0,0,blue\
    linewidth 2\
    curve $color1,$curve1\
    curve $color2,$curve2\
    linewidth s*14\
    $punten\
    text black,$[0.8*$Xmax],$[0.05*$Ymin],normal,$letter1-axis\
    textup black,$[0.1*$Xmin],$[0.8*$Ymax],normal,y-axis	
!endif


