| 
Lineaarialgebra
Ominaisarvot ja -vektorit
 | 
Seuraavassa on 2x2-matriisin määräämän lineaarikuvausten ominaisarvojen ja ominaisvektorien
visualisointi. Siinä on päällekkäin toisaalta taso R2, toisaalta ominaisarvoja varten
kompleksitaso. Reaaliset ominaisarvot ovat siis luonnollisesti vaaka-akselilla.
Voit kokeilla konkreettisilla 2x2-matriisella valitsemalla luvut aij (tässä a, b, c, d)
sopiviksi liukuvalinnoilla. Sopivin tempuin ominaisarvot ja -vektoritkin saa selville.
Huomaa, että taulun alkutilassa ominaisarvot ovat ei-reaalisia, jolloin myös ominaisvektorit ovat
ei-reaalisia ja siten ne eivät kuviosta selviä!
${
Ominaisarvot ja -vektorit
$}
#CODE="GSP.class" 
#CODEBASE = "../jsp" 
#ARCHIVE="jsp4.jar"
#WIDTH = 500
#HEIGHT= 520
#ALIGN=Center
*MeasureFont	  = "CourierNew"
*MeasureSize	  = 14
*MeasureBold	  =  1
*MeasureItalic    =  0
*MeasureInDegrees =  1
*DirectedAngles   =  0
*BackRed          = 240
*BackGreen        = 255
*BackBlue         = 255
$Clear  FixedText(465,513,'Clear trace x ->')[plain, font('Courier'), bold, justifyRight, red,hidden];
$reset  FixedText(490,485,'Reset = ''R''')[plain, font('Courier'), bold, justifyRight, red];
${
	Bracket macros
$}
$(
	Left Bracket(upper,lower)
$!uptr	Translation($upper,5,0)[hidden];
$!lotr	Translation($lower,5,0)[hidden];
	Segment($upper,$uptr)[black];
	Segment($lower,$lotr)[black];
	Segment($upper,$lower)[black];
$)
$(
	Right Bracket(upper,lower)
$!uptr Translation($upper,-5,0)[hidden];
$!lotr Translation($lower,-5,0)[hidden];
	Segment($upper,$uptr)[black];
	Segment($lower,$lotr)[black];
	Segment($upper,$lower)[black];
$)
${
The matrix brackets
$}
	$LuppA	FixedPoint(260,25)[hidden];
	$LlowA	FixedPoint(260,75)[hidden];
	$LBrA	Left Bracket($LuppA,$LlowA)[black,hidden];
	$RuppA	FixedPoint(360,25)[hidden];
	$RlowA	FixedPoint(360,75)[hidden];
	$RBrA	Right Bracket($RuppA,$RlowA)[black,hidden];
	$Luppu	FixedPoint(365,25)[hidden];
	$Llowu	FixedPoint(365,75)[hidden];
	$LBru	Left Bracket($Luppu,$Llowu)[red,hidden];
	$Ruppu	FixedPoint(410,25)[hidden];
	$Rlowu	FixedPoint(410,75)[hidden];
	$RBru	Right Bracket($Ruppu,$Rlowu)[red,hidden];
	$LuppAu	FixedPoint(440,25)[hidden];
	$LlowAu	FixedPoint(440,75)[hidden];
	$LBrAu	Left Bracket($LuppAu,$LlowAu)[blue,hidden];
	$RuppAu	FixedPoint(490,25)[hidden];
	$RlowAu	FixedPoint(490,75)[hidden];
	$RBrAu	Right Bracket($RuppAu,$RlowAu)[blue,hidden];
	$ULeq 	FixedPoint(420,47)[hidden];
	$UReq 	FixedPoint(430,47)[hidden];
	$LLeq 	FixedPoint(420,53)[hidden];
	$LReq 	FixedPoint(430,53)[hidden];
	$EQup	Segment($ULeq,$UReq)[white,hidden];
	$EQlo	Segment($LLeq,$LReq)[white,hidden];
${
The Real Line
$}
	$RO	FixedPoint(250,500)[black,label('0')];
	$Ref	Translation($RO,25,0)[hidden];
	$Ray	Ray($Ref,$RO)[black,hidden];
	$Rykk	Point on object($Ray,1)[yellow,label('1'),hidden];
	$Rvaleykk FixedPoint(275,500)[black,label('1')];
	$RL	Line($Rykk,$RO)[black];
	$Rpta	Point on object($RL,-2)[label('a'),color(190,150,0)];
	$Rptb	Point on object($RL,4)[label('b'),color(65,125,200)];
	$Rptc	Point on object($RL,-1)[label('c'),color(65,125,200)];
	$Rptd	Point on object($RL,-4)[label('d'),color(190,150,0)];
