<?xml version="1.0" encoding="iso-8859-1" ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" 
"http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd" > 
<?xml-stylesheet type="text/css" href="fcla-xml-2.02.css"?> 
<html  
xmlns="http://www.w3.org/1999/xhtml"  
><head><title>Section SAGE  SAGE: Open Source Mathematics Software</title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" /> 
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" /> 
<!-- xhtml,mozilla,3,html --> 
<meta name="src" content="fcla-xml-2.02.tex" /> 
<meta name="date" content="2008-11-19 19:08:00" /> 
<link rel="stylesheet" type="text/css" href="fcla-xml-2.02.css" /> 
</head><body 
>
   <!--l. 62--><div class="crosslinks"><p class="noindent">[<a 
href="fcla-xml-2.02li66.xml" >prev</a>] [<a 
href="fcla-xml-2.02li66.xml#tailfcla-xml-2.02li66.xml" >prev-tail</a>] [<a 
href="#tailfcla-xml-2.02li67.xml">tail</a>] [<a 
href="fcla-xml-2.02li63.xml#fcla-xml-2.02li67.xml" >up</a>] </p></div>
   <h3 class="likesectionHead"><a 
 id="x68-342000"></a>Section SAGE&#x00A0;&#x00A0;SAGE: Open Source Mathematics Software</h3>
<!--l. 62--><p class="noindent" ><a 
 id="section.SAGE"></a> From <a 
href="http://linear.ups.edu/" ><span 
class="cmti-12">A First Course in Linear Algebra</span></a><br 
class="newline" />Version 2.02<br 
class="newline" /><span 
class="cmsy-10x-x-120">&#x00A9;</span>&#x00A0;2004.<br 
class="newline" />Licensed under the <a 
href="http://www.gnu.org/licenses/fdl.html" >GNU Free Documentation License</a>.<br 
class="newline" /><a 
href="http://linear.ups.edu/" class="url" ><span 
class="cmtt-12">http://linear.ups.edu/</span></a><br 
class="newline" /><br 
class="newline" /><a 
 id="x68-342000doc"></a> <a 
 id="dx68-342001"></a>
</p>
   <h4 class="likesubsectionHead"><a 
 id="x68-343000"></a>Computation Note R.SAGE: Rings</h4>
<!--l. 62--><p class="noindent" ><a 
 id="computation.R.SAGE"></a> <a 
 id="x68-343000doc"></a><a 
 id="dx68-343001"></a> <a 
 id="dx68-343002"></a><a 
 id="dx68-343003"></a> Contributed&#x00A0;by&#x00A0;<a 
href="fcla-xml-2.02li6.xml#CanfieldSteve">Steve&#x00A0;Canfield</a> <br 
class="newline" />SAGE uses different rings to denote the type of an object. The rings are as
follows:<br 
class="newline" />
                                                                          

                                                                          
</p><!--tex4ht:inline--><!--l. 17--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mtable 
columnalign="left" class="align-star">
                     <mtr><mtd 
columnalign="right" class="align-odd"></mtd>                     <mtd 
class="align-even"><!--mstyle 
class="text"--><mtext  >&#x00A0;ZZ:&#x00A0;The&#x00A0;set&#x00A0;of&#x00A0;integers</mtext><!--/mstyle--><mspace width="2em"/></mtd>                               <mtd 
columnalign="right" class="align-label"></mtd>                     <mtd 
class="align-label">
                     <mspace width="2em"/></mtd></mtr><mtr><mtd 
columnalign="right" class="align-odd"></mtd>                     <mtd 
class="align-even"><!--mstyle 
class="text"--><mtext  >&#x00A0;QQ:&#x00A0;The&#x00A0;set&#x00A0;of&#x00A0;rational&#x00A0;numbers</mtext><!--/mstyle--><mspace width="2em"/></mtd>                     <mtd 
columnalign="right" class="align-label"></mtd>                     <mtd 
class="align-label">
                     <mspace width="2em"/></mtd></mtr><mtr><mtd 
columnalign="right" class="align-odd"></mtd>                     <mtd 
class="align-even"><!--mstyle 
class="text"--><mtext  >&#x00A0;RR:&#x00A0;The&#x00A0;real&#x00A0;numbers</mtext><!--/mstyle--><mspace width="2em"/></mtd>                               <mtd 
columnalign="right" class="align-label"></mtd>                     <mtd 
class="align-label">
                     <mspace width="2em"/></mtd></mtr><mtr><mtd 
columnalign="right" class="align-odd"></mtd>                     <mtd 
class="align-even"><!--mstyle 
class="text"--><mtext  >&#x00A0;CC:&#x00A0;The&#x00A0;complex&#x00A0;numbers</mtext><!--/mstyle--><mspace width="2em"/></mtd>                           <mtd 
columnalign="right" class="align-label"></mtd>                     <mtd 
class="align-label">
                     <mspace width="2em"/></mtd></mtr><mtr><mtd 
columnalign="right" class="align-odd"></mtd>                     <mtd 
class="align-even"><mspace width="2em"/></mtd>                                                      <mtd 
columnalign="right" class="align-label">
   </mtd></mtr></mtable></math>
<!--l. 18--><p class="noindent" >Most objects in SAGE will tell you which they are using with the  <span 
class="cmtt-12">base</span><span 
class="cmtt-12">_ring()</span>
command. Keep this in mind, especially when row reducing or factoring. Here&#x2019;s a
quick example of where you might go wrong.
</p><!--tex4ht:inline--><!--l. 28--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mtable 
columnalign="left" class="align-star">
                         <mtr><mtd 
columnalign="right" class="align-odd"></mtd>                         <mtd 
class="align-even"><mi 
>m</mi> <mo 
class="MathClass-rel">=</mo> <mi 
>m</mi><mi 
>a</mi><mi 
>t</mi><mi 
>r</mi><mi 
>i</mi><mi 
>x</mi><mrow ><mo 
class="MathClass-open">(</mo><mrow><mrow ><mo 
class="MathClass-open">[</mo><mrow><mrow ><mo 
class="MathClass-open">[</mo><mrow><mn>2</mn><mo 
class="MathClass-punc">,</mo> <mn>3</mn></mrow><mo 
class="MathClass-close">]</mo></mrow><mo 
class="MathClass-punc">,</mo> <mrow ><mo 
class="MathClass-open">[</mo><mrow><mn>4</mn><mo 
class="MathClass-punc">,</mo> <mn>7</mn></mrow><mo 
class="MathClass-close">]</mo></mrow></mrow><mo 
class="MathClass-close">]</mo></mrow></mrow><mo 
class="MathClass-close">)</mo></mrow><mspace width="2em"/></mtd>                                                                         <mtd 
columnalign="right" class="align-label"></mtd>                         <mtd 
class="align-label">
                         <mspace width="2em"/></mtd></mtr><mtr><mtd 
