!set n=$teller
bewerking=common/coord.proc
somtekst$n=!record 7 of lang/remarks.$taal
nivo_title=!record 20 of lang/remarks.$taal
F=f\left(x\right)\,\,=\,\,
#functie=wisk functie
#som= latex som
#GOED= afgeleide
#goed= latex afggeleide

R=$graad
!if $graad=0
    R=$teller
!endif    
	
a=!randitem 2,3,4,5,6,7,-2,-3,-4,-5,-6,-7
b=!randitem 2,4,6  
c=!randitem 2,3,4,5,6,7,8,9,10
d=!randitem 3,4,5,6,7,8,9,10   
x=!randitem -4,-3,-2,-1,0,1,2,3,4	
g=$[$d-1]

pm=!randitem +,-
mp=!randitem +,-
slope=!record 10 of lang/remarks.$taal


!if $R = 1
    functie=$a*x^$b 
    y=$[$a*($x)^$b]
    sommen=!exec pari A=deriv($functie ,x)\
    printtex(deriv($functie,x))\
    subst(A,x,$x)
    helling=!line 3 of $sommen
    afgeleide=!line 2 of $sommen
    opgave$n=\left\{\begin{array}{l}$F $a\cdot x^{$b} \\ \\ $slope = $helling\end{array}
!endif
	
!if $R = 2
    functie=$a*x^$b $pm $c*x $mp $d
    y=$[$a*($x)^$b $pm $c*($x) $mp $d]
    sommen=!exec pari A=deriv($functie ,x)\
    printtex(deriv($functie,x))\
    subst(A,x,$x)
    
    helling=!line 3 of $sommen
    afgeleide=!line 2 of $sommen
    opgave$n=\left\{\begin{array}{l}$F $a\cdot x^{$b} $pm $c\cdot x $mp $d\\ \\ $slope = $helling\end{array}
!endif

!if $R >2
    x=!randitem -3,-2,-1,1,2,3
    functie=$a $pm $c/x^2
    sommen=!exec pari $a $pm $c/($x)^2\
    A=deriv($functie ,x)\
    printtex(deriv($functie,x))\
    subst(A,x,$x)
    
    y=!line 1 of $sommen
    helling=!line 4 of $sommen
    afgeleide=!line 3 of $sommen
    opgave$n=\left\{\begin{array}{l}$F $a  $pm \frac{$c}{x^2} \\ \\ $slope = $helling\end{array}
!endif    
GOED$n=$x,$y
goed$n=\begin{array}{l} $(opgave$n) \rightarrow \\ \\ \left\{\begin{array}{l}f'(x) = $afgeleide \\ \\ $slope \, =\, $helling  \end{array} \rightarrow \\ \\ $afgeleide = $helling  \rightarrow  \\ \\ \left[\begin{array}{l} x_{p}= $x \\  y_{p}= $y \end{array} \rightarrow \\ \\ P\left( $x : $y \right) \end{array}

!if $plaatje=1
    x1=$[-1*(abs($x)) -2]
    x2=$[abs($x) + 2]
    y1=$[-1*(abs($y))-30] 
    y2=$[(abs($y))+30] 
    Yrange=[$y1:$y2]
    Xrange=[$x1:$x2]
    linetext=!record 11 of lang/remarks.$taal
    raaklijn=($helling)*x + ($y - (($helling)*($x)))
    insplot_set=size 0.6,0.6; noborder ; zeroaxis linetype 3 ; tmargin 1 ; rmargin 1 ; grid xtics ytics mxtics
    plaatje$n= $Xrange $Yrange $functie title "f(x)" ,$raaklijn title "$linetext"
!endif    
