n=$counter
checkfile=$checkdir/coord.proc

ss=!record 24 of lang/remarks.$taal
#@ Bepaal <em>exact</em> de co&ouml;rdinaten van de punten op <em>f</em>,<br>waar deze functie <em>uiterste waarde(n)</em> heeft
question$n=$ss

exotext=!record 25 of lang/remarks.$taal
sometext=!record 26 of lang/remarks.$taal
exotext=<p><a onmouseover="return escape('$sometext')">$exotext
helptext=$empty
F=f\left(x\right)\,\,=\,\,

R=$level
!if $level=0
    R=$counter
!endif    
	
!if $R = 1
    a=!randitem 1,2,3,4,5,6,7,-1,-2,-3,-4,-5,-6,-7
    b=!randint 1,20  
    x1=!randint -5,5
    functie=(1/2)*$a*x^2 - $a*$x1*x + $b
    y1=$[(1/2)*$a*$x1^2 - $a*$x1*$x1 + $b]
    f=!exec pari printtex($functie)
    formula$n=f(x)\,=\, $f
    answer$n=$x1,$y1
    texanswer$n=\rightarrow \left[ \begin{array}{l} f'(x)=$a\cdot x -$[$a*$x1] = 0 \rightarrow \\ $a\cdot x=$[$a*$x1] \rightarrow \\ x\,=\,$x1 \\ f($x1)\,=\,$y1 \\ ($x1:$y1) \end{array}
    !if $teaching=1
	exotext=!record 63 of $remarkdir/commonremarks.$taal
        exotext=<a href="javascript:showimage();">$exotext
	insplot_set=size 0.6,0.6; noborder ; zeroaxis linetype 3 ; tmargin 1 ; rmargin 1 ; grid xtics ytics mxtics
	!insplot $functie title "f(x)"
    !endif    
 !exit
!endif
!if $R = 2
    c1=!randitem -3,3
    c2=!randitem 1/3,1/2,1,2,3,4
    a=($c1*$c2)
    b=!randint 1,20  
    x1=!randitem -6,-5,-4,-3,-2,-1,1
    x2=!randint $[$x1+1],5
    !if $x2=0
	x2=6
    !endif
    !if $x1=$[-1*$x2]
        f1=!texmath $a*x^2 + $[$a*$x1*$x2] = 0 
	f2=!texmath x^2 + $[$x1*$x2]=0
	f3=!texmath (x-$x1)*(x-$x2)=0
    !else
	f1=!texmath $a*x^2 - $[$a*($x1+$x2)]*x + $[$a*$x1*$x2] = 0 
	f2=!texmath x^2-$[$x1+$x2]*x + $[$x1*$x2]=0
	f3=!texmath (x-$x1)*(x-$x2)=0
    !endif

    functie=(1/3)*$a*x^3-(1/2)*$a*(($x1)+($x2))*x^2+$a*$x1*$x2*x + $b
    y1=(1/3)*$a*$x1^3-(1/2)*$a*(($x1)+($x2))*$x1*$x1+$a*$x1*$x2*$x1 + $b
    y2=(1/3)*$a*$x2^3-(1/2)*$a*(($x1)+($x2))*$x2*$x2+$a*$x1*$x2*$x2 + $b
    tot=!exec pari $y1\
    $y2\
    printtex($functie)
        
    y1=!line 1 of $tot
    y2=!line 2 of $tot
    f=!line 3 of $tot
    
    formula$n=f(x)\,=\, $f
    answer$n=$x1,$y1,$x2,$y2
    texanswer$n=\rightarrow \left[ \begin{array}{l} f'(x) = $f1\rightarrow \\ $f2  \rightarrow \\ $f3 \\ x_{1}=$x1 \\ x_{2}=$x2 \\ f($x1)\,=\,$y1 \\ f($x2)\,=\,$y2 \\ \left( $x1:$y1\right) \wedge \left( $x2:$y2 \right) \end{array}
    !if $teaching=1
	exotext=!record 63 of $remarkdir/commonremarks.$taal
        exotext=<a href="javascript:showimage();">$exotext
	insplot_set=size 0.6,0.6; noborder ; zeroaxis linetype 3 ; tmargin 1 ; rmargin 1 ; grid xtics ytics mxtics
	!insplot $functie title "f(x)"
    !endif    
 !exit
!endif

!if $R=3
    # letop niks veranderen aan $functie ivm printtex
    a=!randitem -5,-4,-3,-2,-1,1,2,3,4,5
    b=!randitem -5,-4,-3,-2,-1,1,2,3,4,5
    c=!randitem 1,4,9,16,25,36
    functie=(($a)*x)/(x^2+($b)*x+($c))
    x1=$[sqrt($c)]
    x2=$[-1*sqrt($c)]
    y1=(($a)*$x1)/($x1*$x1+($b)*$x1+($c))
    y2=(($a)*$x2)/($x2*$x2+($b)*$x2+($c))
    tot=!exec pari $y1\
    $y2\
    printtex($functie)\
    printtex((-1*($a)*x^2 + ($a)*($c))/((x^2+$b*x +$c)^2))\
    printtex(-1*($a)*x^2 + ($a)*($c))
    
    y1=!line 1 of $tot
    y2=!line 2 of $tot
    f=!line 3 of $tot
    formula$n=f(x)\,=\, $f
    answer$n=$x1,$y1,$x2,$y2
    f1=!line 4 of $tot
    f2=!line 5 of $tot
    texanswer$n=f'(x) = $f1  \rightarrow \left[ \begin{array}{l} $f2 = 0 \rightarrow \\ x^{2} = $c \rightarrow \\ x_{1}=$x1 \\ x_{2}=$x2 \\ f($x1)=$y1 \\ f($x2)=$y2 \\($x1:$y1)\wedge ($x2:$y2)\end{array} 
    !if $teaching=1
	exotext=!record 63 of $remarkdir/commonremarks.$taal
        exotext=<a href="javascript:showimage();">$exotext
	insplot_set=size 0.6,0.6; noborder ; zeroaxis linetype 3 ; tmargin 1 ; rmargin 1 ; grid xtics ytics mxtics
	!insplot $functie title "f(x)"
    !endif    
 !exit    
!endif

!if $R>3
    # letop niks veranderen aan $functie ivm printtex
    d=!randitem -5,-4,-3,-2,-1
    e=!randitem 1,2,3,4,5,6
    !if $d=$[-1*$e]
	d=$[$d-1]
    !endif
    
    c=((($d)+($e))/(-2))
    a=!randitem 2,3,4,5
    b=((($a)*($c))-(($d)*($e)))
    x1=$[-1*($e)]
    x2=$[-1*($d)]
    y1=(($x1)^2-($a)*$x1+($b))/(($x1)-($c))
    y2=(($x2)^2-($a)*$x2+($b))/(($x2)-($c))
    tot=!exec pari $y1\
    $y2\
    printtex(2*(x^2-($a)*x+($b)))\
    printtex(2*(x-($c)))\
    printtex(deriv((x^2-$a*x+($b))/(x-($c)),x))\
    printtex(x^2-2*($c)*x + ($a)*($c)-($b))
    
    y1=!line 1 of $tot
    y2=!line 2 of $tot
    tel=!line 3 of $tot
    noem=!line 4 of $tot
    ff=!line 5 of $tot
    f1=!line 6 of $tot
    
    functie=(x^2-$a*x+($b))/(x-($c))
    
    formula$n=f(x)=\frac{$tel}{$noem}
    answer$n=$x1,$y1,$x2,$y2
    texanswer$n=f'(x)=$ff \rightarrow \left[\begin{array}{l} $f1 = 0 \rightarrow \\ (x $d)(x+$e) = 0 \rightarrow x_{1}=$d \\ x_{2}=-$e \\ f($x1)=$y1 \wedge f($x2)=$y2 \\ ($x1:$y1) \wedge ($x2:$y2) \end{array}

    !if $teaching=1
	exotext=!record 63 of $remarkdir/commonremarks.$taal
        exotext=<a href="javascript:showimage();">$exotext
	insplot_set=size 0.6,0.6; noborder ; zeroaxis linetype 3 ; tmargin 1 ; rmargin 1 ; grid xtics ytics mxtics
	!insplot $functie title "f(x)"
    !endif    
 !exit
!endif

