# 2 talig : moet anders
n=$teller
inputsize=!charcnt $afrondingsfactor
!if $graad=0
    R=$teller
!else
    R=$graad
!endif        
!if $printbaar=0
    white=white
!else
    white=mangenta
!endif
keuze=!randitem 1,0
!if $R=1
    bewerking=bewerking4.proc
    #snijpunten met x-as:
    # ax^2-b=0 => ax^2=b => x=+/- sqrt(b/a)
    c=!randitem 1,2,3,4
    a=!randitem 1,2,3,4
    #b/a=c^2
    b=$[$a*$c*$c]
    !if $keuze=1
	f=$a*x^2 - $b
    !else
	f=$[-1*$a]*x^2 + $b
    !endif
    F=!htmlmath y = $f
    Xs1=$[-1*$c]
    Xs2=$c
    g=0
    XRANGE=$[-1*$c-4],$[$c+4]
    YRANGE=$[-10*(ceil($b/10))],$[10*(ceil($b/10))]
    GOED$n=$Xs1,0,$Xs2,0
    !if $taal=nl	
	nivo_title=Bepaal de snijpunten.
	antwoord$n=Het goede antwoord is dus:<br>de punten met co&ouml;rdinaten ($Xs1;0) en ($Xs2;0)
	somtekst$n=<p align="left">Gegeven de parabool <em>f</em>:<p align=center>$F</p> <br>Bepaal de snijpunten van parabool <em>f</em> en de <em>x</em>-as:<p>
    !else
	nivo_title=Determine the Intersection points.
	antwoord$n=The correct answer is:<br>the points with co&ouml;rdinates ($Xs1;0) and ($Xs2;0)
	somtekst$n=<p align="left">Given a parabola <em>f</em>:<p align=center>$F</p> <br>Determine the intersection points of <em>f</em> with the <em>x</em>-axis:<p>
    !endif	
    punt=points green,$(GOED$n)
    :goto plaatje
!endif

!if $R=2
    bewerking=bewerking4.proc
    #snijpunten met horizontale lijn:
    r=!randitem 1,2,3,4,5
    p=$[$r*$r]
    !if $keuze=1
	# ax^2-b=g
	# => ax^2=g+b 
	# => x^2=(g+b)/a
	# => x=+/- sqrt((g+b)/a)
	# (g+b)/a=r^2
	# g+b=ar^2 => g = ar^2-b = ap-b
	a=!randitem 1,2,3,4
	b=!randitem -5,-4,-3,-2,-1,1,2,3,4,5
	g=$[$a*$p-($b)]
	f=($a)*x^2 - ($b)
	YRANGE=-10,$[$g+10]
    !else
	# ax^2-b=g => ax^2=g+b => x=+/- sqrt((g-b)/a)
	#(b+g)/a=r^2
	#g-b=ar^2
	#b=g-ar^2
	a=!randitem -1,-2,-3,-4
	b=!randitem -5,-4,-3,-2,-1,1,2,3,4,5
	g=$[$a*$p-($b)]
	f=($a)*x^2 - ($b)
	YRANGE=$[$g-10],10
    !endif
    Xs1=$r
    Xs2=$[-1*$r]
    Ys1=$g
    Ys2=$g
    GOED$n=$Xs1,$Ys1,$Xs2,$Ys2
    F=!htmlmath y = $a*x^2 - $b
    G=!htmlmath y = $g
    XRANGE=$[-1*$r-4],$[$r+4]
    !if $taal=nl	
	nivo_title=Bepaal de snijpunten.
	antwoord$n=Het goede antwoord is dus: <br>de punten met  co&ouml;rdinaten ($Xs1;$Ys1) en ($Xs2;$Ys2)
	somtekst$n=<p align="left">Gegeven een parabool <em>f</em> en een lijn <em>g</em>:<p align="center"> $F <br>$G</p> .<br>Bepaal de snijpunten van parabool <em>f</em> en de lijn <em>y=$g</em>:<p>
    !else
	nivo_title=Determine the Intersection points.
	antwoord$n=The correct answer is: <br>the points with  co&ouml;rdinates ($Xs1;$Ys1) and ($Xs2;$Ys2)
	somtekst$n=<p align="left">Given a parabola <em>f</em> and a straight line <em>g</em>:<p align="center"> $F <br>$G</p> .<br>determine the intersection points of parabola <em>f</em> and the line <em>y=$g</em>:<p>
    !endif	
    punt=points green,$Xs1,$Ys1,$Xs2,$Ys2
    :goto plaatje
