# type (ax+b)/(cx+d)=ex+f
# let op: bij texmath vervangen we wims \to door \rightarrow in combinatie met een Array !!!

mathviewpanel=$module_title:x=:<=>
!if $rounding=-1
    rounding=0
    !readproc $remarkdir/rounding.$taal
!endif
!if $usage=2
    image=0
!endif
n=$counter
!if $level=0
    R=$counter
!else
    R=$level
!endif

exotext=$empty
keuze=!randitem 1,2
checkfile=exos/checkfile1.proc
!if $subject=15
    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
    questiontype=0
    helptext=<a onmouseover="return escape('$helptext')">$sometext</a>
!else
    varlist=x
    # maximaal aantal pijlen=tussenstappenn
    var1=5
    # aantal pijlen=tussenstappen
    var2=3
    # 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=30
    rows=5
    inputs=1
    questiontype=7
    javascript=js/exo1.js
    embed=1
    XSIZE=650                                                                                                                      
    exotext=<a onmouseover="return escape('<img src=$module_dir/gifs/exo16.jpg>')">$sometext</a>
    helptext=$empty
!endif

# question$n = html/ascii vraag
# formula$n  = latex/html versie van de formule
# answer$n = nakijk wiskundige goede antwoorden
# textanswer$n= text/ascii/html versie met uitleg van het goede antwoord
# texanswer$n is latexformule van goede antwoord

!if $R=1
    # type (ax+b)/(cx+d)=ex+f
    e=1
    c=1
    g=!randitem -5,-4,-3,-2,-1,1,2,3,4,5
    h=!randitem -5,-4,-3,-2,-1,1,2,3,4,5
    f=!randitem -5,-4,-3,-2,1,2,3,4,5
    d=!randitem -5,-4,-3,-2,-1,1,2,3,4,5
    x1=$[-1*$g]
    x2=$[-1*$h]
    a=$[($d) + ($f) - ($g) - ($h)]
    !if $a=0
	f=$[$f+1]
	a=$[($d) + ($f) - ($g) - ($h)]
    !endif
    b=$[($f)*($d) - ($g)*($h)]
    !if $b!=0
	tussen=!texmath ($a*x + $b)/(x + $d ) = x + $f
	tex=!texmath $a*x + $b = (x + $f)*(x + $d) -> $a*x + $b = x^2 + $[($f) + ($d)]*x + $[($f)*($d)] -> x^2 + $[($f) + ($d) - ($a)]*x + $[($f)*($d) -($b)] = 0 
    !else
	tussen=!texmath ($a*x )/(x + $d ) = x + $f
	tex=!texmath $a*x  = (x + $f)*(x + $d) -> $a*x  = x^2 + $[($f) + ($d)]*x + $[($f)*($d)] -> x^2 + $[($f) + ($d) - ($a)]*x + $[($f)*($d) ] = 0 
    !endif
    formula$n=$tussen \,\,\rightarrow \,\,\,
    tex=!replace internal \to by $ \rightarrow \\ $ in $tex
    answer$n=$x1,$x2
    texanswer$n=\left[ \begin{array}{l} $tex \rightarrow \\  x_{1}=$g \wedge x_{2}=$h \end{array} 
 !exit
!endif

!if $R>1
    # type (ax+b)/(cx+d)=ex+f
    c=1
    g=!randitem -5,-4,-3,-2,-1,1,2,3,4,5
    h=!randitem -5,-4,-3,-2,-1,1,2,3,4,5
    f=!randitem -5,-4,-3,-2,1,2,3,4,5
    d=!randitem -5,-4,-3,-2,-1,1,2,3,4,5
    e=!randitem -5,-4,-3,-2,2,3,4,5
    tot=!exec pari A=-1*($g)/($e)\
    printtex(A)
    x1=!line 1 of $tot
    x1_tex=!line 2 of $tot
    x2=$[-1*$h]
    x2_tex=$x2
    
    a=$[($e)*($d) + ($f) - ($g) - ($h)]
    !if $a=0
	f=$[$f+1]
	a=$[($e)*($d) + ($f) - ($g) - ($h)]
    !endif
    b=$[($f)*($d) - ($g)*($h)]
    !if $b!=0
	tussen=!texmath ($a*x + $b)/(x + $d ) = $e*x + $f
	tex=!texmath $a*x + $b = ($e*x + $f)*(x + $d) -> $a*x + $b = $e*x^2 + $[($f) + ($e)*($d)]*x + $[($f)*($d)] -> $e*x^2 + $[($f) + ($e)*($d) - ($a)]*x + $[($f)*($d) -($b)] = 0
    !else
	tussen=!texmath ($a*x )/(x + $d ) = $e*x + $f
	tex=!texmath $a*x = ($e*x + $f)*(x + $d) -> $a*x = $e*x^2 + $[($f) + ($e)*($d)]*x + $[($f)*($d)] -> $e*x^2 + $[($f) + ($e)*($d) - ($a)]*x + $[($f)*($d) -($b)] = 0
    !endif
    formula$n=$tussen \,\,\rightarrow \,\,\,
    answer$n=$x1,$x2
    tex=!replace internal \to by $ \rightarrow \\ $ in $tex
    texanswer$n=\left[ \begin{array}{l} $tex \rightarrow \\  x_{1}=$x1_tex \wedge x_{2}=$x2_tex \end{array} 
 !exit
!endif

