bewerking=bewerking2.proc
n=$teller
!if $graad=0
    R=$teller
!else
    R=$graad
!endif
    
letters=f,g,h,k,m,p,w
letter=!shuffle $letters 
f=!item 1 of $letter
g=!item 2 of $letter

kleur=red@green@rode@groene,\
blue@green@blauwe@groene,\
orange@green@oranje@groene,\
orange@blue@oranje@blauwe,\
red@blue@rooie@blauwe,\
blue@red@blauwe@rode,\
red@green@rode@groene,\
blue@green@blauwe@groene,\
red@orange@rode@oranje,\
orange@blue@oranje@blauwe,\
red@black@rooie@zwarte,\
orange@blue@oranje@blauwe,\
black@orange@zwarte@oranje,\
black@red@zwarte@rooie

kleur=!randitem $kleur
kleur=!replace internal @ by , in $kleur
kleur1$n=!item 1 of $kleur
kleur2$n=!item 2 of $kleur
KLEUR1$n=!item 3 of $kleur
KLEUR2$n=!item 4 of $kleur
keuze=!randitem 1,2
pm=!randitem +,-


!if $R=1    
    a=!randint 2,5
    b=!randint 2,5
    c=!randitem 3/2,5/3,7/4,7/5,5/3,5/2,2,3,4,5,9/5,9/4
    d=!randitem -3/4,-4/5,-5/8,-3/5,-2/5,-5/6,-1/5,-5/4,-2/3,-1/2,1/2,2/3,5/4,3/4,4/5,5/8,7/5,2/5,5/6,6/5

    functies=sin($d*x)@$a*sin($d*x),\
    cos($d*x)@$c*cos($d*x),\
    cos(x)@cos($d+x),\
    $a*sin(x+$b)@sin($a*x-$b),\
    $a $pm sin(x-$b)@sin(x $pm $a),\
    $a $pm sin($d*x+$c)@sin($d*x $pm $a),\
    $c*sin($d+x)@$c*sin(x-$a),\
    $c*cos($a*x)@$d*cos($a+x),\
    $d*cos($a*x)@$a $pm $c*cos(x*$a),\
    $c*cos(x $pm $a)@cos($a*x + $b),\
    $a $pm cos($a-x)@cos(x $pm $a)
!endif
!if $R=2
    a=!randitem -5,-4,-3,-2,2,3,4,5
    b=!randint 2,5
    c=!randitem 3/2,5/3,7/4,7/5,5/3,5/2,2,3,4,5,9/5,9/4
    k=!randitem 1,3/2,2,5/2,3,7/2,4,9/2,7/4,5/4
    d=!randitem -5/2,-4/5,-3/2,-2,-1,1,2,3,4,5

    functies= $a*sin($d*x)@$a*sin($d*x$pm$k),$a*cos($d*x)@$a*cos($d*x$pm$k),\
    $a*sin(x$pm$b)@$a*sin(x$pm$k),$a*cos(x)@$a*cos(x$pm$k)
!endif
!if $R>2
    a=!randitem -5,-9/2,-4,-7/2,-3,-5/2,-2,-3/2,3/2,2,5/2,3,7/2,4,9/2,5
    b=!randint 2,5
    c=!randitem 3/2,5/3,7/4,7/5,5/3,5/2,2,3,4,5,9/5,9/4
    d=!randitem -3/4,-4/5,-3/5,-2/5,-5/6,-1/5,-5/4,-2/3,-1/2,1/2,2/3,5/4,3/4,4/5,2/5,5/6,6/5
    e=!randitem -2,-3/2,-3/4,-3/5,-2/5,-1/5,-5/4,-2/3,-1/2,1/2,2/3,5/4,3/4,4/5,2/5,6/5,3/2,2
    
    functies=sin(($d)*x)@($a)*sin(($d)*x$pm$b),($a)*cos(($d)*x)@($a)*cos(($d)*x$pm$b),\
    ($b)*cos(($a)*x)@($a)*cos(($a)*x$pm$b),($c)*cos(($d)*x)@($a)*cos(($d)*x$pm$b),\
    ($a)*sin(($a)*x)@($a)*sin(x$pm$b),($c)*sin(($d)*x)@($a)*sin(($d)*x$pm$b),\
    $b*sin(($d)*x)@($e)*sin(($a)*x$pm$c),$b*sin(($d)*x)@($e)*sin(($a)*x$pm$c)
!endif

functie=!randitem  $functies
functies=!replace internal @ by , in $functie
!if $keuze=1
    functie1$n=!item 1 of $functies
    functie2$n=!item 2 of $functies
!else
    functie1$n=!item 2 of $functies
    functie2$n=!item 1 of $functies
!endif
    
GOED$n=$(functie1$n)
GOED2$n=$(functie2$n)

F1$n=!texmath $f(x)=$(GOED$n)
F2$n=!texmath $g(x)=$(GOED2$n)


!readproc nivo/plaatje2.proc
