n=$teller
!if $graad=0
    R=$teller
!else
    R=$graad
!endif        
!if $printbaar=0
    white=white
!else 
    white=magenta
!endif
bewerking=bewerking1.proc 
l=<font size="+1" color=green><em>l</em></font>
h=<font size="+1" color=red><em>h</em></font>
keuze=!randitem onder,boven
!if $taal=nl
    nivo_title=Bepaal de snijpunten tussen hyperbool en rechte lijn<br>en los de ongelijkheid op. 
    boven=de hyperbool $h boven de lijn $l ligt.
    onder=de hyperbool $h onder de lijn $l ligt.
    x_as=x-as
    y_as=y-as
    of=of
    intersection_points=de snijpunten zijn
    intersection_point=het snijpunt is
    !if $HINT=1
	hint=<p align="left">Algemene Hint:<br>
    !endif
!else
    nivo_title=Determine the intersection points of hyperbola & line<br>and solve the inequality.
    boven=the hyperbola $h is above the line $l 
    onder=the hyperbola $h is under the line $l 
    x_as=x-axis
    y_as=y-axis
    of=or
    intersection_points=the intersection points are
    intersection_point=the intersection point is
    !if $HINT=1
	hint=no hints
    !endif	
!endif
!if $R=1
    a=!randitem -5,-4,-3,-2,-1,1,2,3,4,5
    b=!randitem 1,2,3,4,5,6,7,-1,-2,-3,-4,-5,-6,-7
    c=!randitem -7,-6,-5,-4,-3,-2,-1,1,2,3,4,5,6,7
    h1=!rawmath $a/(x + ($b))
    H1=!texmath $h1
    L1=$c
    l1=$c
    Y=$c
    
    X=!exec pari ($a + (-1*($b)*($c)))/($c)
    asymptoot=$[-1*$b]
    !if $afrondingsfactor!=0    
	x=$[(round($afrondingsfactor*$X))/$afrondingsfactor]
        y=$[(round($afrondingsfactor*$Y))/$afrondingsfactor]
    !else
	x=$X
	y=$Y
    !endif
    GOED$n=$X,$Y
    snijpunt= $intersection_point ($X:$Y)
     !if $c>0
        !if $a>0
	    !if $keuze=boven
		ligging=$boven
		goed$n=$asymptoot<x&&x<$x
		GG=$asymptoot<x<$x
		ongelijkheid=$asymptoot &lt;x &lt;$x
		latextekst=h > l
	    !else
		ligging=$onder
    		goed$n=x<$asymptoot&&x>$x
    		GG=x<$asymptoot of x>$x	
		ongelijkheid=x&lt;$asymptoot $of x&gt;$x 
		latextekst=h < l
	    !endif
	!else
	    !if $keuze=boven
		ligging=$boven
		goed$n=$x<x&&x<$asymptoot
		GG=$x<x of x<$asymptoot
		ongelijkheid=$x &lt; x &lt; $asymptoot
		latextekst=h > l
	    !else
		ligging=$onder
    		goed$n=x<$x&&x>$asymptoot
    		GG=x<$x of x>$asymptoot
		ongelijkheid=x &lt; $x $of x &gt; $asymptoot 
		latextekst=h < l
	    !endif
	!endif
    !else
    #lijn onder $x_as
        !if $a>0
	    !if $keuze=boven
		ligging=$boven
		goed$n=x<$x&&x>$asymptoot
		GG=x<$x of x>$asymptoot
		ongelijkheid=x &lt; $X $of x &gt; $asymptoot
		latextekst=h > l
	    !else
		ligging=$onder
    		goed$n=$x<x&&x<$asymptoot
    		GG=$x<x of x<$asymptoot
		ongelijkheid=$X &lt; x &lt; $asymptoot 
		latextekst=h < l
	    !endif
	!else
	    !if $keuze=boven
		ligging=$boven
		goed$n=x<$asymptoot&&x>$x
		GG=x<$asymptoot of x>$x
		ongelijkheid=x &lt; $asymptoot $of x &gt;$x
		latextekst=h > l
	    !else
		ligging=$onder
    		goed$n=$asymptoot<x&&x<$x
    		GG=$asymptoot<x $of x<$x
		ongelijkheid=$asymptoot &lt; x &lt; $x
		latextekst=h < l
	    !endif
	!endif
    !endif

    !if $PLAATJE=1
	XRANGE=-10,10
	YRANGE=-10,10
	transparent=$white
	GRAFIEK=linewidth 2\
	curve red,$h1\
	curve green,$l1\
	dvline $asymptoot,0,yellow\
	linewidth s*14\
	point $X,$Y,yellow\
	text black,7,-0.5,normal,$x_as\
	textup black,-0.5,15,normal,$y_as
    !endif
!goto KLAAR
!endif