columnalign="right" class="align-odd"></mtd>                         <mtd 
class="align-even"><mi 
>m</mi><mo 
class="MathClass-punc">.</mo><mi 
>b</mi><mi 
>a</mi><mi 
>s</mi><mi 
>e</mi><!--mstyle 
class="text"--><mtext  >&#x00A0;_</mtext><!--/mstyle--><mi 
>r</mi><mi 
>i</mi><mi 
>n</mi><mi 
>g</mi><mrow ><mo 
class="MathClass-open">(</mo><mrow></mrow><mo 
class="MathClass-close">)</mo></mrow><mspace width="2em"/></mtd>                                                                                   <mtd 
columnalign="right" class="align-label"></mtd>                         <mtd 
class="align-label">
                         <mspace width="2em"/></mtd></mtr><mtr><mtd 
columnalign="right" class="align-odd"></mtd>                         <mtd 
class="align-even"><mi 
>I</mi><mi 
>n</mi><mi 
>t</mi><mi 
>e</mi><mi 
>g</mi><mi 
>e</mi><mi 
>r</mi><mi 
>R</mi><mi 
>i</mi><mi 
>n</mi><mi 
>g</mi><mspace width="2em"/></mtd>                                                                                      <mtd 
columnalign="right" class="align-label"></mtd>                         <mtd 
class="align-label">
                         <mspace width="2em"/></mtd></mtr><mtr><mtd 
columnalign="right" class="align-odd"></mtd>                         <mtd 
class="align-even"><mi 
>m</mi><mo 
class="MathClass-punc">.</mo><mi 
>e</mi><mi 
>c</mi><mi 
>h</mi><mi 
>e</mi><mi 
>l</mi><mi 
>o</mi><mi 
>n</mi><!--mstyle 
class="text"--><mtext  >&#x00A0;_</mtext><!--/mstyle--><mi 
>f</mi><mi 
>o</mi><mi 
>r</mi><mi 
>m</mi><mrow ><mo 
class="MathClass-open">(</mo><mrow></mrow><mo 
class="MathClass-close">)</mo></mrow><mspace width="2em"/></mtd>                                                                               <mtd 
columnalign="right" class="align-label"></mtd>                         <mtd 
class="align-label">
                         <mspace width="2em"/></mtd></mtr><mtr><mtd 
columnalign="right" class="align-odd"></mtd>                         <mtd 
class="align-even"> <mfenced separators="" 
open="["  close="]" ><mrow><mtable  style="text-align:axis"  
equalrows="false" equalcolumns="false" class="array"><mtr><mtd 
class="array"  columnalign="center"><mn>2</mn></mtd><mtd 
class="array"  columnalign="center"><mn>0</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="center"> <mn>0</mn> </mtd><mtd 
class="array"  columnalign="center"><mn>1</mn></mtd></mtr> <!--*\c@MaxMatrixCols c--></mtable>                                                                                              </mrow></mfenced> <mspace width="2em"/></mtd>                         <mtd 
columnalign="right" class="align-label"></mtd>                         <mtd 
class="align-label">
   <mspace width="2em"/></mtd></mtr></mtable></math>
<!--l. 29--><p class="noindent" >As you can clearly see,  <span 
class="cmtt-12">m </span>isn&#x2019;t even in reduced row-echelon form. This is because
<span 
class="cmtt-12">m </span>is defined over the ZZ. You have to create matrices with the correct ring or you
will get this type of odd result. This problem comes up in more places than just
calculating the reduced row-echelon form, so unless you are specifically working
                                                                          

                                                                          
with integers take note.
</p>
   <h4 class="likesubsectionHead"><a 
 id="x68-344000"></a>Computation Note ME.SAGE: Matrix Entry</h4>
<!--l. 62--><p class="noindent" ><a 
 id="computation.ME.SAGE"></a> <a 
 id="x68-344000doc"></a><a 
 id="dx68-344001"></a> <a 
 id="dx68-344002"></a><a 
 id="dx68-344003"></a> Contributed&#x00A0;by&#x00A0;<a 
href="fcla-xml-2.02li6.xml#CanfieldSteve">Steve&#x00A0;Canfield</a> <br 
class="newline" />A matrix in <span 
class="cmsl-12">SAGE </span>can be made a few ways. The first is simply
to define the matrix as an array of rows. <span 
class="cmsl-12">SAGE </span>uses brackets
(<!--l. 11--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" > <mfenced separators="" 
open="["  close="" ><mrow></mrow></mfenced></math>&#x00A0;,&#x00A0;<!--l. 11--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" > <mfenced separators="" 
open=""  close="]" ><mrow></mrow></mfenced></math>)
to delimit arrays. So the input
</p><!--tex4ht:inline--><!--l. 14--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mtable 
columnalign="left" class="align-star">
              <mtr><mtd 
columnalign="right" class="align-odd"><mi 
>a</mi> <mo 
class="MathClass-rel">=</mo> <mi 
>m</mi><mi 
>a</mi><mi 
>t</mi><mi 
>r</mi><mi 
>i</mi><mi 
>x</mi><mrow ><mo 
class="MathClass-open">(</mo><mrow><mrow ><mo 
class="MathClass-open">[</mo><mrow><mrow ><mo 
class="MathClass-open">[</mo><mrow><mn>1</mn><mo 
class="MathClass-punc">,</mo> <mn>2</mn><mo 
class="MathClass-punc">,</mo> <mn>3</mn><mo 
class="MathClass-punc">,</mo> <mn>4</mn></mrow><mo 
class="MathClass-close">]</mo></mrow><mo 
class="MathClass-punc">,</mo> <mrow ><mo 
class="MathClass-open">[</mo><mrow><mn>5</mn><mo 
class="MathClass-punc">,</mo> <mn>6</mn><mo 
class="MathClass-punc">,</mo> <mn>7</mn><mo 
class="MathClass-punc">,</mo> <mn>8</mn></mrow><mo 
class="MathClass-close">]</mo></mrow><mo 
class="MathClass-punc">,</mo> <mrow ><mo 
class="MathClass-open">[</mo><mrow><mn>9</mn><mo 
class="MathClass-punc">,</mo> <mn>1</mn><mn>0</mn><mo 
class="MathClass-punc">,</mo> <mn>1</mn><mn>1</mn><mo 
class="MathClass-punc">,</mo> <mn>1</mn><mn>2</mn></mrow><mo 
class="MathClass-close">]</mo></mrow></mrow><mo 
class="MathClass-close">]</mo></mrow></mrow><mo 
class="MathClass-close">)</mo></mrow></mtd>              <mtd 
class="align-even"><mspace width="2em"/></mtd>              <mtd 
columnalign="right" class="align-label">
   </mtd></mtr></mtable></math>
