3 May 2010
There are various ways of getting help in Sage.
Click the link Help at the top-right of this page. This will bring up documentation for the notebook interface, as well as links to the reference manual.
{{{id=175| /// }}} {{{id=1| /// }}}Start typing something and press the TAB key. The interface tries to complete it with a command name. If there is more than one completion, then they are all presented to you.
{{{id=174| /// }}} {{{id=55| /// }}}
To see documentation and examples for a command, type ? at then end of the command name and press the TAB key.? : documentation and examples
Exercise A: What is the largest prime factor of 600851475143?
{{{id=46| /// }}} {{{id=44| /// }}}Exercise B: Create the Permutation 51324 and assign it to the variable p.
Exercise C: Use the matrix command to create the following matrix.
$$M = \left(\begin{array}{rrrr}
10 & 4 & 1 & 1 \\
4 & 6 & 5 & 1 \\
1 & 5 & 6 & 4 \\
1 & 1 & 4 & 10
\end{array}\right)$$
NOTE: Vectors in Sage are row vectors. A command such as eigenspaces might not return what you expect, so it is best to specify eigenspaces_left or eigenspaces_right instead. Same thing for kernel (left_kernel or right_kernel), and so on.
The plot command allows you to draw plots of functions. Type plot(<tab key> for the documentation (or look in the reference manual). Here is a simple example.
{{{id=155| var('x') # make sure x is a symbolic variable plot(sin(x^2), (x,0,10)) ///Here is a more complicated plot. Try to change every single input to the plot command in some way, evaluating to see what happens.
{{{id=157| P = plot(sin(x^2), (x,-2,2), rgbcolor=(0.8,0,0.2), thickness=3, linestyle='--', fill='axis') show(P, gridlines=True) ///Above we used the show command to show a plot after it was created. Try putting the cursor right after P.show( and pressing tab to get a list of the options for how you can change the values of the given inputs.
{{{id=156| /// }}} {{{id=70| /// }}}Plotting multiple functions at once is as easy as adding them together.
{{{id=168| P1 = plot(sin(x), (x,0,2*pi)) P2 = plot(cos(x), (x,0,2*pi), rgbcolor='red') P1 + P2 ///Here is an example of a symbolic function.
{{{id=160| f(x) = x^4 - 8*x^2 - 3*x + 2 /// }}} {{{id=172| f(x) /// x^4 - 8*x^2 - 3*x + 2 }}} {{{id=158| f(-3) /// 20 }}} {{{id=173| /// }}}Exercise D:
Exercise E (Advanced):