# answer$n=2@vertikaal,-3@verticaal,0@horizontaal
checkfile=exos/checkfile1.proc
n=$counter
!if $level=0
    R=$counter
!else
    R=$level
!endif
mathviewpanel=$module_title :x=:y=:and:or:sqrt()
questiontype=0
plot=1
draw=0
math=0
question$n=!record 2 of lang/remarks.$taal
#@ Bepaal <b>alle</b> asymptoten van de onderstaande functie
ex1=!record 3 of lang/remarks.$taal
#@ Zie </a> voor de schrijfwijze de help pagina's
ex2=!record 24 of lang/remarks.$taal
helptext=<a onmouseover="this.T_WIDTH='100';this.T_HEIGHT='100';this.T_BORDERCOLOR='gold';this.T_BORDERWIDTH='1'; return escape('$ex2')">$ex1
#@ De vertikale asymptoot is: de lijn
vertikalen=!record 5 of lang/remarks.$taal
#@ De vertikale asymptoten zijn de lijnen

!if $teaching=1 and $image=0
    exotext=!record 6 of lang/remarks.$taal
    #@Hier</a> staat een klein grafiekje van de functie
    # exotext=<a href="javascript:showimage();">$exotext
    exotext=<a onmouseover="return escape('<img src=$wims_ref_name?&session=$session&module=$module&cmd=getins&special_parm=insert-1.gif>')"><font color=blue>$exotext</font>
!else
    exotext=$empty
!endif

prefix=size 0.6,0.6;nogrid ;noautoscale; xlabel "<x-axis>";ylabel"<y-axis>" ;border

!if $R=1
    a=!randitem -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,1,2,3,4,5,6,7,8,9,10
    b=!randitem 1,2,3,4,5,6,7,8,9,10    
    plotfunction=$a/(x-$b)
    formula$n=f(x)\,\,=\,\,\frac{$a}{\left(x - $b\right)}
    as1=$b
    !if $image=1
	ymin=-20
	ymax=20
	xrange=$[$b-10] : $[$b+10]
	yrange=$ymin : $ymax
	image_settings$n=$prefix ; arrow 1 from $as1,$ymin to $as1,$ymax nohead lt 4 
	image$n=[$xrange] [$yrange] $plotfunction notitle lt 1
    !else
	!if $teaching=1
	    ymin=-20
	    ymax=20
	    xrange=$[$b-10] : $[$b+10]
	    yrange=$ymin : $ymax
	    insplot_set=$prefix ; arrow 1 from $as1,$ymin to $as1,$ymax nohead lt 4 
	    !insplot [$xrange] [$yrange] $plotfunction notitle lt 1
	!endif
    !endif
    textanswer$n=$vertikaal x=$as1
    answer$n=$as1@vertikaal
    texanswer$n= x=$as1
 !exit
!endif
!if $R=2
    ##algemene vergelijking hyperbool:##f(x)=a/(x*(x-b)*(x-c))
    ##vertikaale asymptoot:x=b of x=c of x=0
    a=!randitem -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
    c=!randitem 2,3,4,5,6,7,8
    b=!randitem 2,3,4,5
    keuze=!randitem 1,0
    !if $keuze=1
	plotfunction=$a/($c*x + $b)
	formula$n=f(x)\,\,=\,\,\frac{$a}{\left( $c \cdot x + $b\right)}
	tot=!exec pari A=-1*$b/$c\
	printtex(A)
	as1=!line 1 of $tot
	tex_as1=!line 2 of $tot
    !else
	plotfunction=$a/(x - $b)
	formula$n=f(x)\,\,=\,\,\frac{$a}{\left( $c \cdot x - $b\right)}
	tot=!exec pari $b/$c\
	printtex(A)
	as1=!line 1 of $tot
	tex_as1=!line 2 of $tot
    !endif    
    answer$n=$as1@vertikaal
    texanswer$n= x\,\,=\,\,$tex_as1
    textanswer$n=$vertikaal x=$as1
    !if $image=1
    	ymin=-20
	ymax=20
	xrange=$[$b-10] : $[$b+10]
	yrange=$ymin : $ymax
	image_settings$n=$prefix ; arrow 1 from $as1,$ymin to $as1,$ymax nohead lt 4 
	image$n=[$xrange] [$yrange] $plotfunction notitle lt 1 
    !else
	!if $teaching=1
    	    ymin=-20
	    ymax=20
	    xrange=$[$b-10] : $[$b+10]
	    yrange=$ymin : $ymax
	    insplot_set=$prefix ; arrow 1 from $as1,$ymin to $as1,$ymax nohead lt 4 
	    !insplot [$xrange] [$yrange] $plotfunction notitle lt 1 
	!endif
    !endif
 !exit