<!--l. 16--><p class="noindent" >would create a <!--l. 16--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mn>3</mn> <mo 
class="MathClass-bin">&#x00D7;</mo> <mn>4</mn></math>
matrix named  <span 
class="cmtt-12">a </span>that is equal to </p><table class="equation-star"><tr><td>
                                                                          

                                                                          
<!--l. 18--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="equation">
 <mfenced separators="" 
open="["  close="]" ><mrow><mtable  style="text-align:axis"  
equalrows="false" equalcolumns="false" class="array"><mtr><mtd 
class="array"  columnalign="center"><mn>1</mn></mtd><mtd 
class="array"  columnalign="center"> <mn>2</mn> </mtd><mtd 
class="array"  columnalign="center"> <mn>3</mn> </mtd><mtd 
class="array"  columnalign="center"> <mn>4</mn> </mtd>
</mtr><mtr><mtd 
class="array"  columnalign="center"> <mn>5</mn> </mtd><mtd 
class="array"  columnalign="center"> <mn>6</mn> </mtd><mtd 
class="array"  columnalign="center"> <mn>7</mn> </mtd><mtd 
class="array"  columnalign="center"> <mn>8</mn> </mtd>
</mtr><mtr><mtd 
class="array"  columnalign="center"> <mn>9</mn> </mtd><mtd 
class="array"  columnalign="center"><mn>1</mn><mn>0</mn></mtd><mtd 
class="array"  columnalign="center"><mn>1</mn><mn>1</mn></mtd><mtd 
class="array"  columnalign="center"><mn>1</mn><mn>2</mn></mtd></mtr> <!--*\c@MaxMatrixCols c--></mtable>                                                                                       </mrow></mfenced>
</math></td></tr></table>
<!--l. 28--><p class="indent" >   <span 
class="cmsl-12">SAGE </span>will guess what type of matrix you are working with based on the inputs. If all
the entries are integers, you will get back an integer matrix. If your matrix contains an
entry in the <!--l. 28--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><msup><mrow 
><mi 
>&#x211D;</mi></mrow><mrow 
></mrow></msup 
></math>
or <!--l. 28--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mi 
>&#x2102;</mi></math>space,
the matrix will be of those types. This can cause problems as integers cannot
become fractions, which is an issue when calculating reduced row-echelon form.
We therefore recommend using the following construction to make your matrices,
</p><table class="equation-star"><tr><td>
<!--l. 30--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="equation">
            <mi 
>a</mi> <mo 
class="MathClass-rel">=</mo> <mi 
>m</mi><mi 
>a</mi><mi 
>t</mi><mi 
>r</mi><mi 
>i</mi><mi 
>x</mi><mrow ><mo 
class="MathClass-open">(</mo><mrow><mi 
>Q</mi><mi 
>Q</mi><mo 
class="MathClass-punc">,</mo> <mrow ><mo 
class="MathClass-open">[</mo><mrow><mrow ><mo 
class="MathClass-open">[</mo><mrow><mn>1</mn><mo 
class="MathClass-punc">,</mo> <mn>2</mn><mo 
class="MathClass-punc">,</mo> <mn>3</mn><mo 
class="MathClass-punc">,</mo> <mn>4</mn></mrow><mo 
class="MathClass-close">]</mo></mrow><mo 
class="MathClass-punc">,</mo> <mrow ><mo 
class="MathClass-open">[</mo><mrow><mn>5</mn><mo 
class="MathClass-punc">,</mo> <mn>6</mn><mo 
class="MathClass-punc">,</mo> <mn>7</mn><mo 
class="MathClass-punc">,</mo> <mn>8</mn></mrow><mo 
class="MathClass-close">]</mo></mrow><mo 
class="MathClass-punc">,</mo> <mrow ><mo 
class="MathClass-open">[</mo><mrow><mn>9</mn><mo 
class="MathClass-punc">,</mo> <mn>1</mn><mn>0</mn><mo 
class="MathClass-punc">,</mo> <mn>1</mn><mn>1</mn><mo 
class="MathClass-punc">,</mo> <mn>1</mn><mn>2</mn></mrow><mo 
class="MathClass-close">]</mo></mrow></mrow><mo 
class="MathClass-close">]</mo></mrow></mrow><mo 
class="MathClass-close">)</mo></mrow>
</math></td></tr></table>
<!--l. 34--><p class="indent" >   This gives you a matrix over the rational numbers which will be sufficient for
most of the course. If your matrix has entries that are complex numbers you
would replace the  <span 
class="cmtt-12">QQ </span>with  <span 
class="cmtt-12">CC </span>.<br 
class="newline" />To display a matrix named  <span 
class="cmtt-12">a </span>, type  <span 
class="cmtt-12">a </span>, and the output will be displayed with
rows and columns. If you type  <span 
class="cmtt-12">latex(a) </span>you will get <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span 
class="E">E</span>X</span></span>&#x00A0;code to display
the matrix. Very handy.
</p>
   <h4 class="likesubsectionHead"><a 
 id="x68-345000"></a>Computation Note RR.SAGE: Row Reduce</h4>
                                                                          

                                                                          
<!--l. 62--><p class="noindent" ><a 
 id="computation.RR.SAGE"></a> <a 
 id="x68-345000doc"></a><a 
 id="dx68-345001"></a> <a 
 id="dx68-345002"></a><a 
 id="dx68-345003"></a> Contributed&#x00A0;by&#x00A0;<a 