$LUpp	FixedPoint(0,486)[hidden];
$LLow	FixedPoint(0,520)[hidden];
$RLow	FixedPoint(500,520)[hidden];
$RUpp	FixedPoint(500,486)[hidden];
$RectA	Polygon($LUpp,$LLow,$RLow,$RUpp,$LUpp)[yellow];
${
The Plane Coordinate System
$}
	$O	FixedPoint(250,250)[yellow,label('0')];
	$ykk	FixedPoint(275,250)[white,label('1')];
	$unitp	UnitPoint($O,25)[hidden];
	$coord  Origin&Unit($O,$unitp)[black, hidden];
$SBcoord ShowButton(390,225,'Show grid')($coord)[black,bold];
$HBcoord HideButton(460,225,'Hide')($coord)[black];
	$hor    AxisX($coord)[black];
	$vert   AxisY($coord)[hidden];
	$start	FixedPoint(250,485)[hidden];
	$vertsh Ray($O,$start)[black];
${
Calculations
$}
	$Ra	Ratio/Points($RO,$Rykk,$Rpta,270,45,'')[color(190,150,0),hidden];
	$Rb	Ratio/Points($RO,$Rykk,$Rptb,320,45,'')[color(65,125,200),hidden];
	$Rc	Ratio/Points($RO,$Rykk,$Rptc,270,67,'')[color(65,125,200),hidden];
	$Rd	Ratio/Points($RO,$Rykk,$Rptd,320,67,'')[color(190,150,0),hidden];
	$u	Point(275,270)[red, label('u')];
	$ucoord	Coordinates($u,$coord,100,100,'')[hidden];
	$xval	Calculate(370,45,'','#A1')($ucoord)[red,hidden];
	$yval	Calculate(370,67,'','#A2')($ucoord)[red,hidden];
$utr	PlotXY($yval,$coord,$xval)[red,traced,hidden];
	
$xLu	Calculate(445,45,'','A C * B D * +')($Ra,$Rb,$xval,$yval)[blue,hidden];
$yLu	Calculate(445,67,'','A C * B D * +')($Rc,$Rd,$xval,$yval)[blue,hidden];
$Lu	PlotXY($yLu,$coord,$xLu)[blue,label('L(u)')];
$Lutr	PlotXY($yLu,$coord,$xLu)[blue,label('L(u)'),traced,hidden];
$detA	Calculate(260,95,'det(A) = ','A D * B C * -')($Ra,$Rb,$Rc,$Rd)[color(255,130,0),hidden];
$trA	Calculate(396,95,' tr(A) = ','A D +')(        $Ra,$Rb,$Rc,$Rd)[color(190,150,0),hidden];
$X	Calculate(325,165,'X = ','A D + 0.5 *')(      $Ra,$Rb,$Rc,$Rd)[yellow,hidden];
$Y	Calculate(325,190,'Y = ','AA* AD*2* - DD* + BC* 4* +')($Ra,$Rb,$Rc,$Rd)[yellow,hidden];
$Z1	Calculate(260,118,'E1 = eig(A) = ','B @abs_ B + 0.5 * @sqrt 0.5 * A +')($X,$Y)[color(70,190,200),hidden];
$Z2	Calculate(375,118,'     +  i * ','B @abs_ B - 0.5 * @sqrt 0.5 *')($X,$Y)[color(70,190,200),hidden];
$U1	Calculate(260,142,'E2 = eig(A) = ','A B @abs_ B + 0.5 * @sqrt 0.5 * -')($X,$Y)[color(0,170,0),hidden];
$U2	Calculate(375,142,'     +  i * ','0 B @abs_ B - 0.5 * @sqrt 0.5 * -')($X,$Y)[color(0,170,0),hidden];
$EIG1	PlotXY($Z2,$coord,$Z1)[color(70,190,200),label('E1')];
$EIG2	PlotXY($U2,$coord,$U1)[color(0,170,0),label('E2')];
$EIG1tr	PlotXY($Z2,$coord,$Z1)[color(70,190,200),label('E1'),traced,hidden];
$EIG2tr	PlotXY($U2,$coord,$U1)[color(0,170,0),label('E2'),traced,hidden];
$SE1E2	Segment($EIG1,$EIG2)[yellow];
$SBtrE1	ShowButton(0,405,'Trace eigenvalues')($EIG1tr,$EIG2tr,$Clear)[black];
$HBtrE2	HideButton(0,425,'Stop tracing')($EIG1tr,$EIG2tr)[black];
${	
$SBA	ShowButton( 305, 0,'A')($Ra,$Rb,$Rc,$Rd,$LBrA,$RBrA)[black,hidden];
$SBu	ShowButton( 380, 0,'u')($xval,$yval,$LBru,$RBru)[red,hidden];
$SBAu	ShowButton( 450, 0,'A u')($EQup,$EQlo,$xLu,$yLu,$LBrAu,$RBrAu)[blue,hidden];
$SBRep	ShowButton( 175, 0,'Representation of L')($SBA,$SBu,$SBAu,$Ra,$Rb,$Rc,$Rd,$LBrA,$RBrA,$xval,$yval,$LBru,$RBru,$EQup,$EQlo,$xLu,$yLu,$LBrAu,$RBrAu,$detA,$trA,$Z1,$Z2,$U1,$U2)[blue];
$HBRep	HideButton( 175,20,'Hide all')(           $SBA,$SBu,$SBAu,$Ra,$Rb,$Rc,$Rd,$LBrA,$RBrA,$xval,$yval,$LBru,$RBru,$EQup,$EQlo,$xLu,$yLu,$LBrAu,$RBrAu,$detA,$trA,$Z1,$Z2,$U1,$U2)[blue];
$}
$Atext  FixedText(315,15,'A')[plain, font('Helvetica'), bold, justifyRight, black,hidden];
$utext  FixedText(390,15,'u')[plain, font('Helvetica'), bold, justifyRight, red,hidden];
$Autext FixedText(470,15,'Au')[plain, font('Helvetica'), bold, justifyRight, blue,hidden];
$SBRep	ShowButton( 175, 0,'Representation of L')($Atext,$utext,$Autext,$Ra,$Rb,$Rc,$Rd,$LBrA,$RBrA,$xval,$yval,$LBru,$RBru,$EQup,$EQlo,$xLu,$yLu,$LBrAu,$RBrAu,$detA,$trA,$Z1,$Z2,$U1,$U2)[blue];
$HBRep	HideButton( 175,20,'Hide all')(           $Atext,$utext,$Autext,$Ra,$Rb,$Rc,$Rd,$LBrA,$RBrA,$xval,$yval,$LBru,$RBru,$EQup,$EQlo,$xLu,$yLu,$LBrAu,$RBrAu,$detA,$trA,$Z1,$Z2,$U1,$U2)[blue];
${
Segments
$}
	$SOu	Segment($O,$u)[red,thick];
	$SLu	Segment($O,$Lu)[blue,   hidden];
	$SuLu	Segment($u,$Lu)[magenta,hidden];
