Exercise: Let $f(x) = x^4 + x^3 - 13 x^2 - x + 12$. Define $f$ as a symbolic function.
{{{id=4| /// }}} {{{id=12| /// }}}
Exercise: Plot $f$ on the domain $-4.5 \leq x \leq 3.5$.
{{{id=13| /// }}} {{{id=10| /// }}}
Exercise: Find numerical approximations for the critical values of $f$ by taking the derivative of $f$ and using the find_root method. (Hint: plot the derivative.)
{{{id=15| /// }}} {{{id=40| /// }}} {{{id=43| /// }}} {{{id=42| /// }}} {{{id=37| /// }}}
Exercise: Find numerical approximations for the critical values of $f$ by taking the derivative of $f$ and using the roots(ring=RR) method. (Here, RR stands for the real numbers.) Are there any roots over the ring of rationals (QQ)?
{{{id=38| /// }}} {{{id=16| /// }}}Exercise: Compute the equation $y = mx +b$ of the tangent line to the function $f$ at the points $x=-1$ and $x=2$.
{{{id=7| /// }}} {{{id=6| /// }}}Exercise: Write a function that takes $x$ as an argument and returns the equation of the tangent line to $f$ through the point $x$.
{{{id=5| /// }}} {{{id=19| /// }}}
Exercise: Write a function that takes $x$ as an argument and plots $f$ together with the the tangent line to $f$ through the point $x$. Make the line red.
{{{id=20| /// }}} {{{id=21| /// }}}
Exercise: Convert the function you created above into an @interact object. Turn the argument $x$ into a slider. (Hint: see the documentation for interact for examples on creating sliders.)
{{{id=22| /// }}} {{{id=23| /// }}} {{{id=24| /// }}} {{{id=25| /// }}}To create a vector in Sage, use the vector command.
Exercise: Create the vector $x = (1, 2, \ldots, 100)$.
{{{id=18| /// }}} {{{id=119| /// }}}
Note: vectors in Sage are row vectors! |
Exercise: Create the vector $y = (1^2, 2^2, \ldots, 100^2)$.
{{{id=110| /// }}} {{{id=27| /// }}}Exercise: Type x. and hit tab to see the available methods for vectors. Find the norm (length) of the vectors x and y.
{{{id=112| /// }}} {{{id=111| /// }}}Exercise: Find the dot product of x and y.
{{{id=169| /// }}} {{{id=170| /// }}}[The above problems are essentially the first problem on Exercise Set 1 of William Stein's Math 480b.]
Exercise: Use the matrix command to create the following matrix over the rational numbers (hint: in Sage, QQ denotes the field of rational numbers).
$$\left(\begin{array}{rrrrrr}
3 & 2 & 2 & 1 & 1 & 0 \\
2 & 3 & 1 & 0 & 2 & 1 \\
2 & 1 & 3 & 2 & 0 & 1 \\
1 & 0 & 2 & 3 & 1 & 2 \\
1 & 2 & 0 & 1 & 3 & 2 \\
0 & 1 & 1 & 2 & 2 & 3
\end{array}\right)$$
Exercise: For what values of $k$ is the determinant of the following matrix $0$?
$$\left(\begin{array}{rrr}
1 & 1 & -1 \\
2 & 3 & k \\
1 & k & 3
\end{array}\right)$$
[K. R. Matthews, Elementary Linear Algebra, Chapter 4, Problem 8]
{{{id=183| /// }}} {{{id=182| /// }}} {{{id=155| /// }}} {{{id=154| /// }}}Exercise: Prove that the determinant of the following matrix is $-8$.
$$\left(\begin{array}{rrr}
{n}^{2} & {\left( n + 1 \right)}^{2} & {\left( n + 2
\right)}^{2} \\
{\left( n + 1 \right)}^{2} & {\left( n + 2 \right)}^{2} &
{\left( n + 3 \right)}^{2} \\
{\left( n + 2 \right)}^{2} & {\left( n + 3 \right)}^{2} &
{\left( n + 4 \right)}^{2}\end{array}\right)$$
[K. R. Matthews, Elementary Linear Algebra, Chapter 4, Problem 3]
{{{id=185| /// }}} {{{id=184| /// }}} {{{id=141| /// }}} {{{id=133| /// }}}Exercise: Prove that if $a \neq c$, then the line through the points $(a,b)$ and $(c,d)$ is given by the following equation.
$$\det\left(\begin{array}{rrr}
x & y & 1 \\
a & b & 1 \\
c & d & 1
\end{array}\right) = 0.$$
Exercise: Find the determinant of the following matrices.
$$
\left(\begin{array}{r}
1
\end{array}\right),
\left(\begin{array}{rr}
1 & 1 \\
r & 1
\end{array}\right),
\left(\begin{array}{rrr}
1 & 1 & 1 \\
r & 1 & 1 \\
r & r & 1
\end{array}\right),
\left(\begin{array}{rrrr}
1 & 1 & 1 & 1 \\
r & 1 & 1 & 1 \\
r & r & 1 & 1 \\
r & r & r & 1
\end{array}\right),
\left(\begin{array}{rrrrr}
1 & 1 & 1 & 1 & 1 \\
r & 1 & 1 & 1 & 1 \\
r & r & 1 & 1 & 1 \\
r & r & r & 1 & 1 \\
r & r & r & r & 1
\end{array}\right)$$
Make a conjecture about the determinant of an arbitrary matrix in this sequence. Can you prove it your conjecture?
[Adapted from: K. R. Matthews, Elementary Linear Algebra, Chapter 4, Problem 19]
{{{id=181| /// }}} {{{id=180| /// }}} {{{id=194| /// }}} {{{id=128| /// }}}Exercise: What is the largest determinant possible for a $3\times3$ matrix whose entries are $1, 2, \dots, 9$ (each occurring exactly once, in any order). How many matrices $M$ achieve this maximum?
(Hint: You might find the command Permutations useful. The following code will construct all the lists that have the entries $1, 2, 3, 4$, each appearing exactly once.)
for P in Permutations(4):{{{id=191| for P in Permutations(4): L = list(P) print L /// [1, 2, 3, 4] [1, 2, 4, 3] [1, 3, 2, 4] [1, 3, 4, 2] [1, 4, 2, 3] [1, 4, 3, 2] [2, 1, 3, 4] [2, 1, 4, 3] [2, 3, 1, 4] [2, 3, 4, 1] [2, 4, 1, 3] [2, 4, 3, 1] [3, 1, 2, 4] [3, 1, 4, 2] [3, 2, 1, 4] [3, 2, 4, 1] [3, 4, 1, 2] [3, 4, 2, 1] [4, 1, 2, 3] [4, 1, 3, 2] [4, 2, 1, 3] [4, 2, 3, 1] [4, 3, 1, 2] [4, 3, 2, 1] }}} {{{id=190| /// }}} {{{id=189| /// }}}
L = list(P)
print L