n=$teller
punten=!randitem 3,4,5
bewerking=bewerking6.proc
nivo_title=Vul een tabel in aan de hand van een formule
soort=!randitem 1,2
!if $soort=2
    U=Y,EINDWAARDE,EINDWAARDE,UITWAARDE,UIT,UITKOMST,UITVOER,RESULTAAT,OUTPUT,YWAARDE
    G=X,STARTWAARDE,BEGINWAARDE,INWAARDE,IN,BEGINWAARDE,INVOER,INPUT,INPUT,XWAARDE
    getal=!randitem 1,2,3,4,5,6,7,8,9
    stap=!randitem 1,2,3,4,5
    argument=!item $getal of $U
    varlist=!item $getal of $G
    !if $negatief=1
        a=!randitem 1,2,3,4,5,6
        b=!randitem 2,3,1/5,1/4,1/3,1/2,2/3,3/4,4/5,6/5,3/2,5/3,7/4,-2,-3,-1/5,-1/4,-1/3,-1/2,-2/3,-3/4,-4/5,-6/5,-3/2,-5/3,-7/4
	functie$n=$b*x - $a
        functie$n=!rawmath $(functie$n)
        XRANGE=-8:8
        YRANGE=-30:30
	tics=xtics -8,1,8;ytics -30,5,30
        r=!randitem 1,2,4,5,6,8
        q=!randitem 4,6,8,10,12,14,16
        !for p=1 to $punten	
    	    z=$[$r*($p-$q)]
    	    X$p=$z
	    Y$p=!evalsubst x=$(X$p) in $(functie$n)
	    GG=!append line <li> ($(X$p):$(Y$p))</li> to $GG
	!next p
    !else
        a=!randitem 1,2,3,4,5,6
        b=!randitem 2,3,4,1/2,1/4,3/4,5/4
	functie$n=$b*x + $a
        functie$n=!rawmath $(functie$n)
        XRANGE=-2:20
        YRANGE=-2:40
	tics=xtics 0,2,20;ytics 0,5,40
        !for p=1 to $punten
	    X$p=$[$p*$stap]
	    Y$p=!evalsubst x=$(X$p) in $(functie$n)
	    GG=!append line <li> ($(X$p):$(Y$p))</li> to $GG
	!next p
    !endif
!endif
!if $soort=1
    U=kosten,afstand,hoogte,h,hoogte,uitkomst
    G=tijd,tijd,t,t,tijd,getal
    getal=!randitem 1,2,3,4,5,6
    stap=!randitem 1,2,3
    argument=!item $getal of $U
    varlist=!item $getal of $G
    !if $negatief=1
        a=!randitem 1,2,3,4,5,6
        b=!randitem -2,2,3,-3,4,-4,5,-5,6,-6
	functie$n=$b*x - $a
        functie$n=!rawmath $(functie$n)
        XRANGE=-8:8
        YRANGE=-30:30
	tics=xtics -8,1,8;ytics -30,5,30
        r=!randitem 2,3,4,5,6
        q=!randitem 4,6,8,10
        !for p=1 to $punten
	    z=$[$r*($p-$q)]
	    X$p=$z
	    Y$p=!evalsubst x=$(X$p) in $(functie$n)
	    GG=!append line <li>($(X$p):$(Y$p))</li> to $GG
	!next p
    !else
        a=!randitem 1,2,3,4,5
        b=!randitem 2,3,4,1/2,1/4,3/4,5/4
	functie$n=$b*x + $a
        functie$n=!randitem $(functie$n)
        XRANGE=-2:20
        YRANGE=-2:40
	tics=xtics 0,2,20;ytics 0,5,40
        r=0
	!for p=1 to $punten
    	    X$p=$[$p*$stap]
	    Y$p=!evalsubst x=$(X$p) in $(functie$n)
	    GG=!append line <li> ($(X$p):$(Y$p))</li> to $GG
	!next p
    !endif
!endif

#ins_attr=ismap
insplot_set=border ; zeroaxis linetype 3 ; tmargin 1 ; rmargin 1 ; grid ; xlabel "$varlist" ; ylabel "$argument" ; $tics
plotsettings$n=$insplot_set
plaatje$n=[$XRANGE] [$YRANGE] $(functie$n) notitle
GOED$n=<ol>$GG</ol>
F=!exec pari printtex($(functie$n))
F=!replace internal x by \cdot\\$varlist in $F
opgave$n=$argument\\=\\$F

!if $HINT=1
    F=!replace internal x by $varlist in $(functie$n)
    #F=!replace internal * by &times; in $F
    F=!replace internal + by &nbsp;+&nbsp; in $F
    F=!replace internal - by &nbsp;&minus;&nbsp; in $F
    FUNCTIE=<font color=$fontcolor6 size=+1><em>$argument&nbsp;=&nbsp;$F</em></font>
    hint=Neem uit de tabel de waarde van $varlist en bereken met de formule<br>\
    $FUNCTIE <br>de bijhorende $argument waarde...<small>lijkt me niet echt lastig ;-)</small>
!endif