!endif
!if $R>2
    ##algemene vergelijking hyperbool:##f(x)=a/(x*(x-b)*(x-c))
    ##vertikaale asymptoot:x=b of x=c of x=0
    a=!randitem -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
    b=!randitem 1,4,9,16,25,36,49,64

    !if $R=3
	plotfunction=$a/(-x^2 + $b)
	formula$n=f(x)\,\,=\,\,\frac{$a}{\left(-x^2 + $b\right)}
	as1=$[-1*sqrt($b)]
	as2=$[sqrt($b)]
	insplot_set=$prefix ; arrow 1 from $as1,$ymin to $as1,$ymax nohead lt 4  ; arrow 1 from $as2,$ymin to $as2,$ymax nohead lt 4  
    !else
	keuze=!randitem 1,2
	!if $keuze=1
    	    c=!randitem 1,2,3,4,5,6
    	    d=!randitem 1,2,3,4,5,6
    	    plotfunction=$a/((x - $c)*(x+$d))
	    formula$n=f(x)\,\,=\,\,\frac{$a}{\left(x - $c\right)\cdot\left(x + $d\right)}
    	    as2=$c
	    as1=$[-1*$d]
	    ymin=-20
	    ymax=20
	!else
	    ymin=-40
	    ymax=40
	    c=!randitem 1,2,3,4,5,6,-1,-2,-3,-4,-5,-6
	    d=!randitem 1,2,3,4,5,6,-1,-2,-3,-4,-5,-6
	    tot=!exec pari A=(x + ($c))*(x + ($d))\
	    printtex(A)
	    f=!line 1 of $tot
	    fl=!line 2 of $tot
	    plotfunction=$a/($f)
	    formula$n=f(x)\,\,=\,\,\frac{$a}{\left( $fl \right)}
	    !if $d>$c
		as1=$[-1*$c]
		as2=$[-1*$d]
	    !else
		as2=$[-1*$c]
		as1=$[-1*$d]
	    !endif
	!endif
    !endif
    answer$n=$as1@vertikaal,$as2@vertikaal
    texanswer$n= x=$as1 \wedge  x=$as2
    textanswer$n=$vertikalen x=$as1 &and; x=$as2
    !if $image=1
	xrange=$[$as1-20] : $[$as2+20]
	yrange=$ymin : $ymax
	image_settings$n=$prefix ; arrow $n from $as1,$ymin to $as1,$ymax nohead lt 4 ; arrow $n from $as2,$ymin to $as2,$ymax nohead lt 4 
	image$n=[$xrange] [$yrange] $plotfunction notitle lt 1 
    !else
	!if $teaching=1
	    xrange=$[$as1-20] : $[$as2+20]
	    yrange=$ymin : $ymax
	    insplot_set=$prefix ; arrow $n from $as1,$ymin to $as1,$ymax nohead lt 4 ; arrow $n from $as2,$ymin to $as2,$ymax nohead lt 4 
	    !insplot [$xrange] [$yrange] $plotfunction notitle lt 1 
	!endif
    !endif
!endif
