!set n=$teller
R=$graad
!if $graad=0
    R=$teller
!endif    
wims_exec_error=$empty
bewerking=nivo/bewerking4.proc
	
a=!randitem 2,3,4,5
b=$[$teller+1]
c=!randitem 2,4,6,8,10,12,14,16
d=!randitem 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16    
e=!randitem 2,3,4,5 
f=!randitem 6,7,8,9 
!if $b=$d
    b=$[$b+1]
!endif	

pm=!randitem +,-
mp=!randitem +,-
keuze=!randitem 1,2
s=!randitem 1,-1
a=$[$s*$a]  
	
!if $R = 1
    BEREIK=!randint 5,20	
    X1=!randint -20,-5
    X2=$[$X2+$BEREIK]
    functie$n=$a*x^$b $pm $c 
    som$n= $a\cdot x^{$b} $pm $c 
!endif

!if $R = 2 	
    BEREIK=!randint 1,20	
    X1=!randint -10,0
    X2=$[$X2+$BEREIK]
    functie$n=$c*x^$b $pm $d*x
    opgave$n= $c\cdot x^{$b} $pm $d\cdot x 
!endif

!if $R>2
    BEREIK=!randint 1,20	
    X1=!randint -10,0
    X2=$[$X2+$BEREIK]
    functie$n=$a*x^$b $pm $d*x $mp $c
    opgave$n= $a\cdot \root $f \of{x} $pm $d
!endif
!if $plaatje=1
    y1=!evalsubst x=$X1 in $(functie$n)
    y2=!evalsubst x=$X2 in $(functie$n)
    !if $y1 > $y2
	Y2=$y1
	Y1=$y2
    !else
	Y1=$y1
	Y2=$y2
    !endif	
    !if $Y1>0
	Y1=-1
    !endif    
    !if $Y2<0
	Y2=1
    !endif  

    plaatje$n=\
    xrange $[$X1-5],$[$X2+5]\
    yrange $[$Y1-5],$[$Y2+5]\
    hline 0,0,blue\
    vline 0,0,blue\
    linewidth 2\
    curve red,$(functie$n)\
    dvline $X1,0,green\
    dvline $X2,0,green\
    rect $[$X1-5],$[$Y1-5],$[$X2+5],$[$Y2+5],black
!endif
opgave$n= \int_{$X1}^{$X2}\frac{dx}{$(opgave$n)}
totaal=!exec maxima integrate($(functie$n) ,x,$X1,$X2);\
integrate($(functie$n),x);
!if $wims_exec_error != $empty
    OPMERKING=!record 60 of common/commonremarks.$taal
    TERUG=1
    !exit
!endif 
GOED$n=!line 1 of $totaal
goed$n=!line 2 of $totaal
goed$n=!texmath $(goed$n)
goed$n=\int_{$X1}^{$X2} \left ( $(goed$n) \right )
somtekst$n=!record 22 of lang/remarks.$taal
nivo_title=!record 23 of lang/remarks.$taal