!endif


#ongelijkheden
!if $R=3
    bewerking=bewerking6.proc
    #snijpunten met x-as:
    Ys1=0
    Ys2=0
    g=0
    # ax^2-b=0 => ax^2=b => x=+/- sqrt(b/a)
    c=!randitem 1,2,3,4
    a=!randitem 1,2,3,4
    #b/a=c^2
    b=$[$a*$c*$c]
    Xs1=$[-1*$c]
    Xs2=$c
    ligging=!randitem 1,0
    !if $ligging=1
	boven=boven
	above=above
    !else
	boven=onder
	above=under
    !endif		
    !if $keuze=1
	f=$a*x^2 - $b
	!if $ligging=1
	    GOED$n=x<$Xs1&&x>$Xs2
	    goed$n=x &lt; $Xs1 &and; x &gt; $Xs2
	!else
	    GOED$n=$Xs1<x&&x<$Xs2
	    goed$n=$Xs1 &lt; x &lt; $Xs2
	!endif        
    !else
	f=$[-1*$a]*x^2 + $b
	!if $ligging=1
	    GOED$n=$Xs1<x&&x<$Xs2
	    goed$n=$Xs1 &lt; x &lt; $Xs2
	!else
	    GOED$n=x<$Xs1&&x>$Xs2
	    goed$n=x &lt; $Xs1 &and; x &gt; $Xs2
	!endif
    !endif
    F=!htmlmath y = $f
    XRANGE=$[-1*$c-4],$[$c+4]
    YRANGE=$[-10*(ceil($b/10))],$[10*(ceil($b/10))]
    !if $taal=nl	
	nivo_title=Los de ongelijkheid op.
	antwoord$n=Het goede antwoord is dus: <br>de snijpunten hebben  co&ouml;rdinaten ($Xs1;$Ys1) en ($Xs2;$Ys2)<br>\
	de grafiek van de parabool ligt $boven de x-as als geldt: $(goed$n) 
	somtekst$n=<p align="left">Gegeven de parabool:<p align=center>$F</p> <br>Bepaal voor welke <em>x</em>-waarden de grafiek van de parabool <em>$boven</em> de <em>x-as</em> ligt:<p>
    !else
	nivo_title=Solve the inequality.
	antwoord$n=the correct answer is: <br>the intersection points are ($Xs1;$Ys1) and ($Xs2;$Ys2)<br>\
	the graph of the parabola is $boven the x-axis if: $(goed$n) 
	somtekst$n=<p align="left">Given a parabola:<p align=center>$F</p> <br>Determine for which <em>x</em>-values the graph of the parabola lies <em>$boven</em> the <em>x-axis</em>:<p>
    !endif	
    punt=points green,$Xs1,$Ys1,$Xs2,$Ys2
    :goto plaatje
!endif

