bewerking=bewerking2.proc
n=$teller
!if $taal=nl
    nivo_title=Bepaal de asymptoten.
    vertikaal=De verticale asymptoot is: de lijn
    vertikalen=De verticale asymptoten zijn de lijnen
    en=en  
    hint=<small>de term <b>ln<em>(x)</em></b> betekend de natuurlijke logaritme</br>\
    dus met het grondgetal <em>e</em><br></small>\
    <b>ln<em>(x)</em></b> =  <em><sup>e</sup><b></em>log<em>(x)</em></b>
!else
    nivo_title=Determine the asymptotes.
    vertikaal=The vertical asymptote is the line 
    vertikalen=The vertical asymptotes are the lines  
    en=and
!endif
!if $graad=0
    R=$teller
!else
    R=$graad
!endif        
asymplijn=$empty

!if $R=1
    b=!randitem 1,2,3,4,5,6,7,8
    q=!randitem 1,2
    !if $q=1
	f$n=log(x-$b)
	F$n=\ln(x-$b)
    !else
	f$n=log($b-x)
	F$n=\ln($b-x)
    !endif
    GOED1$n=$b
    AS1=$b
    goed$n=$vertikaal x=$b
    aantal_Vasymptoten=1
    aantal_Hasymptoten=0
    
    XRANGE=$[$b-10],$[$b+10]
    YRANGE=-10,10
    XSCHAAL=2
    YSCHAAL=2
    asymplijn=dvline $AS1,0,green

    !readproc nivo/plaatje.proc
    !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
    c=!randitem -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,1,2,3,4,5,6,7,8,9,10
    pm =!randitem +,-
    f$n=$a*log($c*x $pm $b)
    F$n=$a\cdot\ln($c\cdot x $pm $b)
    !if $pm=+
	GOED1$n=!exec pari -1*$b/$c
	AS1=$[-1*$b/$c]
    !else
	GOED1$n=!exec pari $b/$c
	AS1=$[$b/$c]
    !endif
    goed$n=$vertikaal x=$(GOED1$n)
    aantal_Vasymptoten=1
    aantal_Hasymptoten=0
    XRANGE=$[$AS1-5],$[$AS1+5]
    YRANGE=-50,50
    XSCHAAL=1
    YSCHAAL=10
    asymplijn=dvline $AS1,0,green

    !readproc nivo/plaatje.proc
    !exit
!endif

!if $R=3
    wims_compare_precision=1000
    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
    Q=!exec pari -1*($K*$b)/$c
    f$n=$a*log($c*x^2 $pm $b)
    F$n=$a\cdot \ln( $c \cdot x^{2} $pm $b)
    !if Q=1
	AS1=1
	AS2=-1
    !else
	!if . isin $[sqrt($Q)]
	    AS1=sqrt($Q)
	    AS2=-1*sqrt($Q)
	!else
	    AS1=$[sqrt($Q)]
	    AS2=$[-1*sqrt($Q)]
	!endif
    !endif
    GOED1$n=$AS1,$AS2
    goed$n=$vertikalen x=$AS1 $en x=$AS2
    aantal_Vasymptoten=2
    aantal_Hasymptoten=0
    YRANGE=-20,20
    XSCHAAL=1
    YSCHAAL=4
    asymplijn=dvline $AS1,0,green\
    dvline $AS2,0,green

    !readproc nivo/plaatje.proc
    !exit
!endif

!if $R>3
    ##algemene vergelijking hyperbool:##f(x)=a/(x*(x-b)*(x-c))
    ##verticale asymptoot:x=b of x=c of x=0
    keuze=!randitem 1,2,2
    !if $keuze=1
        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 
	f$n=$g^(1/($f))
	F$n=$g^n \,\,met\,\,  n=\frac{1}{$F}  

        AS1=$[-1*$b]
        AS2=$c
	GOED1$n=$AS1,$AS2
	goed$n=$vertikalen x=$AS1 $and x=$AS2
	aantal_Vasymptoten=2
        XRANGE=-10,10	
        YRANGE=-5,20
        XSCHAAL=5
        YSCHAAL=5
	asymplijn=dvline $AS1,0,green\
	dvline $AS2,0,green
    !else
        wims_rawmath_variables=k,x,pi,K,X,PI
	b=!randitem 1,2,3,4,5,6
	c=!randitem 0.5,1,2,3
	f$n=$b/(sin($c*x))
	F$n=\frac{$b}{\sin($c\cdot x)}
	GOED1$n=k*pi/$c
	X1=-6
	X2=6
	!for p=$X1 to $X2 
	    W=$p*pi/$c 
	    AS=dvline $W,0,green
    	    asymplijn=!append line $AS to $asymplijn 
	!next
	AS1=0
	AS2=1/$c*pi
        AS3=2/$c*pi
	AS4=-1/$c*pi
	GOED1$n=!nospace $(GOED1$n)
        goed$n=$vertikalen <br>x=k*pi/$c
	!if $taal=nl
	    hint=<small>Noteer je antwoord in de vorm </small><b><em>x=3*k*pi/4</em></b><small> of zo iets</small>
	!else
	    hint=<small>Write your answer in the form <b><em>x=3*k*pi/4</em></b><small> or something like that</small>
	!endif
	aantal_Vasymptoten=1
	XRANGE=$X1,$X2
	YRANGE=-20,20
	XSCHAAL=1
	YSCHAAL=5
    !endif

    !readproc nivo/plaatje.proc
    !exit
!endif