!if $R>1
    afrondingsfactor=100
    !readproc $authordir/afronding.$taal
    #geen exacte oplossing vragen
    a=!randitem 1,2,3,4,5
    b=!randitem 1,2,3,4,5
    q=!randitem 1,2,3,4,5
    m=!randitem 1/2,1/4,1/5,2/3,4/5,3/2,4/3,7/3,-1/2,-1/4,-1/5,-2/3,-4/5,-3/2,-4/3,-7/3
    !if $m<0
	a=$[-1*$a]
    !endif	
    A=$m
    B=$[$q+$b*$m]
    C=$[$b*$q-$a]
    h1=!rawmath $a/(x + ($b))
    H1=!texmath $h1
    L1=!exec pari printtex($m*x+$q)
    l1=$m*x+$q
    Y=
    D=$[sqrt($B*$B - 4*$A*$C)]
    
    X1=$[(-1*$B + $D)/(2*$A)]
    X3=$[(-1*$B - $D)/(2*$A)]
    Y1=$[$m*($X1) +$q]
    Y3=$[$m*($X3) +$q]
    !ifval $X1 > $X3
	X2=$X1
	Y2=$Y1
	X1=$X3
	Y1=$Y3
    !else
	X2=$X3
	Y2=$Y3
    !endif
    asymptoot=$[-1*$b]
    !if $afrondingsfactor!=0    
	x1=$[(round($afrondingsfactor*$X1))/$afrondingsfactor]
	x2=$[(round($afrondingsfactor*$X2))/$afrondingsfactor]
        y1=$[(round($afrondingsfactor*$Y1))/$afrondingsfactor]
        y2=$[(round($afrondingsfactor*$Y2))/$afrondingsfactor]
    !else
	x1=$X1
	x2=$X2
	y1=$Y1
	y2=$Y2
    !endif
    snijpunt=$intersection_points  ($x1:$y1) $en ($x2:$y2)
        !if $a>0
	    !if $keuze=boven
		ligging=$boven
		goed$n=x<$x1&&$asymptoot<x&&x<$x2
		GG=x<$x1 en $asymptoot<x<$x2
		ongelijkheid=x&lt;$x1 of $asymptoot &lt; x &lt; $x2
		latextekst=h > l
	    !else
		ligging=$onder
    		goed$n=$x1<x&&x<$asymptoot&&$x2<x
    		GG=$x1<x en x<$asymptoot of $x2<x
		ongelijkheid=$x1 &lt; x &lt; $asymptoot of x &gt; $x2
		latextekst=h < l
	    !endif
	!else
	    !if $keuze=boven
		ligging=$boven
		goed$n=$x1<x&&x<$asymptoot&&x>$x2
		GG=$x1<x<$asymptoot  of x>$x2
		ongelijkheid=$x1 &lt; x &lt; $asymptoot of x &gt; $x2
		latextekst=h > l
	    !else
		ligging=$onder
    		goed$n=x<$x1&&$asymptoot<x&&x<$x2
		GG=x<$x1 of $asymptoot<x<$x2
		ongelijkheid=x &lt; $x1 of $asymptoot &lt; x &lt; $x2  
		latextekst=h < l
	    !endif
	!endif

    GOED$n=$X1,$Y1,$X2,$Y2
    !if $PLAATJE=1
	XRANGE=-10,10
	YRANGE=-10,10
	transparent=$white
	GRAFIEK=linewidth 2\
	curve red,$h1\
	curve green,$l1\
	dvline $asymptoot,0,yellow\
	linewidth s*14\
	points  yellow,$X1,$Y1,$X2,$Y2\
	text black,7,-0.5,normal,$x_as\
	textup black,-0.5,15,normal,$y_as
    !endif 
!endif

:KLAAR
opgave$n=$latextekst\rightarrow \left\{\begin{array}{c}l(x)=$L1\\\\h(x)=$H1\end{array}
!if $taal=nl
    somtekst$n=Gegeven de rechte lijn $l en hyperbool $h  <br>\
    <ul>\
    <li>Bepaal de co&ouml;rdinaten van de snijpunten tussen $l en $h </li>\
    <li>Geef aan voor welke <em>x</em>-waarden de grafiek van $ligging  .</li>\
    <li>$AFRONDING</li></ul>
    antwoord$n=<p align="left">Het goede antwoord is dus: <ul><li>$snijpunt</li>\
    <li>En waar de grafiek van  $ligging  geldt:<br> $ongelijkheid</li></ul></p> 
!else

    somtekst$n=Given the line $l and hyperbola $h  <br>\
    <ul>\
    <li>Determine the co&ouml;rdinates of the intersection points of $l and $h </li>\
    <li>And for which <em>x</em>-values the graph of $ligging .</li>\
    <li>$AFRONDING</li></ul>
    antwoord$n=<p align="left">The correct answers are: <ul><li>$snijpunt</li>\
    <li> $ligging  when : $ongelijkheid</li></ul></p> 
!endif
!if $PLAATJE=1
    XSIZE=240
    YSIZE=240
    knipperen=1
    aantal_beeldjes=2

    plaatje$n=320,400\
    transparent $transparent\
    xrange $XRANGE\
    yrange $YRANGE\
    linewidth 1\
    vline 0,0,blue\
    hline 0,0,blue\
    $GRAFIEK
!endif  
    

 