{ Taala-JSP CODE FOR JSX CONVERSION 13.12.2019 MEP } { Muista täpättää LaTeX labels: } MeasurementAccuracy = 100 { Lineaarialgebra: PNS-suorien ratkaisu 3x2 Puzzle 1} { 2. Kolmen yhtälön PNS-ratkaisuista puzzle 1 } { JSX board name: LinesLSQR_P1 } { JSX element id: lineslsqr_P1 } #CODE = "GSP.class" #CODEBASE = "../jsp" #ARCHIVE = "jsp4.jar" #WIDTH = 400 #HEIGHT = 400 #ALIGN = Center *Frame = 1 *TextFont = "Courier" *TextBold = 0 *TextSize = 14 *LabelFont = "Courier" *LabelBold = 0 *LabelSize = 14 *MeasureFont = "Courier" *MeasureSize = 14 *MeasureBold = 0 *MeasureInDegrees = 1 *DirectedAngles = 0 *BackRed = 255 *BackGreen = 255 *BackBlue = 230 $MP Point(100,100)[red,label('x')]; {,label('\\mathbf{x}'),LabelAlign(-15,5),highlight,psize(2)} ${ $reset FixedText(385,15,'Reset = ''R''')[black,bold,justifyRight]; $Clear FixedText(370,413,'Puhdistus: x ->')[red,plain,font('Courier'),justifyRight]; $xText FixedText(385,195,'x1')[bold, black, justifyCenter]; $yText FixedText(192, 10,'x2')[bold, black, justifyCenter]; $} ${ for scaling $} $RO FixedPoint(200,400)[black,label('0'),hidden]; $Ref Translation($RO,40,0)[hidden]; $Ray Ray($Ref,$RO)[black, hidden]; $Rykk Point on object($Ray,1)[white, label('1'), hidden]; $R1Vis FixedPoint(240,400)[white,label('1'),hidden]; $RL Line($Rykk,$RO)[black,hidden]; $Rpta Point on object($RL,1)[label('a'), red, layer(10), hidden]; $Ra Ratio/Points($RO,$Rykk,$Rpta,320,35,'a = ')[red, hidden]; $Rptb Point on object($RL,1)[label('b'), color(0,150,0), layer(15), hidden]; $Rb Ratio/Points($RO,$Rykk,$Rptb,320,55,'b = ')[color(0,150,0), hidden]; $Rptc Point on object($RL,1)[label('c'), blue, layer(20), hidden]; $Rc Ratio/Points($RO,$Rykk,$Rptc,320,75,'c = ')[blue, hidden]; $LUpp FixedPoint(0,386)[hidden]; $LLow FixedPoint(0,420)[hidden]; $RLow FixedPoint(406,420)[hidden]; $RUpp FixedPoint(406,386)[hidden]; $ULine Line($LUpp,$RUpp)[black, hidden]; $RectA Polygon($LUpp,$LLow,$RLow,$RUpp,$LUpp)[yellow,hidden]; $SBRL ShowButton( 0,365,'Scale eqs')($RO,$R1Vis,$RL,$Rpta,$Rptb,$Rptc,$RectA)[black, hidden]; $HBRL HideButton(62,365,'Fix')( $RO,$R1Vis,$RL,$Rpta,$Rptb,$Rptc,$RectA)[black, hidden]; ${ The Plane Coordinate System $} $O FixedPoint(200, 200) [black, label('0'),hidden]; $unitp UnitPoint($O, 40) [white, label('1'),hidden]; $ykk FixedPoint(240,200)[white, label('1'),hidden]; $coord Origin&Unit($O, $unitp)[black]; $Xax AxisX($coord)[black,hidden]; $Yax AxisY($coord)[black,hidden]; $Sunit Segment($O,$unitp)[hidden]; $P1 Point(280,150)[red, label('P1'), hidden]; $CirP Circle by radius($P1,$Sunit)[red, hidden]; $P2 Point on object($CirP, 1)[red, label('P2'),hidden]; $LP1P2 Line($P1,$P2)[red]; $CoP1 Coordinates($P1,$coord,20,100,'P1 = ')[red,hidden]; $CoP2 Coordinates($P2,$coord,20, 60,'P2 = ')[red,hidden]; $a11pr Calculate( 0,35,'','#B2 #A2 -')($CoP1,$CoP2)[red,suffix('x'), hidden]; $a12pr Calculate( 57,35,'+(','#A1 #B1 -')($CoP1,$CoP2)[red,suffix(')y = '), hidden]; $b1pr Calculate(152,35,'','#B2 #A2- #A1* #B1 #A1- #A2* -')($CoP1,$CoP2)[red, hidden]; $a11 Calculate(0,35,'','AB*')($a11pr,$Ra)[red, suffix('x'), hidden]; $a12 Calculate(57,35,'+(','AB*')($a12pr,$Ra)[red, suffix(')y = '), hidden]; $b1 Calculate(152,35,'','AB*')($b1pr,$Ra)[red, hidden]; $Q1 Point(200,320)[color(0,150,0), label('Q1'), hidden]; $CirQ Circle by radius($Q1,$Sunit)[color(0,150,0), hidden]; $Q2 Point on object($CirQ, 3)[color(0,150,0), label('Q2'),hidden]; $LQ1Q2 Line($Q1,$Q2)[color(0,150,0)]; $CoQ1 Coordinates($Q1,$coord,20,100,'Q1 = ')[color(0,150,0),hidden]; $CoQ2 Coordinates($Q2,$coord,20, 60,'Q2 = ')[color(0,150,0),hidden]; $a21pr Calculate( 0,55,'','#B2 #A2 -')($CoQ1,$CoQ2)[color(0,150,0),suffix('x'), hidden]; $a22pr Calculate( 57,55,'+(','#A1 #B1 -')($CoQ1,$CoQ2)[color(0,150,0),suffix(')y = '), hidden]; $b2pr Calculate(152,55,'','#B2 #A2- #A1* #B1 #A1- #A2* -')($CoQ1,$CoQ2)[color(0,150,0), hidden]; $a21 Calculate( 0,55,'','AB*')($a21pr,$Rb)[color(0,150,0), suffix('x'), hidden]; $a22 Calculate(57,55,'+(','AB*')($a22pr,$Rb)[color(0,150,0), suffix(')y = '), hidden]; $b2 Calculate(152,55,'','AB*')($b2pr,$Rb)[color(0,150,0), hidden]; $R1 Point(120,240)[blue, label('R1'), hidden]; $CirR Circle by radius($R1,$Sunit)[blue, hidden]; $R2 Point on object($CirR, 5)[blue, label('R2'),hidden]; $LR1R2 Line($R1,$R2)[blue]; $CoR1 Coordinates($R1,$coord,20,100,'R1 = ')[blue,hidden]; $CoR2 Coordinates($R2,$coord,20, 60,'R2 = ')[blue,hidden]; $a31pr Calculate( 0,75,'','#B2 #A2 -')($CoR1,$CoR2)[blue,suffix('x'), hidden]; $a32pr Calculate( 57,75,'+(','#A1 #B1 -')($CoR1,$CoR2)[blue,suffix(')y = '), hidden]; $b3pr Calculate(152,75,'','#B2 #A2- #A1* #B1 #A1- #A2* -')($CoR1,$CoR2)[blue, hidden]; $a31 Calculate( 0,75,'','AB*')($a31pr,$Rc)[blue, suffix('x'), hidden]; $a32 Calculate(57,75,'+(','AB*')($a32pr,$Rc)[blue, suffix(')y = '), hidden]; $b3 Calculate(152,75,'','AB*')($b3pr,$Rc)[blue, hidden]; $A Calculate(205, 10,'A = ','A2^ B2^ + C2^ +')($a11,$a21,$a31)[black,hidden]; $B Calculate(205, 25,'B = ','AD* BE* + CF* +')($a11,$a21,$a31,$a12,$a22,$a32)[black,hidden]; $C Calculate(205, 40,'C = ','A2^ B2^ + C2^ +')($a12,$a22,$a32)[black,hidden]; $D Calculate(205, 55,'D = ','AD* BE* + CF* +')($a11,$a21,$a31,$b1,$b2,$b3)[black,hidden]; $E Calculate(205, 70,'E = ','AD* BE* + CF* +')($a12,$a22,$a32,$b1,$b2,$b3)[black,hidden]; $det Calculate(205, 85,'det = ','AC* BB* -')($A,$B,$C)[black,hidden]; $x1 Calculate(205,100,'x1 = ','AD* BC* - E /')($D,$B,$E,$C,$det)[black,hidden]; $x2 Calculate(205,115,'x2 = ','AD* BC* - E /')($A,$D,$B,$E,$det)[black,hidden]; $x0 PlotXY($x2,$coord,$x1)[magenta, label('x0'), layer(10),hidden]; ${ $xtr PlotXY($x2,$coord,$x1)[magenta, label('x'), layer(10), traced, hidden]; $} $Cx Coordinates($x0,$coord,5,195,'x = ')[magenta, bold,hidden]; $dist Distance( $MP, $x0, 0, 50, 'et = ') [blue,hidden]; $flag Calculate( 0, 70, 'luku = ','0.05 3 A - @sqrt 0.000001 * + ')($dist)[red,hidden]; {,hideNaN} $vastx Translation/FixedAngle/MarkedDistance($x0, $flag,0)[magenta,label('x0 ICI!'),layer(20)]; {,label('\\widehat{\\mathbf{x}} \\ est \\ ICI !'),LabelAlign(10,-10),psize(3)} $Cvastx Coordinates($vastx,$coord,50,195,'')[magenta]; {,hideNaN} $x0text FixedText(140,195,'x0')[bold, magenta, justifyCenter]; {,text('\\( \\widehat{\\mathbf{x}} = \\)') ${ $SBxtr ShowButton( 0,160,'Trace x0')($xtr)[magenta,hidden]; $HBxtr HideButton(57,160,'Stop')($xtr)[magenta,hidden]; $SBeq ShowButton(0,0,'Equations')($a11,$a12,$b1,$a21,$a22,$b2,$a31,$a32,$b3)[black,bold,hidden]; $HBeq HideButton(70,0,'Hide')($a11,$a12,$b1,$a21,$a22,$b2,$a31,$a32,$b3)[black,bold,hidden]; $}