checkfile=exos/checkfile1.proc
mathviewpanel=$module_title :x=:y=:and:or:sqrt()
n=$counter
math=0
plot=1
draw=0
questiontype=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
vertikaal=!record 4 of lang/remarks.$taal
#@ 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;grid ; xlabel "<x-axis>";ylabel"<y-axis>" ;border
!if $level=0
    R=$counter
!else
    R=$level
!endif        

!if $R=1
    b=!randitem 1,2,3,4,5,6,7,8
    q=!randitem 1,2
    !if $q=1
	plotfunction=log(x-$b)
	formula$n=f(x)\,\,=\,\,\ln(x-$b)
    !else
	plotfunction=log($b-x)
	formula$n=f(x)\,\,=\,\,\ln($b-x)
    !endif
    as1=$b
    textanswer$n=$vertikaal x=$as1
    texanswer$n= x=$as1
    answer$n=$as1@vertikaal
    !if $image=1
	ymin=-10
	ymax=10    
	xrange=$[$as1-10]:$[$as1+10]
        yrange=$ymin:$ymax
	image_settings$n=$prefix ; arrow $n from $as1,$ymin to $as1,$ymax nohead lt 4 
	image$n=[$xrange] [$yrange] $plotfunction notitle lt 1
    !else
	!if $teaching=1
	    ymin=-10
	    ymax=10    
	    xrange=$[$as1-10]:$[$as1+10]
    	    yrange=$ymin:$ymax
    	    insplot_set=$prefix ; arrow $n 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))
    ##verticale asymptoot:x=b of x=c of x=0
    a=!randitem -5,-4,-3,-2,-1,2,3,4,5,0.5,0.75,0.25,-0.5,-0.75,-0.25,-1.5
    b=!randitem 1,2,3,4,5,6,7,8,9
    c=!randitem -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,1,2,3,4,5,6,7,8,9,10
    pm =!randitem +,-
    plotfunction=$a*log($c*x $pm $b)
    formula$n=f(x)\,\,=\,\,$a\cdot\ln($c\cdot x $pm $b)
    !if $pm=+
	as1=!exec pari -1*$b/($c)
    !else
	as1=!exec pari $b/($c)
    !endif
    textanswer$n=$vertikaal x=$as1
    texanswer$n= x=$as1
    answer$n=$as1@verticaal
    !if $image=1
	ymin=-50
	ymax=50
	xrange=$[$as1-10]:$[$as1+10]
	yrange=$ymin:$ymax
	image_settings$n=$prefix ; arrow $n from $as1,$ymin to $as1,$ymax nohead lt 4 
	image$n=[$xrange] [$yrange] $plotfunction notitle lt 1     
    !else
	!if $teaching=1
	    ymin=-50
	    ymax=50
	    xrange=$[$as1-10]:$[$as1+10]
	    yrange=$ymin:$ymax
	    insplot_set=$prefix ; arrow $n from $as1,$ymin to $as1,$ymax nohead lt 4 
	    !insplot [$xrange] [$yrange] $plotfunction notitle lt 1     
	!endif
    !endif
 !exit
!endif

!if $R>2
keuze=2
    keuze=!randitem 1,2
    !if $keuze=1
	a=!randitem -5,-4,-3,-2,-1.5,-1,-0.5,0.5,1.5,2,3,4,5
        b=!randitem 1,2,3,4,5,6,7,8
	K=!randitem 1,-1    
	!if $K=1
	    pm=+
	    c=!randitem -10,-9,-8,-7,-6,-5,-4,-3,-2
	    xrange=-2:2
	!else
	    pm=-
	    c=!randitem 2,3,4,5,6,7,8,9,10
	    xrange=-10:10	
	!endif
	ss=!exec pari -1*($K*$b)/$c
	plotfunction=$a*log($c*x^2 $pm $b)
	formula$n=f(x)\,\,=\,\,$a\cdot \ln( $c \cdot x^{2} $pm $b)
	!if ss=1
	    as1=1
	    as2=-1
	!else
	    !if . isin $[sqrt($ss)]
		as1=sqrt($ss)
		as2=-1*sqrt($ss)
	    !else
		as1=$[sqrt($ss)]
		as2=$[-1*sqrt($ss)]
	    !endif
	!endif
	answer$n=$as1@vertikaal,$as2@vertikaal
	texanswer$n=x=$as1 \wedge  x=$as2
	texanser$n=!replace internal sqrt by \sqrt in $(texanswer$n)
	textanswer$n=$vertikalen x=$as1 &and; x=$as2
	!if $image=1
	    ymin=-20
	    ymax=20
    	    yrange=$ymin:$ymax
	    image_settings$n=$prefix ; arrow 1 from $as1,$ymin to $as1,$ymax nohead lt 4 ; arrow 2 from $as2,$ymin to $as2,$ymax nohead lt 4 
    	    image$n=[$xrange] [$yrange] $plotfunction notitle lt 1     
        !else
	    !if $teaching=1
		ymin=-20
		ymax=20
    		yrange=$ymin:$ymax
		insplot_set=$prefix ; arrow 1 from $as1,$ymin to $as1,$ymax nohead lt 4 ; arrow 2 from $as2,$ymin to $as2,$ymax nohead lt 4 
    		!insplot [$xrange] [$yrange] $plotfunction notitle lt 1     
    	    !endif
	!endif
    !else
	##algemene vergelijking hyperbool:##f(x)=a/(x*(x-b)*(x-c))
	##verticale asymptoot:x=b of x=c of x=0
        a=!randitem -15,-4,-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,2,3,4,5,6
        c=!randitem 1,2,3,4,5,6
	g=!randitem 0.5,1.5,2,2.5,3,4,5,6
	f=!exec pari (x+$b)*(x-$c)
	F=!texmath $f 
	plotfunction=$g^(1/($f))
	mytexsize=+3
	formula$n=\left[ \begin{array}{l} f(x)\,\,=\,\,$g^{\frac{1}{n} \\ \\  \,\,n\,=\,$F \end{array}

        as1=$[-1*$b]
        as2=$c
	answer$n=$as1@vertikaal,$as2@vertikaal
	texanswer$n= x=$as1 \wedge  x=$as2
	textanswer$n=$vertikalen x=$as1 $and x=$as2
	!if $image=1
	    ymin=-5
	    ymax=20	
    	    xrange=-10:10
    	    yrange=$ymin:$ymax
	    image_settings$n=$prefix ; arrow 1 from $as1,$ymin to $as1,$ymax nohead lt 4 ; arrow 2 from $as2,$ymin to $as2,$ymax nohead lt 4 
    	    image$n=[$xrange] [$yrange] $plotfunction notitle lt 1     
        !else
	    !if $teaching=1
		ymin=-5
		ymax=20	
    		xrange=-10:10
    		yrange=$ymin:$ymax
		insplot_set=$prefix ; arrow 1 from $as1,$ymin to $as1,$ymax nohead lt 4 ; arrow 2 from $as2,$ymin to $as2,$ymax nohead lt 4 
    		!insplot [$xrange] [$yrange] $plotfunction notitle lt 1     
    	    !endif
	!endif
    !endif
 !exit
!endif