href="fcla-xml-2.02li6.xml#CanfieldSteve">Steve&#x00A0;Canfield</a>&#x00A0;and <a 
href="fcla-xml-2.02li6.xml#BeezerRobert">Robert&#x00A0;Beezer</a> <br 
class="newline" />Row-reducing a matrix is a simple operation in SAGE. However, because of Sage&#x2019;s
flexibility with different types of numbers (integers, rationals, reals, complexes),
we need to be a bit more careful.
</p><!--l. 13--><p class="indent" >   If  <span 
class="cmtt-12">a </span>is a matrix entered in in SAGE (see <a 
href="#computation.ME.SAGE">Computation&#x00A0;ME.SAGE</a>) then
<span 
class="cmtt-12">a.echelon</span><span 
class="cmtt-12">_form() </span>will return a new matrix that is the reduced row-echelon form
of  <span 
class="cmtt-12">a </span>(<a 
href="fcla-xml-2.02li18.xml#definition.RREF">Definition&#x00A0;RREF</a>).
</p><!--l. 15--><p class="indent" >   If your matrix has only integer entries (as is the case with many examples and
exercises in this book), then row operations might introduce rational
numbers (&#x201C;fractions&#x201D;). So when you enter your matrix, you need to tell
SAGE that rational numbers are allowable in its calculations. This is the
advice in <a 
href="#computation.R.SAGE">Computation&#x00A0;R.SAGE</a> to use the ring  <span 
class="cmtt-12">QQ </span>. As an illustration
create
</p><!--tex4ht:inline--><!--l. 19--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mtable 
columnalign="left" class="align-star">
            <mtr><mtd 
columnalign="right" class="align-odd"><mi 
>a</mi> <mo 
class="MathClass-rel">=</mo> <mi 
>m</mi><mi 
>a</mi><mi 
>t</mi><mi 
>r</mi><mi 
>i</mi><mi 
>x</mi><mrow ><mo 
class="MathClass-open">(</mo><mrow><mi 
>Q</mi><mi 
>Q</mi><mo 
class="MathClass-punc">,</mo> <mrow ><mo 
class="MathClass-open">[</mo><mrow><mrow ><mo 
class="MathClass-open">[</mo><mrow><mn>1</mn><mo 
class="MathClass-punc">,</mo> <mn>2</mn><mo 
class="MathClass-punc">,</mo> <mn>3</mn><mo 
class="MathClass-punc">,</mo> <mn>4</mn></mrow><mo 
class="MathClass-close">]</mo></mrow><mo 
class="MathClass-punc">,</mo> <mrow ><mo 
class="MathClass-open">[</mo><mrow><mn>5</mn><mo 
class="MathClass-punc">,</mo> <mn>6</mn><mo 
class="MathClass-punc">,</mo> <mn>7</mn><mo 
class="MathClass-punc">,</mo> <mn>8</mn></mrow><mo 
class="MathClass-close">]</mo></mrow><mo 
class="MathClass-punc">,</mo> <mrow ><mo 
class="MathClass-open">[</mo><mrow><mn>9</mn><mo 
class="MathClass-punc">,</mo> <mn>1</mn><mn>0</mn><mo 
class="MathClass-punc">,</mo> <mn>1</mn><mn>1</mn><mo 
class="MathClass-punc">,</mo> <mn>1</mn><mn>2</mn></mrow><mo 
class="MathClass-close">]</mo></mrow></mrow><mo 
class="MathClass-close">]</mo></mrow></mrow><mo 
class="MathClass-close">)</mo></mrow></mtd>            <mtd 
class="align-even"><mspace width="2em"/></mtd>            <mtd 
columnalign="right" class="align-label">
   </mtd></mtr></mtable></math>
<!--l. 21--><p class="noindent" >and issue the command  <span 
class="cmtt-12">a.echelon</span><span 
class="cmtt-12">_form() </span>. The result is
                                                                          

                                                                          
</p><!--tex4ht:inline--><!--l. 29--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mtable 
columnalign="left" class="align-star">
                             <mtr><mtd 
columnalign="right" class="align-odd"> <mfenced separators="" 
open="["  close="]" ><mrow><mtable  style="text-align:axis"  
equalrows="false" equalcolumns="false" class="array"><mtr><mtd 
class="array"  columnalign="center"><mn>1</mn></mtd><mtd 
class="array"  columnalign="center"><mn>0</mn></mtd><mtd 
class="array"  columnalign="center"><mo 
class="MathClass-bin">&#x2212;</mo><mn>1</mn></mtd><mtd 
class="array"  columnalign="center"><mo 
class="MathClass-bin">&#x2212;</mo><mn>2</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="center"> <mn>0</mn> </mtd><mtd 
class="array"  columnalign="center"><mn>1</mn></mtd><mtd 
class="array"  columnalign="center"> <mn>2</mn> </mtd><mtd 
class="array"  columnalign="center"> <mn>3</mn> </mtd>
</mtr><mtr><mtd 
class="array"  columnalign="center"> <mn>0</mn> </mtd><mtd 
class="array"  columnalign="center"><mn>0</mn></mtd><mtd 
class="array"  columnalign="center"> <mn>0</mn> </mtd><mtd 
class="array"  columnalign="center"> <mn>0</mn> </mtd></mtr> <!--*\c@MaxMatrixCols c--></mtable>                                                                                       </mrow></mfenced> </mtd>                             <mtd 
class="align-even"><mspace width="2em"/></mtd>                             <mtd 
columnalign="right" class="align-label">
   </mtd></mtr></mtable></math>
<!--l. 31--><p class="noindent" >However, if we adjust the entry by neglecting to specify  <span 
class="cmtt-12">QQ </span>, then SAGE assumes
that we only want to work with integers, since every entry of the matrix is an
integer. So as an experiment, enter
</p><!--tex4ht:inline--><!--l. 35--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mtable 
columnalign="left" class="align-star">
              <mtr><mtd 
columnalign="right" class="align-odd"><mi 
>b</mi> <mo 
class="MathClass-rel">=</mo> <mi 
>m</mi><mi 
>a</mi><mi 
>t</mi><mi 
>r</mi><mi 
>i</mi><mi 
>x</mi><mrow ><mo 
class="MathClass-open">(</mo><mrow><mrow ><mo 
class="MathClass-open">[</mo><mrow><mrow ><mo 
class="MathClass-open">[</mo><mrow><mn>1</mn><mo 
class="MathClass-punc">,</mo> <mn>2</mn><mo 
class="MathClass-punc">,</mo> <mn>3</mn><mo 
class="MathClass-punc">,</mo> <mn>4</mn></mrow><mo 
class="MathClass-close">]</mo></mrow><mo 
class="MathClass-punc">,</mo> <mrow ><mo 
class="MathClass-open">[</mo><mrow><mn>5</mn><mo 
class="MathClass-punc">,</mo> <mn>6</mn><mo 
class="MathClass-punc">,</mo> <mn>7</mn><mo 
class="MathClass-punc">,</mo> <mn>8</mn></mrow><mo 
class="MathClass-close">]</mo></mrow><mo 
class="MathClass-punc">,</mo> <mrow ><mo 
class="MathClass-open">[</mo><mrow><mn>9</mn><mo 
class="MathClass-punc">,</mo> <mn>1</mn><mn>0</mn><mo 
class="MathClass-punc">,</mo> <mn>1</mn><mn>1</mn><mo 
class="MathClass-punc">,</mo> <mn>1</mn><mn>2</mn></mrow><mo 
class="MathClass-close">]</mo></mrow></mrow><mo 
class="MathClass-close">]</mo></mrow></mrow><mo 
class="MathClass-close">)</mo></mrow></mtd>              <mtd 
class="align-even"><mspace width="2em"/></mtd>              <mtd 
columnalign="right" class="align-label">
   </mtd></mtr></mtable></math>
<!--l. 37--><p class="noindent" >and issue the command  <span 
class="cmtt-12">b.echelon</span><span 
class="cmtt-12">_form() </span>. The result is
                                                                          

                                                                          
</p><!--tex4ht:inline--><!--l. 45--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mtable 
columnalign="left" class="align-star">
                              <mtr><mtd 
columnalign="right" class="align-odd"> <mfenced separators="" 
open="["  close="]" ><mrow><mtable  style="text-align:axis"  
equalrows="false" equalcolumns="false" class="array"><mtr><mtd 
class="array"  columnalign="center"><mn>1</mn></mtd><mtd 
class="array"  columnalign="center"><mn>2</mn></mtd><mtd 
class="array"  columnalign="center"><mn>3</mn></mtd><mtd 
class="array"  columnalign="center"> <mn>4</mn> </mtd>
</mtr><mtr><mtd 
class="array"  columnalign="center"> <mn>0</mn> </mtd><mtd 
class="array"  columnalign="center"><mn>4</mn></mtd><mtd 
class="array"  columnalign="center"><mn>8</mn></mtd><mtd 
class="array"  columnalign="center"><mn>1</mn><mn>2</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="center"> <mn>0</mn> </mtd><mtd 
class="array"  columnalign="center"><mn>0</mn></mtd><mtd 
class="array"  columnalign="center"><mn>0</mn></mtd><mtd 
class="array"  columnalign="center"> <mn>0</mn> </mtd></mtr> <!--*\c@MaxMatrixCols c--></mtable>                                                                                          </mrow></mfenced> </mtd>                              <mtd 
class="align-even"><mspace width="2em"/></mtd>                              <mtd 
columnalign="right" class="align-label">
   </mtd></mtr></mtable></math>
<!--l. 47--><p class="noindent" >You can now clearly see Sage&#x2019;s reluctance to multiply row 2 by
<!--l. 47--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mfrac><mrow 
><mn>1</mn></mrow>
<mrow 
><mn>4</mn></mrow></mfrac></math>.
</p><!--l. 49--><p class="indent" >   The ring  <span 
class="cmtt-12">QQ </span>will of course suffice if your matrix has rational numbers for entries.
Decimal entries are another place to be careful. If an entry of your matrix is the real number
<!--l. 49--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mn>2</mn><mo 
class="MathClass-punc">.</mo><mn>1</mn><mn>7</mn></math>, you are free to enter it
as the rational number <!--l. 49--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mfrac><mrow 
><mn>2</mn><mn>1</mn><mn>7</mn></mrow>
<mrow 
><mn>1</mn><mn>0</mn><mn>0</mn></mrow></mfrac></math>
and keep the ring  <span 
class="cmtt-12">QQ </span>in the specification of your matrix. If you want to consider
your entries as real numbers, then you might as well just specify your ring as the
complex numbers  <span 
class="cmtt-12">CC </span>. This advice also applies if you have complex numbers as
entries.
</p><!--l. 51--><p class="indent" >   If you allow SAGE to work with real or complex numbers, then the
problem of round-off error becomes relevant. Computer arithmetic
with real numbers is, of necessity, subject to minor inaccuracies and
errors. This becomes problematic when row-reducing a matrix. If a
zero entry is computed instead as an extremely small number, such as
<!--l. 51--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mn>1</mn><mo 
class="MathClass-punc">.</mo><mn>2</mn><mn>8</mn><mn>7</mn> <mo 
class="MathClass-bin">&#x00D7;</mo> <mn>1</mn><msup><mrow 
><mn>0</mn></mrow><mrow 
><mo 
class="MathClass-bin">&#x2212;</mo><mn>1</mn><mn>8</mn></mrow></msup 
></math>, then
an incorrect sequence of row operations will follow (with further incorrect
results). So if you use  <span 
class="cmtt-12">CC </span>be on the lookout for these kinds of potential
pitfalls.
</p><!--l. 53--><p class="indent" >   So, in summary, remember to always specify the ring you will be using for your
matrices, and most matrices can be handled with a choice of  <span 
class="cmtt-12">QQ </span>or  <span 
class="cmtt-12">CC</span>
.
</p><!--l. 55--><p class="indent" >   When you need to do significant scientific computing with SAGE, there are
extra facilities that will help you work with these subtleties.
</p><!--l. 57--><p class="indent" >   Finally, you can also use a command of the form  <span 
class="cmtt-12">a.echelonize() </span>to replace
<span 
class="cmtt-12">a </span>with its reduced row-echelon form.
</p>
   <h4 class="likesubsectionHead"><a 
 id="x68-346000"></a>Computation Note LS.SAGE: Linear Solve</h4>
                                                                          

                                                                          
<!--l. 62--><p class="noindent" ><a 
 id="computation.LS.SAGE"></a>  <a 
 id="x68-346000doc"></a><a 
 id="dx68-346001"></a> <a 
 id="dx68-346002"></a><a 
 id="dx68-346003"></a><span 
class="cmsl-12">SAGE </span>can solve a variety of systems of equations with the  <span 
class="cmtt-12">solve( )</span>
command, even when the equations are not linear (see <a 
href="fcla-xml-2.02li17.xml#exercise.SSLE.M70">Exercise&#x00A0;SSLE.M70</a>). But
we can afford to specialize here to just linear systems. First, you must
specify your variables in advance, so for example,  <span 
class="cmtt-12">var(&#x2019;x1,x2,x3&#x2019;)</span>
might precede a system with three equations. Equations are then written
just as you might expect, except that equality is written as  <span 
class="cmtt-12">== </span>, since
computer programs have traditionally reserved  <span 
class="cmtt-12">= </span>to assign values to
variables. And remember to use a  <span 
class="cmtt-12">* </span>to indicate that a coefficient multiplies a
variable.
</p><!--l. 12--><p class="indent" >   The example below illustrates the use of the command and the possibilities for
results. Each system would be preceded by establishing the variables with the
command  <span 
class="cmtt-12">var(&#x2019;x,y&#x2019;) </span>. In the case of an infinite solution set, free variables are
denoted as  <span 
class="cmtt-12">rx </span>where  <span 
class="cmtt-12">x </span>is an integer that increases throughout a session. The
style of this description of a solution set is reminiscent of the style we used in
<a 
href="fcla-xml-2.02li15.xml#chapter.SLE">Chapter&#x00A0;SLE</a> before we were accustomed to using linear combinations of vectors
(<a 
href="fcla-xml-2.02li24.xml#theorem.VFSLS">Theorem&#x00A0;VFSLS</a>). </p>
<div class="center" 
>
<!--l. 14--><p class="noindent" >
</p>
<div class="tabular"> <table id="TBL-3973" class="tabular" 
cellspacing="0" cellpadding="0"  
><colgroup id="TBL-3973-1g"><col 
id="TBL-3973-1" /><col 
id="TBL-3973-2" /><col 
id="TBL-3973-3" /></colgroup><tr  
 style="vertical-align:baseline;" id="TBL-3973-1-"><td  style="text-align:center; white-space:nowrap;" id="TBL-3973-1-1"  
class="td11">               <div class="multicolumn"  style="text-align:center; white-space:nowrap;">System</div>                  </td><td  style="text-align:center; white-space:nowrap;" id="TBL-3973-1-2"  
class="td11"><div class="multicolumn"  style="text-align:center; white-space:nowrap;">Solution Set</div></td><td  style="text-align:center; white-space:nowrap;" id="TBL-3973-1-3"  
class="td11">            <div class="multicolumn"  style="text-align:center; white-space:nowrap;">Result</div>
</td></tr><tr  
 style="vertical-align:baseline;" id="TBL-3973-2-"><td  style="text-align:left; white-space:nowrap;" id="TBL-3973-2-1"  
class="td11"><span 
class="cmtt-12">solve([2*x+y==5, 3*x+2*y==15], x, y) </span></td><td  style="text-align:center; white-space:nowrap;" id="TBL-3973-2-2"  
class="td11">  Unique   </td><td  style="text-align:left; white-space:nowrap;" id="TBL-3973-2-3"  
class="td11"><span 
class="cmtt-12">[[x == -5, y == 15]]         </span></td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-3973-3-"><td  style="text-align:left; white-space:nowrap;" id="TBL-3973-3-1"  
class="td11"><span 
class="cmtt-12">solve([2*x+y==5, 6*x+3*y==15], x, y) </span></td><td  style="text-align:center; white-space:nowrap;" id="TBL-3973-3-2"  
class="td11">  Infinite   </td><td  style="text-align:left; white-space:nowrap;" id="TBL-3973-3-3"  
class="td11"><span 
class="cmtt-12">[[x == (5 - r1)/2, y == r1]] </span></td>
</tr><tr  
 style="vertical-align:baseline;" id="TBL-3973-4-"><td  style="text-align:left; white-space:nowrap;" id="TBL-3973-4-1"  
class="td11"><span 
class="cmtt-12">solve([2*x+y==5, 6*x+3*y==10], x, y) </span></td><td  style="text-align:center; white-space:nowrap;" id="TBL-3973-4-2"  
class="td11">  Empty    </td><td  style="text-align:left; white-space:nowrap;" id="TBL-3973-4-3"  
class="td11"><span 
class="cmtt-12">ValueError: Unable to solve</span><span 
class="cmtt-12">&#x2026; </span></td>
</tr></table></div></div>
<!--l. 25--><p class="noindent" >Notice how the output contains equations written a format that might be suitable as
input for further use within <span 
class="cmsl-12">SAGE</span>.
</p>
   <h4 class="likesubsectionHead"><a 
 id="x68-347000"></a>Computation Note VLC.SAGE: Vector Linear Combinations</h4>
<!--l. 62--><p class="noindent" ><a 
 id="computation.VLC.SAGE"></a> <a 
 id="x68-347000doc"></a><a 
 id="dx68-347001"></a> <a 
 id="dx68-347002"></a><a 
 id="dx68-347003"></a> Contributed&#x00A0;by&#x00A0;<a 
href="fcla-xml-2.02li6.xml#BeezerRobert">Robert&#x00A0;Beezer</a> <br 
class="newline" />Vectors in <span 
class="cmsl-12">SAGE </span>are constructed from lists, and are displayed horizontally. For
example, the vector </p><table class="equation-star"><tr><td>
                                                                          

                                                                          
<!--l. 13--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="equation">
<mi 
>v</mi> <mo 
class="MathClass-rel">=</mo>  <mfenced separators="" 
open="["  close="]" ><mrow><mtable  style="text-align:axis"  
equalrows="false" equalcolumns="false" class="array"><mtr><mtd 
class="array"  columnalign="center"><mn>1</mn></mtd>
</mtr><mtr><mtd 
class="array"  columnalign="center"> <mn>2</mn> </mtd>
</mtr><mtr><mtd 
class="array"  columnalign="center"> <mn>3</mn> </mtd>
</mtr><mtr><mtd 
class="array"  columnalign="center"> <mn>4</mn> </mtd></mtr>  <!--*\c@MaxMatrixCols c--></mtable>                                                                                              </mrow></mfenced>
</math></td></tr></table>
<!--l. 17--><p class="indent" >   would be entered and named via the command </p><table class="equation-star"><tr><td>
<!--l. 19--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="equation">
                        <mi 
>v</mi> <mo 
class="MathClass-rel">=</mo> <mi 
>v</mi><mi 
>e</mi><mi 
>c</mi><mi 
>t</mi><mi 
>o</mi><mi 
>r</mi><mrow ><mo 
class="MathClass-open">(</mo><mrow><mi 
>Q</mi><mi 
>Q</mi><mo 
class="MathClass-punc">,</mo> <mrow ><mo 
class="MathClass-open">[</mo><mrow><mn>1</mn><mo 
class="MathClass-punc">,</mo><mspace width="0em" class="thinspace"/><mn>2</mn><mo 
class="MathClass-punc">,</mo><mspace width="0em" class="thinspace"/><mn>3</mn><mo 
class="MathClass-punc">,</mo><mspace width="0em" class="thinspace"/><mn>4</mn></mrow><mo 
class="MathClass-close">]</mo></mrow></mrow><mo 
class="MathClass-close">)</mo></mrow>
</math></td></tr></table>
<!--l. 23--><p class="indent" >   See the notes about rings (<a 
href="#computenote.R.SAGE">Computenote&#x00A0;R.SAGE</a>) and matrix entry
(<a 
href="#computenote.ME.SAGE">Computenote&#x00A0;ME.SAGE</a>) for reminders about specifying the relevant
ring.
</p><!--l. 25--><p class="indent" >   Vector addition and scalar multiplication are then very natural. If  <span 
class="cmtt-12">u </span>and  <span 
class="cmtt-12">v</span>
are two vectors of the same size, then </p><table class="equation-star"><tr><td>
                                                                          

                                                                          
<!--l. 27--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="equation">
                                <mn>2</mn><mi 
>u</mi> <mo 
class="MathClass-bin">+</mo> <mrow ><mo 
class="MathClass-open">(</mo><mrow><mo 
class="MathClass-bin">&#x2212;</mo><mn>3</mn></mrow><mo 
class="MathClass-close">)</mo></mrow><mi 
>v</mi>
</math></td></tr></table>
<!--l. 31--><p class="indent" >   will compute the correct vector. it can be assigned to a variable (which will
contain a vector), or be printed. If printed, it will be written horizontally with
parentheses for grouping. If  <span 
class="cmtt-12">u </span>and  <span 
class="cmtt-12">v </span>have different sizes, then <span 
class="cmsl-12">SAGE </span>will
complain about &#x201C;unsupported operand(s).&#x201D;
</p>
   <h4 class="likesubsectionHead"><a 
 id="x68-348000"></a>Computation Note MI.SAGE: Matrix Inverse</h4>
<!--l. 62--><p class="noindent" ><a 
 id="computation.MI.SAGE"></a> <a 
 id="x68-348000doc"></a><a 
 id="dx68-348001"></a> <a 
 id="dx68-348002"></a><a 
 id="dx68-348003"></a> Contributed&#x00A0;by&#x00A0;<a 
href="fcla-xml-2.02li6.xml#CanfieldSteve">Steve&#x00A0;Canfield</a> <br 
class="newline" />If <!--l. 11--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mi 
>a</mi></math> is a
matrix defined in <span 
class="cmsl-12">SAGE</span>, then  <span 
class="cmtt-12">a.inverse() </span>will return the inverse of
<!--l. 11--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mi 
>a</mi></math>, should it exist.
In the case where <!--l. 11--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mi 
>a</mi></math>
does not have an inverse <span 
class="cmsl-12">SAGE </span>will tell you the matrix must be nonsingular (see
<a 
href="fcla-xml-2.02li33.xml#theorem.NI">Theorem&#x00A0;NI</a>).
</p>
   <h4 class="likesubsectionHead"><a 
 id="x68-349000"></a>Computation Note TM.SAGE: Transpose of a Matrix</h4>
<!--l. 62--><p class="noindent" ><a 
 id="computation.TM.SAGE"></a> <a 
 id="x68-349000doc"></a><a 
 id="dx68-349001"></a> <a 
 id="dx68-349002"></a><a 
 id="dx68-349003"></a>Suppose  <span 
class="cmtt-12">a </span>is the name of a matrix stored in <span 
class="cmsl-12">SAGE</span>. Then  <span 
class="cmtt-12">a.transpose()</span>
will return the transpose of  <span 
class="cmtt-12">a </span>.
</p>
   <h4 class="likesubsectionHead"><a 
 id="x68-350000"></a>Computation Note E.SAGE: Eigenspaces</h4>
<!--l. 62--><p class="noindent" ><a 
 id="computation.E.SAGE"></a> <a 
 id="x68-350000doc"></a><a 
 id="dx68-350001"></a> <a 
 id="dx68-350002"></a><a 
 id="dx68-350003"></a> Contributed&#x00A0;by&#x00A0;<a 
href="fcla-xml-2.02li6.xml#CanfieldSteve">Steve&#x00A0;Canfield</a> <br 
class="newline" />SAGE can compute eigenspaces and eigenvalues for you. If you have a matrix
named  <span 
class="cmtt-12">a </span>and you type </p><table class="equation-star"><tr><td>
                                                                          

                                                                          
<!--l. 12--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" class="equation">
                              <mi 
>a</mi><mo 
class="MathClass-punc">.</mo><mi 
>e</mi><mi 
>i</mi><mi 
>g</mi><mi 
>e</mi><mi 
>n</mi><mi 
>s</mi><mi 
>p</mi><mi 
>a</mi><mi 
>c</mi><mi 
>e</mi><mi 
>s</mi><mrow ><mo 
class="MathClass-open">(</mo><mrow></mrow><mo 
class="MathClass-close">)</mo></mrow>
</math></td></tr></table>
<!--l. 15--><p class="indent" >   you will get a listing of the eigenvalues and the eigenspace for each. Let&#x2019;s do
an example. Your output may be formatted slightly different from what we have
here.
</p><!--tex4ht:inline--><!--l. 21--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mtable 
columnalign="left" class="align-star">
            <mtr><mtd 
columnalign="right" class="align-odd"></mtd>            <mtd 
class="align-even"><mi 
>m</mi> <mo 
class="MathClass-rel">=</mo> <mi 
>m</mi><mi 
>a</mi><mi 
>t</mi><mi 
>r</mi><mi 
>i</mi><mi 
>x</mi><mrow ><mo 
class="MathClass-open">(</mo><mrow><mi 
>Q</mi><mi 
>Q</mi><mo 
class="MathClass-punc">,</mo> <mrow ><mo 
class="MathClass-open">[</mo><mrow><mrow ><mo 
class="MathClass-open">[</mo><mrow><mo 
class="MathClass-bin">&#x2212;</mo><mn>1</mn><mn>3</mn><mo 
class="MathClass-punc">,</mo><mo 
class="MathClass-bin">&#x2212;</mo><mn>8</mn><mo 
class="MathClass-punc">,</mo><mo 
class="MathClass-bin">&#x2212;</mo><mn>4</mn></mrow><mo 
class="MathClass-close">]</mo></mrow><mo 
class="MathClass-punc">,</mo> <mrow ><mo 
class="MathClass-open">[</mo><mrow><mn>1</mn><mn>2</mn><mo 
class="MathClass-punc">,</mo> <mn>7</mn><mo 
class="MathClass-punc">,</mo> <mn>4</mn></mrow><mo 
class="MathClass-close">]</mo></mrow><mo 
class="MathClass-punc">,</mo> <mrow ><mo 
class="MathClass-open">[</mo><mrow><mn>2</mn><mn>4</mn><mo 
class="MathClass-punc">,</mo> <mn>1</mn><mn>6</mn><mo 
class="MathClass-punc">,</mo> <mn>7</mn></mrow><mo 
class="MathClass-close">]</mo></mrow></mrow><mo 
class="MathClass-close">]</mo></mrow></mrow><mo 
class="MathClass-close">)</mo></mrow><mspace width="2em"/></mtd>            <mtd 
columnalign="right" class="align-label"></mtd>            <mtd 
class="align-label">
            <mspace width="2em"/></mtd></mtr><mtr><mtd 
columnalign="right" class="align-odd"></mtd>            <mtd 
class="align-even"><mi 
>m</mi><mo 
class="MathClass-punc">.</mo><mi 
>e</mi><mi 
>i</mi><mi 
>g</mi><mi 
>e</mi><mi 
>n</mi><mi 
>s</mi><mi 
>p</mi><mi 
>a</mi><mi 
>c</mi><mi 
>e</mi><mi 
>s</mi><mrow ><mo 
class="MathClass-open">(</mo><mrow></mrow><mo 
class="MathClass-close">)</mo></mrow><mspace width="2em"/></mtd>                                               <mtd 
columnalign="right" class="align-label"></mtd>            <mtd 
class="align-label">
            <mspace width="2em"/></mtd></mtr><mtr><mtd 
columnalign="right" class="align-odd"></mtd>            <mtd 
class="align-even"><mrow ><mo 
class="MathClass-open">[</mo><mrow><mrow ><mo 
class="MathClass-open">(</mo><mrow><mn>3</mn><mo 
class="MathClass-punc">,</mo> <mrow ><mo 
class="MathClass-open">[</mo><mrow><mrow ><mo 
class="MathClass-open">(</mo><mrow><mn>1</mn><mo 
class="MathClass-punc">,</mo> <mn>2</mn><mo 
class="MathClass-bin">&#x2215;</mo><mn>3</mn><mo 
class="MathClass-punc">,</mo> <mn>1</mn><mo 
class="MathClass-bin">&#x2215;</mo><mn>3</mn></mrow><mo 
class="MathClass-close">)</mo></mrow></mrow><mo 
class="MathClass-close">]</mo></mrow></mrow><mo 
class="MathClass-close">)</mo></mrow><mo 
class="MathClass-punc">,</mo> <mrow ><mo 
class="MathClass-open">(</mo><mrow><mo 
class="MathClass-bin">&#x2212;</mo><mn>1</mn><mo 
class="MathClass-punc">,</mo> <mrow ><mo 
class="MathClass-open">[</mo><mrow><mrow ><mo 
class="MathClass-open">(</mo><mrow><mn>1</mn><mo 
class="MathClass-punc">,</mo> <mn>0</mn><mo 
class="MathClass-punc">,</mo> <mn>1</mn><mo 
class="MathClass-bin">&#x2215;</mo><mn>2</mn></mrow><mo 
class="MathClass-close">)</mo></mrow><mo 
class="MathClass-punc">,</mo> <mrow ><mo 
class="MathClass-open">(</mo><mrow><mn>0</mn><mo 
class="MathClass-punc">,</mo> <mn>1</mn><mo 
class="MathClass-punc">,</mo><mo 
class="MathClass-bin">&#x2212;</mo><mn>1</mn><mo 
class="MathClass-bin">&#x2215;</mo><mn>2</mn></mrow><mo 
class="MathClass-close">)</mo></mrow></mrow><mo 
class="MathClass-close">]</mo></mrow></mrow><mo 
class="MathClass-close">)</mo></mrow></mrow><mo 
class="MathClass-close">]</mo></mrow><mspace width="2em"/></mtd>               <mtd 
columnalign="right" class="align-label"></mtd>            <mtd 
class="align-label">
            <mspace width="2em"/></mtd></mtr><mtr><mtd 
columnalign="right" class="align-odd"></mtd>            <mtd 
class="align-even"><mspace width="2em"/></mtd>                                                               <mtd 
columnalign="right" class="align-label">
   </mtd></mtr></mtable></math>
<!--l. 23--><p class="noindent" >Whew, that looks like a mess. At the top level, eigenspaces() returns a
dictionary whose keys are the eigenvalues. So in this case we have
eigenvalues 3 and -1. Each eigenvalue has an array after it that forms
the basis of the eigenspace. In our example, there is 1 vector for
<!--l. 23--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mi 
>&#x03BB;</mi> <mo 
class="MathClass-rel">=</mo> <mn>3</mn></math> and 2
vectors for <!--l. 23--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mi 
>&#x03BB;</mi> <mo 
class="MathClass-rel">=</mo> <mo 
class="MathClass-bin">&#x2212;</mo><mn>1</mn></math>.
Finally, the vectors SAGE spits out may not be the nicest ones to work with. In
particular, we might want to scale the vectors to get rid of fractions.
                                                                          

                                                                          
                                                                          

                                                                          
</p>
   <!--l. 502--><div class="crosslinks"><p class="noindent">[<a 
href="fcla-xml-2.02li66.xml" >prev</a>] [<a 
href="fcla-xml-2.02li66.xml#tailfcla-xml-2.02li66.xml" >prev-tail</a>] [<a 
href="fcla-xml-2.02li67.xml" >front</a>] [<a 
href="fcla-xml-2.02li63.xml#fcla-xml-2.02li67.xml" >up</a>] </p></div>
<!--l. 502--><p class="indent" >   <a 
 id="tailfcla-xml-2.02li67.xml"></a>  </p> 
</body> 
</html> 
