R=$graad
!if $negatief=0
    !if $taal=nl
	nivo_title=Rekenregels over Machtsverheffen en andere bewerkingen .<br>Alleen met positieve getallen.
	hint=Zie de Help-pagina.
    !else
	nivo_title=Priority rules on Calculating: powers. <br>Only positive numbers.
	hint=Look into the help-pages.
    !endif
!else
    !if $taal=nl
	nivo_title=Rekenregels over Machtsverheffen en andere bewerkingen<br>nu ook met negatieve getallen
	hint=Zie de Help-pagina.
    !else
	nivo_title=Priority rules on Calculating: powers<br>also with negative numbers
	hint=Look into the help-pages.
    !endif
!endif

pm=+
mp=+

!for n=1 to $aantal_sommen
    !if $graad=0
	R=$n
    !endif	
    !if $negatief=1
	pm=!randitem +,-,-
	mp=!randitem +,-
    !endif

    a=!randitem 2,3,4,5,6,7,8,9,10
    b=!randitem 2,3,4,5
    c=!randitem 2,3,4,5,6
    d=!randitem 2,3,4,5,6
    e=!randitem 2,3,4
    f=!randitem 2,3
	
    !if $R=1
	!if $c=$d
	    c=$[$c+1]
	!endif
	somtekst$n=$e \cdot \left( $d\cdot $a^{$b} $pm  $c\cdot $a^{$b} \right) \,\,\,\,=    	
	GOED$n=$[$e*($d $pm  $c)*$a^$b]
	extra$n=$e \cdot\left( $[$d $pm $c]\cdot $a^{$b}\right) \,\,\,\,=
    !endif
    !if $R=2
	somtekst$n=\frac{$[$e*$d]\cdot $a^{$[$b+$c]}}{$d\cdot $a^{$c}} \,\,\,\,=    	
	GOED$n=$[$e*$a^$b]
	extra$n=\frac{$[$e*$d]\cdot $[$a^($b+$c)]}{$d\cdot $[$a^$c]} \,\,\,\,=
    !endif        	
    !if $R=3
	somtekst$n=\left($a  $pm $b \right)^{$c} \,\,\,\,=
	GOED$n=$[($a $pm $b)^$c]
	extra$n=$[$a $pm $b]^{$c} \,\,\,=
    !endif
    !if $R=4
	somtekst$n=\left($a $pm $b^{$f}\right)^{$e} \,\,\,\,=
	GOED$n=$[($a $pm $b^$f)^$e]
	extra$n=\left( $a $pm $[$b^$f]\right)^{$e} \,\,\,=\left( $[$a $pm $b^$f]\right)^{$e} \,\,\,=
    !endif
    !if $R>4
	somtekst$n=$c $pm $a \div $e^{$f} \cdot $[$e*$f] \,\,\,\,=
	GOED$n=!exec pari $c $pm $a/($e^$f)*$e*$f
	extra$n=$c $pm \frac{$a}{$e^{$f}}\cdot $[$e*$f] \,\,\,=$c $pm \frac{$a \cdot $[$e*$f]}{$e^{$f}} \,\,\,=
    !endif
!next n

