n=$counter
image=0
cols=25
rows=3
math=1
questiontype=0
!if $level=0
    R=$counter
!else
    R=$level
!endif
#checkfile=$checkdir/simplify.proc
checkfile=exos/checkfile4.proc
arglist=$empty
letters=x,y,q,a,b,c,d,f,g,h,k,m,p,z
letters=!shuffle $letters
x=!item 1 of $letters
y=!item 2 of $letters
z=!item 3 of $letters
getallen=!shuffle 2,3,4,5,6
a=!item 1 of $getallen
b=!item 2 of $getallen
br=!randitem 1@2@1/2,1@3@1/3,2@3@2/3,1@4@1/4,1@5@1/5,2@5@2/5
g=!replace internal @ by , in $br
g1=!item 1 of $g
g2=!item 2 of $g
g3=!item 3 of $g
keuze=!randitem 1,2
pm=!randitem 1,-1
mp=!randitem 1,-1
question$n=!record 8 of lang/remarks.$taal
#@ herleid de volgende macht <br><font size=-1>dus schrijf anders</font>
# var1 is used for checking  "literal typing" of question
!if $R=1
!if $keuze=1
	b=$[$pm*$b]
	var1=$g3*$x^$a/$x^$b
	formula$n=\frac{\frac{$g1}{$g2} $x^{$a}}{$x^{$b}}
    !else
	a=$[-$pm*$a]
	var1=$x^$a/($g3*$x^$b)
	formula$n=\frac{  $x^{$a}}{\frac{$g1}{$g2}$x^{$b}}
    !endif
    tot=!exec pari $var1\
    printtex($var1)
    answer$n=!line 1 of $tot
    texanswer$n=!line 2 of $tot
    texanswer$n=\rightarrow $(texanswer$n)
    varlist=!varlist $(answer$n)
    wims_rawmath_variables=$varlist
 !exit
!endif

!if $R=2
    c=!randitem 2,3,4,5,6,7,8
    c=$[$mp*$c]
    !if $keuze=1
	var1=($c*$x^$a)/($g3*$x^$b)
	formula$n=\frac{$c \cdot $x^{$a}}{\frac{$g1}{$g2}\cdot $x^{$b}}
    !else
	c=$[$mp*$c]
	var1=($g3*$x^$a)/($c*$x^$b)
	formula$n=\frac{\frac{$g1}{$g2}\cdot $x^{$a}}{$c \cdot $x^{$b}}
    !endif
    tot=!exec pari $var1\
    printtex($var1)
    answer$n=!line 1 of $tot
    texanswer$n=!line 2 of $tot
    texanswer$n=\rightarrow $(texanswer$n)
    varlist=!varlist $(answer$n)
    wims_rawmath_variables=$varlist
 !exit
!endif


!if $R=3
    c=!randitem -4,-3,-2,2,3,4
    !if $keuze=1
	a=$[$pm*$a]
	var1=($c*$x)^$a/($g3*$x^$b)
	tot=!exec pari (($c*$x)^$a)/($g3*$x^$b)\
	printtex((($c*$x)^$a)/($g3*$x^$b))
	formula$n=\frac{\left($c \cdot $x \right)^{$a}}{\frac{$g1}{$g2} $x^{$b}}
    !else
	b=$[$pm*$b]
	var1=$g3*($c*$x)^$a/$x^$b
	tot=!exec pari ($g3*($c*$x)^$a)/($x^$b)\
	printtex(($g3*($c*$x)^$a)/($x^$b))
	formula$n=\frac{$g1}{$g2} \cdot \frac{\left($c \cdot $x \right)^{$a}}{$x^{$b}}
    !endif
    answer$n=!line 1 of $tot
    texanswer$n=!line 2 of $tot
    texanswer$n=\rightarrow $(texanswer$n)
    varlist=!varlist $(answer$n)
    wims_rawmath_variables=$varlist
 !exit
!endif

!if $R>3
    a=$[$pm*$a]
    b=$[$pm*$b]
    c=!randitem -4,-3,-2,2,3,4
    d=!randitem -4,-3,-2,2,3,4
    var1=($c*$x)^$a/($g3*$x)^$b 
    tot=!exec pari (($c*$x)^$a)/(($g3*$x)^$b)\
    printtex((($c*$x)^$a)/(($g3*$x)^$b))
    formula$n=\frac{\left($c\cdot $x\right)^{$a}}{\left(\frac{$g1}{$g2}\cdot $x\right)^{$b}}
    answer$n=!line 1 of $tot
    texanswer$n=!line 2 of $tot
    texanswer$n=\rightarrow $(texanswer$n)
    varlist=!varlist $(answer$n)
    wims_rawmath_variables=$varlist
 !exit
!endif
