n=$teller
bewerking=bewerking5.proc
!if $graad=0
    R=$teller
!else
    R=$graad
!endif 
!if $printbaar=0
    white=white
!else
    white=magenta
!endif 

#dutch version is differently
nivo_title=Determine the intersection points of two lines
letter1=x
letter2=y
letter3=!randitem f,g,h
letter4=!randitem k,m
A=!randitem A,B,C,D,E,F
pm =!randitem +,-
!if $taal=nl
    kleuren=red@rooie,blue@blauwe,green@groene,orange@oranje,purple@paarse
    kleuren=!shuffle $kleuren
    k1=!item 1 of $kleuren
    k2=!item 2 of $kleuren
    k1=!replace internal @ by , in $k1	
    k2=!replace internal @ by , in $k2
    kleur1=!item 2 of $k1
    color1=!item 1 of $k1
    kleur2=!item 2 of $k2
    color2=!item 1 of $k2
!else
    kleuren=red,blue,green,orange,purple
    kleuren=!shuffle $kleuren
    kleur1=!item 1 of $kleuren
    color1=!item 1 of $kleuren
    kleur2=!item 2 of $kleuren
    color2=!item 2 of $kleuren
!endif

        
!if $R=1
    m=!randitem 1,2,3
    #het snijpunt (een mooi punt)
    X=!randint 1,10
    Y=!randint 1,10
    GOED$n=$X,$Y
    #de lijn L1 door dit punt:
    # Y=mX+q => q =Y-mX  
    #lijn1=!exec pari $m*$letter1 + $Y - $m*$X   
    lijn1=$Y
    L1=!texmath $letter3 ($letter1) = $lijn1
    #de andere lijn eerst loodrecht op L2 door Snijpunt
    #lijn2  Y=-X/$m + q2 => q2= Y + X/$m => lijn2 =-x/$m + Y + X/$m
    lijn2=!exec pari $letter1/(-1*$m) + $Y + $X/$m
    L2=!texmath $letter4 ($letter1) = $lijn2
!endif

!if $R=2
    m=!randitem 1,2,3,-1,-2,-3
    #het snijpunt (een mooi punt
    X=!randint -10,10
    Y=!randint -10,10
    !if $X=0 or $Y=0
	X=1
	Y=-10
    !endif
    GOED$n=$X,$Y
    #de lijn L1 door dit punt:
    # Y=mX+q => q =Y-mX  
    #lijn1=!exec pari $m*$letter1 + $Y - $m*$X   
    lijn1=$Y
    L1=!texmath $letter3 ($letter1) = $lijn1
    #de andere lijn eerst loodrecht op L2 door Snijpunt
    #lijn2  Y=-X/$m + q2 => q2= Y + X/$m => lijn2 =-x/$m + Y + X/$m
    lijn2=!exec pari $letter1/(-1*$m) + $Y + $X/$m
    L2=!texmath $letter4 ($letter1) = $lijn2
!endif
!if $R=3
    T=!randint 1,25 
    N=!randint 10,30
    pm=!randitem 1,-1
    T=$[$pm*$T]
    m=$T/$N
    #het snijpunt (een mooi punt
    X=!randint -10,10
    Y=!randint -10,10
    !if $X=0 or $Y=0
	X=1
	Y=-10
    !endif
    GOED$n=$X,$Y
    #de lijn L1 door dit punt:
    # Y=mX+q => q =Y-mX  
    #lijn1=!exec pari ($m)*$letter1 + $Y - ($m)*$X  
    lijn1=$Y
    L1=!texmath $letter3(x)=$lijn1
    #de andere lijn eerst loodrecht op L2 door Snijpunt
    #lijn2  Y=-X/$m + q2 => q2= Y + X/$m => lijn2 =-x/$m + Y + X/$m
    lijn2=!exec pari $letter1/(-1*$m) + $Y + $X/($m)
    L2=!texmath $letter4(x) = $lijn2
!endif
!if $R>3
#bolleboosjes
    T=!randitem 1,2,3,4,5,6,7,8,9,10,11,12 
    N=!randitem 13,14,15,16,17,18,19,20,22,24
    pm=!randitem 1,-1
    T=$[$pm*$T]
    m=$T/$N
    #het snijpunt (een mooi punt
    X=!randint -10,10
    Y=!randint -10,10
    !if $X=0 or $Y=0
	X=1
	Y=-10
    !endif
    GOED$n=$X,$Y
    #de lijn L1 door dit punt:
    # Y=mX+q => q =Y-mX  
    #lijn1=!exec pari ($m)*$letter1 + $Y - ($m)*$X   
    lijn1=$Y
    L1=!texmath $letter3 ($letter1) =  $lijn1
    m2=$N/$T
    #snijpunt opdeze lijn: Y=m2*X + q2 => q2=$Y -m2X
    lijn2=!exec pari ($m2)*$letter1 +$Y - ($m2)*$X
    L2=!texmath $letter4 ($letter1) = $lijn2
!endif

opgave$n=\left\{ \begin{array}{c}$L1\\\\$L2\end{array}

somtekst$n=Given is the <em>$letter1,$letter2</em>-plane are twe straight lines. \
<ul><li><font color=$color1>the line $letter3</font></li><li> and <font color=$color2>the line $letter4</font></ul>\
They intersect in point $A .<br>Calculate the co&ouml;rdinates of this intersection point $A.

antwoord$n=$(somtekst$n)<p>The co&ouml;rdinates of the intersection point $A are ($X:$Y).
    !if $PLAATJE=1
	XSIZE=400
	YSIZE=400
	knipperen=1
	aantal_beeldjes=2
	plaatje$n=$XSIZE,$YSIZE\
	transparent $white\
	xrange -20,20\
	yrange -20,20\
	linewidth 1\
	vline 0,0,blue\
	hline 0,0,blue\
	linewidth 3\
	curve $color1,$lijn1\
	curve $color2,$lijn2\
	linewidth s*20\
	point $X,$Y,green\
	text black,$X,$Y,normal,point $A
    !endif


hint=no hints
#<div align="left"><font color=$fontcolor2> hint<ul>\
#<li>lijn1: y=mx+q en line2: y=px+k\
#<li>We want the intersection poinr: so line<sub>1</sub>=line<sub>2</sub>\
#<li>line1=line2 &hArr;<em> mx+q=px+k &hArr; mx-px=k-q &hArr; x(m-p)=k-q</em>\
#<li><em>x<sub><small>snijpunt</small></sub>=(k-q)/(m-p)</em>\
#<li>and this we can calculate , because k,q,m,p are known\
#<li>We vullen deze <em>x</em><sub><small>snijpunt</small></sub>-waarde in &eacute;&eacute;n van de lineen in\
#<li>het maakt niet uit welke line1 of line2 ; omdat het snijpunt op beide lineen ligt\
#<li>Om zo de <em>y</em><sub><small>snijpunt</small></sub>-waarde te berekenen.\
#</ul></div> 
