#checkfile=exos/checkfile6.proc
checkfile=$checkdir/number.proc
var3=x
arglist=x
# var3 -> varlist
math=0
questiontype=0
image=0
!set n=$counter
!if $level =0
    R=$counter
!else
    R=$level
!endif        

exotitle=!record 2 of lang/remarks.$taal
#@ Vergelijkingen met Wortels
question$n=!record 61 of lang/remarks.$taal
#@  Los op:<br><small><em>bereken dus de waarden van x</em><br>noteer bij meerdere oplossingen iets als:<br><em>x</em>=1 en <em>x</em>=sqrt(3) of zo...</small>
keuze=!randitem 1,0
!if $R=1
    # sqrt(x^2+ax+b^2)=b => x^2+ax+b^2=b^2 => x^2+ax=0 =>  x=0 V x=-a
    # sqrt(x^2-ax+b^2)=b => x^2-ax+b^2=b^2 => x^2-ax=0 =>  x=0 V x=a
    a=!randitem 2,3,4,5,6,7,8,9,10,12
    b=!randitem 1,2,3,4,5,6,7,8
    !if $keuze=0	     
	pm=+
	answer$n=0,-$a
	A=-$a
    !else
	pm=-
	answer$n=0,$a
	A=$a
    !endif    	
    formula$n=\sqrt{\left( x^{2} $pm $a \cdot x + $[$b^2] \right)} = $b
    texanswer$n=x^{2} $pm $a \cdot x + $[$b^2] \right=$b^{2} \rightarrow x^{2} $pm $a \cdot x =0 \rightarrow x \left( x $pm $a \right) =0 \rightarrow x=0 \vee x=$A 
 !exit
!endif 

!if $R=2
    a=!randitem 2,3,4,5,6,7,8
    b=!randitem 1,2,3,4,5,6,7,8
    c=!randitem 1,2,3,4,6,7,8,9,10,11
    e=!randitem 1,2,3,4,5
    !if $keuze=1
	# (x+a)(x+b)=0 => x^2+(a+b)x+ab+c^2=c^2
	# sqrt( x^2+(a+b)x+ab+c^2)=sqrt(c^2)=c
	pm=+
	!if $a=$b
	    answer$n=$[-1*$a]
	!else
	    answer$n=$[-1*$a],$[-1*$b]
	!endif    
	formula$n=\sqrt{ \left( x^{2} + $[$a+$b] \cdot x + $[$a*$b + $c^2]  \right)} = $c
	texanswer$n=x^{2} + $[$a+$b] \cdot x + $[$a*$b + $c^2] = $c^{2} = $[$c*$c]  \rightarrow \left( x+$a \right) \cdot \left( x+$b \right) = 0 \rightarrow x= -$a \vee x= - $b
    !else
	# (x - a)(x+b)=0 => x^2+(b-a)x - ab+c^2=c^2
	# sqrt( x^2+(b-a)x-ab+c^2)=sqrt(c^2)=c
	!if $a>=$b
	    b=$[$a+$e]
	!endif    
	!if $a=$[-1*$b]
	    answer$n=$a
	!else
	    answer$n=$a,$[-1*$a]	    
	!endif
	f=$[$a*$b - $c^2] 
	!if $f <0
	    pm=+
	    f=$[-1*$f]
	!else
	    pm=-
	!endif  
	formula$n=\sqrt{ \left( x^{2} + $[$b-$a] \cdot x $pm $f  \right)} = $c
	texanswer$n=x^{2} + $[$b-$a] \cdot x $pm $f = $c^{2}  = $[$c*$c] \rightarrow  \left( x - $a \right) \cdot \left( x + $b \right) = 0 \rightarrow x= $a \vee  x= -$b
    !endif    
 !exit
!endif 

