Lecture 16: Review of the First 15 LecturesΒΆ

In the first 15 lectures we explored the extensive number system of Sage, manipulated polynomials and general expressions.

Below is a first, preliminary list of questions to review. Consider also the quizzes and homework assignments.

  1. Explain the difference between 1.0 + 10**(-32) and 1 + 10**(-32).

  2. The Gelfond-Schneider constant is \(2^{\sqrt{2}}\). Give all Sage commands

    1. to compute a rational approximation for \(2^{\sqrt{2}}\) accurate with 5 decimal places;

    2. to show that the accuracy of this approximation is indeed 5 decimal places;

    3. to compute a sequence of 10 consecutive rational approximations, starting with 5 decimal places and increasing in accuracy with one decimal place in each step of the sequence.

  3. Explain the difference between x = polygen(QQ) and var('x').

  4. Consider the polynomial \(p = 97 x^{45} - 62 x^{46} - 73 x^{31}\). What is the best way to evaluate \(p\) at hardware floating point numbers? Give the relevant Sage commands and compare between the straightforward evaluation of the expression for \(p\).

  5. Define a function whatis which stores definitions. Below is a session with this function:

    1. whatis('computer algebra') returns

      call again with the definition for computer algebra

    2. whatis('computer algebra', 'the study of algorithms in symbolic computation')

      stores the definition for 'computer algebra'

    3. whatis('computer algebra') returns

      the study of algorithms in symbolic computation

  6. Consider the polynomial \(p = 25 x^3 + 12 x^2 + 26 x + 4\) over a finite field of size 29, similar to working modulo 29.

    1. Does the polynomial factor over this field?

    2. Give the Sage commands to add sufficiently many formal roots to the field so \(p\) has three roots over the extended number field.

    3. Write the symbolic factorization of \(p\) in linear factors below.

  7. Write a Python function python_sum which takes on input a positive integer \(n\) and which returns the floating-point value of

    \[\frac{\pi}{n} \sum_{i=1}^{n-1} \cos\left( - \frac{\pi}{2} + i \frac{\pi}{n} \right).\]

    Write a more efficient version numpy_sum using vectorization.

    Time the two versions to illustrate the efficiency.

  8. Explain how rational expressions are normalized. Illustrate with an example.

  9. Type var('x,y'); q = (x^2 - y)/(y^2 - x) and draw the expression three of q.

  10. Give the Sage commands to transform \(( x + (z^2 + 1))(y - (z^2+1))\) into \(x y + (-z^2 - 1) x + (z^2 + 1) y - z^4 - 2 z^2 - 1\).