!if $R>3
    bewerking=bewerking6.proc
    r=!randitem 1,2,3,4,5
    p=$[$r*$r]
    !if $ligging=1
	boven=boven
	above=above
    !else
	boven=onder
	above=under
    !endif		
    !if $keuze=1
	# ax^2-b=g
	# => ax^2=g+b 
	# => x^2=(g+b)/a
	# => x=+/- sqrt((g+b)/a)
	# (g+b)/a=r^2
	# g+b=ar^2 => g = ar^2-b = ap-b
	a=!randitem 1,2,3,4
	b=!randitem -5,-4,-3,-2,-1,1,2,3,4,5
	g=$[$a*$p-($b)]
	Xs2=$r
        Xs1=$[-1*$r]
        Ys1=$g
        Ys2=$g
	f=$a*x^2 - $b
	YRANGE=-10,$[$g+10]
	!if $ligging=1
	    GOED$n=x<$Xs1&&x>$Xs2
	    goed$n=x &lt; $Xs1 &and; x &gt; $Xs2
	!else
	    GOED$n=$Xs1<x&&x<$Xs2
	    goed$n=$Xs1 &lt; x &lt; $Xs2
	!endif        
    !else
	# ax^2-b=g => ax^2=g+b => x=+/- sqrt((g-b)/a)
	#(b+g)/a=r^2
	#g-b=ar^2
	#b=g-ar^2
	a=!randitem -1,-2,-3,-4
	b=!randitem -5,-4,-3,-2,-1,1,2,3,4,5
	g=$[$a*$p-($b)]
	Xs2=$r
        Xs1=$[-1*$r]
        Ys1=$g
        Ys2=$g
	f=$a*x^2 - $b
	YRANGE=$[$g-10],10
	!if $ligging=1
	    GOED$n=$Xs1<x&&x<$Xs2
	    goed$n=$Xs1 &lt; x &lt; $Xs2
	!else
	    GOED$n=x<$Xs1&&x>$Xs2
	    goed$n=x &lt; $Xs1 &and; x &gt; $Xs2
	!endif
    !endif
    F=!htmlmath y = $a*x^2 - $b
    G=!htmlmath y = $g
    XRANGE=$[-1*$r-4],$[$r+4]
    YRANGE=$[(-1*(abs($g))) -10],$[(abs($g))+10]
    !if $taal=nl	
	F=!htmlmath y = $f
	G=!htmlmath y = $g
	nivo_title=Los de ongelijkheid op.
	antwoord$n=Het goede antwoord is dus: <br>de snijpunten hebben  co&ouml;rdinaten ($Xs1;$Ys1) en ($Xs2;$Ys2)<br>\
	de grafiek van de parabool ligt $boven de rechte groene lijn als geldt: $(goed$n) 
	somtekst$n=<p align="left">Gegeven een parabool en een horizontale lijn:<p align=center>$F<br>$G</p>\
	<br>Bepaal voor welke <em>x</em>-waarden de grafiek van de parabool <em>$boven</em> de groene <em>lijn</em> ligt:<p>
    !else
	nivo_title=Solve the inequality.
	antwoord$n=the correct answer is: <br>the intersection points are ($Xs1;$Ys1) and ($Xs2;$Ys2)<br>\
	the graph of the parabola <em>f</em> is $boven the green line if: $(goed$n) 
	somtekst$n=<p align="left">Given a parabola:<p align=center>$F</p> <br>Determine for which <em>x</em>-values the graph of the parabola lies <em>$boven</em> the green line:<p>
    !endif	
    punt=points green,$Xs1,$Ys1,$Xs2,$Ys2
    :goto plaatje
!endif

:plaatje
!if $PLAATJE=1 and $APPLET != 1
    XSIZE=300
    YSIZE=300
#    !readproc $authordir/ruitjespapier.proc
#    knipperen=1
#    aantal_beeldjes=2
#    $ruitjespapier\

    plaatje$n=300,300\
    transparent $white\
    xrange $XRANGE\
    yrange $YRANGE\
    text black,4,-1,normal,x-as\
    textup black,-0.5,4,normal,y-as\
    linewidth 1\
    vline 0,0,blue\
    hline 0,0,blue\
    linewidth 2\
    curve red,$f\
    hline 0,$g,green\
    linewidth s*14\
    $punt
!endif  
    
hint=$empty

 
  
!exit