#type a sqrt(bx+c)=sqrt(dx) 
math=0
image=0
!set n=$counter
!if $level =0
    R=$counter
!else
    R=$level
!endif        
exotitle=!record 6 of lang/remarks.$taal
#@ Vergelijkingen met Wortels
checkfile=exos/checkfile1.proc
!if $subject=9
    questiontype=0
    varlist=x
    question$n=!record 1 of lang/remarks.$taal
    #@ Los de volgende vergelijking op:<br>
    sometext=!record 2 of lang/remarks.$taal
    helptext=!record 3 of lang/remarks.$taal
    cols=15
    rows=2
    # berekeniningen laten zien
    var3=0
    helptext=<a onmouseover="return escape('$helptext')">$sometext</a>
!else
    varlist=x
    # maximaal aantal pijlen=tussenstappenn
    var1=5
    # aantal pijlen=tussenstappen
    var2=1
    # berekeniningen laten zien
    var3=1
    question$n=!record 4 of lang/remarks.$taal
    #@ Los de volgende vergelijking op:<br>
    sometext=!record 2 of lang/remarks.$taal
    helptext=!record 5 of lang/remarks.$taal
    cols=25
    rows=5
    inputs=1
    questiontype=7
    javascript=js/exo1.js
    embed=1
    XSIZE=650
    exotext=<a onmouseover="return escape('$helptext')">$sometext</a>
    helptext=$empty
!endif
keuze=!randitem 1,0
!if $R=1
    # sqrt(ax+b)=sqrt(c) => ax+b=c => ax=c-b =>  x=(c-b)/a 
    x=!randint -10,10
    a=!randitem -7,-6,-5,-4,-3,-2,-1,2,3,4,5,6,7
    d=!randint 1,25
    b=$[$d-$a*$x]
    !if $b=0
	d=$[$d+5]
        b=$[$d-$a*$x]
    !endif
    c=$[$a*$x + $b]
    tus=!rawmath x+$b
    formula$n=\sqrt{$a \cdot $tus} = \sqrt{$c} \rightarrow
    texanswer$n=$a \cdot $tus = $c \rightarrow $a \cdot x = $[$c - $b]  \rightarrow x=$x
    answer$n=$x
 !exit
!endif 

!if $R=2
    # sqrt(ax+b)=sqrt(cx) => ax-cx=-b => (a-c)x=-b =>  x=-b/(a-c) 
    # sqrt(ax+b)=sqrt(cx+d) => ax-cx=d-b => (a-c)x=d-b =>  x=(d-b)/(a-c) 
    a=!randitem -7,-6,-5,-4,-3,-2,-1,2,3,4,5,6,7
    b=!randitem -7,-6,-5,-4,-3,-2,-1,2,3,4,5,6,7
    c=!randint 2,10
    !if $a=$c
	c=$[$c+1]
    !endif
    d=!randitem -8,-7,-6,-5,-4,-3,-2,-1,1,2,3,4,5,6,7,8
    tus=!rawmath x+$b
    tussen=!rawmath x+$d
    
    !if $keuze=1
        formula$n=\sqrt{$a \cdot $tus} = \sqrt{$c x} \rightarrow
	tot=!exec pari A=($b)/(($c)-($a))\
	printtex(A)
	answer$n=!line 1 of $tot
	xtex=!line 2 of $tot
        texanswer$n=$a \cdot $tus = $c x \rightarrow $a \cdot x -$c x= -$b \rightarrow x=$xtex
    !else
        formula$n=\sqrt{$a \cdot $tus} = \sqrt{$c $tussen} \rightarrow
	tot=!exec pari A=(($d)-($b))/(($a)-($c))\
	printtex(A)
	answer$n=!line 1 of $tot
	xtex=!line 2 of $tot
    texanswer$n=$a \cdot $tus = $c $tussen \rightarrow $[$a-$c] x= $[$d-$b] \rightarrow x=$xtex
    !endif
 !exit
!endif 

