n=$teller
speciaal=0
bewerking=bewerking7.proc
!if $graad=0
    R=$teller
!else
    R=$graad
!endif 
!if $printbaar=0
    white=white
!else
    white=magenta
!endif        
letter1=x
letter2=y
letter3=f
letter4=g
A=!randitem A,P,M,R,S,T,K
pm =!randitem +,-

    m1=!randitem 1/2,1/4,1/5,1,3/2,4/5,2,-1/2,-1/4,-1/5,-1,-3/2,-4/5,-2
    q1=!randitem 1,2,3,4,5
    lijn1=$m1*x + $q1
    #punt $A niet op de lijn
    X1=!randitem -5,-4,-3,-2,-1,2,3,4,5
    Y1=!exec pari round(($m1)*$X1 + $q1)
    Y1=$[$Y1 $pm 10]
    L1=!texmath $lijn1
    LL1=!htmlmath f(x)=$lijn1
    color1=!randitem red,blue
    !if $color1=blue
	color2=red
    !else
	color2 =blue
    !endif	

!if $R=1
    nivo_title=Determine the equation of a straight line<br>Parallel
    #parallel  aan  y=$m1*x + q1 ==> punt $A op de || lijn
    #lijn2 Y1=m1*X1+q2 => q2=$Y1 - ($m1*$X1) 	
    lijn2=!exec pari ($m1)*x + $Y1 - ($m1*$X1)
    GOED$n= $letter2=$lijn2 
    L2=!texmath $letter2 = $lijn2
    LL2=!htmlmath g(x)=$lijn2 
    somtekst$n=Give the equation of <font size="+1" color=$color2>the line <em>g</em></font>\
     parallel (||) to <font size="+1" color=$color1>the line <em>f</em></font>\
    and<br> through point <font size="+1" color=$color2><em>$A</em></font>
    opgave$n=\left\{ \begin{array}{c}$A ($X1:$Y1)\\ \\ f\left(x\right) = $L1 \end{array}
    antwoord$n=$(somtekst$n)<p>The line g:<br> $A ($X1:$Y1) || $LL1 --> $LL2
    !if $PLAATJE=1
	XSIZE=400
	YSIZE=400
	knipperen=1
	aantal_beeldjes=2
	plaatje$n=$XSIZE,$YSIZE\
	transparent $white\
	xrange -40,40\
	yrange -40,40\
	linewidth 1\
	vline 0,0,blue\
	hline 0,0,blue\
	linewidth 3\
	curve $color1,$lijn1\
	curve $color2,$lijn2\
	linewidth s*20\
	point $X1,$Y1,green\
	text black,$X1,$Y1,normal,Point $A ($X1:$Y1)
    !endif
!endif

!if $R=2
    nivo_title=Determine the equation of a straight line<br>Perpendicular
    #loodrecht    y=$[-1/$m1]*x +Q ==> punt A op de lijn	
    #Y1=$[-1/$m1]*X1 +Q ==> Q=$Y1-$[-1/$m1]*$X1=$Y1+$X1/$m1
    lijn2=!exec pari x/(-1*$m1) + ($Y1-(-1/($m1))*$X1)
    GOED$n= $letter2=$lijn2 
    L2=!texmath $lijn2
    LL2= !htmlmath g(x)=$lijn2
    somtekst$n=Given <font size="+1" color=$color2>the line <em>f</em></font>\
     and point $A<br>\
    Determione the equation of <font color=$color1 size="+1">the line <em>g</em></font> perpendicular to line <font size="+1" color=$color2><em>f</em></font> and<br>\
    through point $A
    opgave$n=\left\{ \begin{array}{c}$A ($X1:$Y1)\\\\ f\left(x\right) = $L1 \end{array}
    antwoord$n=$(somtekst$n)<p>The line <em>g</em>:<br> $A ($X1:$Y1) &perp; $LL1 &rArr; $LL2
    !if $PLAATJE=1
	XSIZE=400
	YSIZE=400
	knipperen=1
	aantal_beeldjes=2
	plaatje$n=$XSIZE,$YSIZE\
	transparent $white\
	xrange -40,40\
	yrange -40,40\
	linewidth 1\
	vline 0,0,blue\
	hline 0,0,blue\
	linewidth 3\
	curve $color2,$lijn1\
	linewidth s*5\
	curve $color1,$lijn2\
	linewidth s*20\
	point $X1,$Y1,$color2\
	text black,$X1,$Y1,normal,point $A ($X1:$Y1)
    !endif

!endif

!if $R>2
    speciaal=1
    nivo_title=Determine a general formula of "all" lines through a point
    letter1=x
    letter2=y
    letter3=!randitem a,p,q,m
    X1=!randint -10,10
    pm=!randitem -1,1
    Y1=!randint 1,10
    Y1=$[$pm*$Y1]
    somtekst$n=Given point $A with <em>x,y</em>-co&ouml;rdinates ($X1:$Y1).<br>\
    Give a general equation of <font size=+1>all</font> straight lines through point $A.<br>\
    Take as general equation for a straight line:<br><p align="center"><font size=+1><em>$letter2 = $letter3 x + b</em></font></p>
    
    wims_rawmath_variables=$letter3,$letter1
    GG=!exec pari $letter3*(x-($X1)) + ($Y1)
    GOED$n= y=$GG
    ggg=!htmlmath $(GOED$n)
    !for p=1 to 10
	CURVE=!append line curve red,s*$p*(x-$X1)+$Y1 to $CURVE
	CURVE=!append line curve red,-1*s*$p*(x-$X1)+$Y1 to $CURVE
    !next p
    !if $PLAATJE=1
	XSIZE=500
	YSIZE=300
	knipperen=1
	aantal_beeldjes=10
        plaatje$n=300,300\
	transparent $white\
	xrange -20,20\
	yrange -20,20\
	linewidth 1\
	vline 0,0,blue\
	hline 0,0,blue\
	linewidth 1\
	$CURVE\
	linewidth 10\
	point $X1,$Y1,green\
	text black,$X1,$Y1,huge,punt $A ($X1:$Y1)\
	text black,10,-1,huge,$letter1-as\
	textup black,-2,10,huge,$letter2-as
    !endif    
    antwoord$n=$(somtekst$n)<p>The general equation of <em>all</em> lines through $A ($X1:$Y1) is<br>\
    $ggg  <br>in which the slope is <em>$letter3</em>.

!endif

!if $R>30 
#nog niet geschikt
    nivo_title=Bepaal het snijpunt in algemene zin
    PLAATJE=0
    SPECIAL=1
    lijn1=!randitem f,g,h,v,r
    lijn2=!randitem k,m,w,t,s
    #niets aan letters a,b,p,q veranderen
    wims_rawmath_variables=a,b,p,q
    L1=!htmlmath $lijn1 (x) = a&bull;x + q
    L2=!htmlmath $lijn2 (x) = b&bull;x + p
    GOED$n=(p-q)/(a-b),q+a*(p-q)/(a-b),p+b*(p-a)/(a-b) 
    somtekst$n=We hebben twee lijnen<ul><li>$L1<br>met <em>a</em> als richtingsco&euml;fficient</li>\
    <li>$L2 <br>met <em>b</em> als richtingsco&euml;fficient</li></ul><br>\
    Bepaal de <em>x,y</em>-co&ouml;rdinaten van het snijpunt.<br>
    antwoord$n=
!endif