$SBSegmu ShowButton( 0, 0,'Segment to u')($SOu)[red];
$HBSegmu HideButton(85,0,'Hide')($SOu)[red];
$SBSegm	ShowButton( 0, 20,'Segments to L(u)')($SLu,$SuLu)[magenta];
$HBSegm	HideButton(110,20,'Hide')(            $SLu,$SuLu)[magenta];
$SBtrLu	ShowButton( 0,40,'Trace')($utr,$Lutr,$Clear)[blue];
$HBtrLu	HideButton(72,40,'Stop')($utr,$Lutr)[blue];
$Centpt	Point(250,250)[magenta,hidden];
$Cpt	Point(250,225)[magenta,hidden];
$Circ	Circle($Centpt,$Cpt)[magenta,hidden];
$ABC	AnimateButton(10,110,'Animate')($u,$Circ)(4)(0)(0)[black,hidden];
$LCirc	Locus($Lu,$u,$Circ,40)[blue,hidden];
$SBCL	ShowButton(10,130,'Locus')($LCirc)[blue,hidden];
$HBCL	HideButton(55,130,'Hide')($LCirc)[blue,hidden];
$SBAC	ShowButton( 0,90,'CIRCLE')($Centpt,$Cpt,$Circ,$ABC,$SBCL,$HBCL)[magenta,hidden];
$HBAC	HideButton(60,90,'Hide')(  $Centpt,$Cpt,$Circ,$ABC,$SBCL,$HBCL)[magenta,hidden];
$PtSt	Point(225,225)[magenta,hidden];
$PtEnd	Point(275,275)[magenta,hidden];
$Segm	Segment($PtSt,$PtEnd)[magenta,hidden];
$ABS	AnimateButton(10,180,'Animate')($u,$Segm)(4)(0)(0)[black,hidden];
$LSegm	Locus($Lu,$u,$Segm,40)[blue,hidden];
$SBSL	ShowButton(10,200,'Locus')($LSegm)[blue,hidden];
$HBSL	HideButton(55,200,'Hide')($LSegm)[blue,hidden];
$SBAS	ShowButton(0,160,'SEGMENT')($PtSt,$PtEnd,$Segm,$ABS,$SBSL,$HBSL)[magenta,hidden];
$HBAS	HideButton(75,160,'Hide')($PtSt,$PtEnd,$Segm,$ABS,$SBSL,$HBSL)[magenta,hidden];
$HBA	HideButton(130,65,'HIDE')($SBAC,$HBAC,$SBAS,$HBAS,$Centpt,$Cpt,$Circ,$ABC,$SBCL,$HBCL,$PtSt,$PtEnd,$Segm,$ABS,$SBSL,$HBSL)[black,hidden];
	ShowButton( 0,65,'A N I M A T I O N S')($HBA,$SBAC,$HBAC,$SBAS,$HBAS)[black];
Martti.Pesonen@Joensuu.Fi 
2003, 2008