!if $R=3
    # sqrt(ax+b)=esqrt(cx) => ax+b=e^2*cx => ax-e^2cx=-b => (a-e^2c)x=-b =>  x=-b/(e^2c-a) 
    # sqrt(ax+b)=esqrt(cx+d) => ax+b=e^2*cx+e^2d => ax-e^2cx=e^2d-b =>  x=(e^2d-b)/(a-e^2c) 
    a=!randitem -7,-6,-5,-4,-3,-2,-1,2,3,4,5,6,7
    b=!randitem -7,-6,-5,-4,-3,-2,-1,2,3,4,5,6,7
    c=!randint 2,7
    e=!randitem -4,-3,-2,-1,2,3,4
    f=$[$a-($e)^2*$c]
    !if $f=0
	c=$[$c+1]
	f=$[$a-($e)^2*$c]
    !endif
    d=!randitem -5,-4,-3,-2,-1,1,2,3,4,5
    tus=!rawmath x+$b
    tussen=!rawmath x+$d
    
    !if $keuze=1
        formula$n=\sqrt{$a \cdot $tus} = $e \cdot \sqrt{$c x} \rightarrow
	tot=!exec pari A=($b)/(($a)-(($e)^2*$c))\
	printtex(A)
	answer$n=!line 1 of $tot
	xtex=!line 2 of $tot
        texanswer$n=$a \cdot $tus = $[$e*$e] \cdot $c x \rightarrow $f x= $[-1*$b] \rightarrow x=$xtex
    !else
        formula$n=\sqrt{$a \cdot $tus} = $e \cdot \sqrt{$c $tussen} \rightarrow
	tot=!exec pari A=(($e)^2*($d)-($b))/(($a)-($e)^2*($c))\
	printtex(A)
	answer$n=!line 1 of $tot
	xtex=!line 2 of $tot
    texanswer$n=$a \cdot $tus = $[$e*$e] \cdot \left($c $tussen \right) \rightarrow $f x= $[$e*$e*$d-$b] \rightarrow x=$xtex
    !endif
 !exit
!endif


!if $R>3
    # sqrt(ax+b)=esqrt(cx) => ax+b=e^2*cx => ax-e^2cx=-b => (a-e^2c)x=-b =>  x=-b/(e^2c-a) 
    # sqrt(ax+b)=esqrt(cx+d) => ax+b=e^2*cx+e^2d => ax-e^2cx=e^2d-b =>  x=(e^2d-b)/(a-e^2c) 
    a=!randitem -7,-6,-5,-4,-3,-2,-1,2,3,4,5,6,7
    b=!randitem -7,-6,-5,-4,-3,-2,-1,2,3,4,5,6,7
    c=!randint 2,7
    e=!randitem -1/4,-2/3,-1/3,-1/2,1/2,1/3,1/4,2/3
    f=$[$a-($e)^2*$c]
    !if $f=0
	c=$[$c+1]
	f=$[$a-($e)^2*$c]
    !endif
    d=!randitem -5,-4,-3,-2,-1,1,2,3,4,5
    tus=!rawmath x+$b
    tussen=!rawmath x+$d
    
    !if $keuze=1
	tot=!exec pari A=($b)/(($a)-(($e)^2*$c))\
	printtex(A)\
	printtex($e)\
	printtex($e*$e)\
	printtex($a-($e)^2*($c))
	answer$n=!line 1 of $tot
	xtex=!line 2 of $tot
	etex=!line 3 of $tot
	ektex=!line 4 of $tot
	ftex=!line 5 of $tot
        formula$n=\sqrt{$a \cdot $tus} = $etex \cdot \sqrt{$c x} \rightarrow
        texanswer$n=$a \cdot $tus = $ektex \cdot $c x \rightarrow $ftex x= $[-1*$b] \rightarrow x=$xtex
    !else
	tot=!exec pari A=(($e)^2*($d)-($b))/(($a)-($e)^2*($c))\
	printtex(A)\
	printtex($e)\
	printtex($e*$e)\
	printtex($a-($e)^2*($c))
	answer$n=!line 1 of $tot
	xtex=!line 2 of $tot
	etex=!line 3 of $tot
	ektex=!line 4 of $tot
	ftex=!line 5 of $tot
        formula$n=\sqrt{$a \cdot $tus} = $etex \cdot \sqrt{$c $tussen} \rightarrow
    texanswer$n=$a \cdot $tus = $ektex \cdot \left($c $tussen \right) \rightarrow $ftex x= $ektex \cdot $d-$b \rightarrow x=$xtex
    !endif
 !exit
!endif 