!if $R=3
    a=!randitem 1,2,3,4,5,6
    b=!randitem 1,2,3,4,5,6
    c=!randitem 1,2,3,4,5,6
    !if $keuze=1 
	#(x+a)(x+b)=0 => x^2+(a+b)x + ab + c^2  = c^2
        # sqrt(x^2+(a+b)x + ab + c^2) = c
	formula$n=\sqrt{x^{2} + $[$a+$b] \cdot x + $[$a*$b + $c*$c] } = $c
	!if $a=$b
    	    answer$n=$[-1*$a]
	!else
    	    answer$n=$[-1*$a],$[-1*$b]
	!endif
	texanswer$n=x^{2} + $[$a+$b] \cdot x + $[$a*$b + $c*$c] = $c^{2} = $[$c*$c] \rightarrow \left( x + $a \right) \cdot \left( x + $b \right) = 0 \rightarrow x= -$a \vee x= -$b
    !else
	e=!randitem 1,2,3
    	!if $a<=$b
	    a=$[$b+$e]
	!endif
	!if $[$a*$b]=$[$c*$c]
	    c=$[$c+1]
	!endif    
	# (x+a)(x-b)=0=> x^2+(a-b)x - ab + c^2  = c^2
        # sqrt(x^2+(a-b)x - ab + c^2) = c
	p=$[-1*$a*$b+$c*$c]
	!if $p<0
	    formula$n=\sqrt{x^{2} + $[$a-$b] \cdot x $p } = $c
	    texanswer$n=x^{2} + $[$a-$b] \cdot x $p =$c^{2} = $[$c*$c] \rightarrow \left( x + $a \right)\cdot \left( x - $b \right) = 0 \rightarrow x= -$a \vee x= $b    
	!else
	    formula$n=\sqrt{x^{2} + $[$a-$b] \cdot x + $p } = $c
	    texanswer$n=x^{2} + $[$a-$b] \cdot x + $p =$c^{2} = $[$c*$c] \rightarrow \left( x + $a \right)\cdot \left( x - $b \right) = 0 \rightarrow x= -$a \vee x= $b    
	!endif
	!if $[-1*$a]=$b
	    answer$n=$[-1*$a]
	!else    
	    answer$n=$[-1*$a],$b
	!endif
    !endif	
    !exit
!endif


!if $R>3
    a=!randitem 1,2,3,4
    b=!randitem 1,2,3,4
    c=!randitem 2,3,4,5,6,7,8
    !if $keuze=1
	# (x+a)(x+b)=0 => x^2+(a+b)x+ab+1/c^2=1/c^2
	# sqrt( x^2+(a+b)x+ab+1/c^2)=sqrt(1/c^2)=1/c
	!if $a=$b
	    answer$n=$[-1*$a]
	!else
	    answer$n=$[-1*$a],$[-1*$b]
	!endif
	C=!exec pari printtex($a*$b + (1)/$c^2)
	formula$n=\sqrt{ \left( x^{2} + $[$a+$b] \cdot x + $C  \right)} = \frac{1}{$c}
	texanswer$n= x^{2} + $[$a+$b] \cdot x + $C = \frac{1}{$c^{2}} = \frac{1}{$[$c*$c]} \rightarrow \left( x + $a \right) \cdot \left( x + $b \right) = 0 \rightarrow x= -$a \vee x= -$b
    !else
	# (x - a)(x+b)=0 => x^2+(b-a)x - ab+1/c^2=1/c^2
	# sqrt( x^2+(b-a)x-ab+1/c^2)=sqrt(1/c^2)=1/c
	e=!randitem 1,2,3
	!if $b<= $a
	    b=$[$a+$e]
	!endif    
	
	!if $a=$[-1*$b]
	    answer$n=$a
	!else
	    answer$n=$a,$[-1*$b]
	!endif
	C=!exec pari printtex($a*$b - (1)/$c^2)
	formula$n=\sqrt{ \left( x^{2} + $[$b-$a] \cdot x - $C \right)} = \frac{1}{$c}
	texanswer$n=x^{2} - $[$b-$a] \cdot x - $C = \frac{1}{$c^{2}} = \frac{1}{$[$c*$c]}  \rightarrow \left( x - $a \right) \cdot \left( x + $b \right) = 0 \rightarrow x=$a \vee x= -$b
    !endif    
 !exit
!endif 

