{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "This review contains some representative problems to prepare for the first midterm exam." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# question 1" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Consider $S = \\sqrt{2}$\n", "\n", "1. Construct a nearby rational approximation for $S$ where the size of the denominator is not larger than 1000.\n", "\n", "2. Construct a sequence of 10 nearby rational approximations, where the denominator of the $k$-th approximation is smaller than $10^k$.\n", "\n", "3. Verify the accuracy of the rational approximations." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# question 2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Define a function ``whatis`` which stores definitions.\n", "\n", "Here is a session with this function:\n", "\n", "1. ``whatis('computer algebra')`` returns\n", "\n", " ``call again with the definition for computer algebra``\n", " \n", " \n", "2. ``whatis('computer algebra', 'the study of algorithms in symbolic computation')`` \n", "\n", " stores the definition for ``'computer algebra'``\n", " \n", " \n", "3. ``whatis('computer algebra')`` returns\n", "\n", " ``the study of algorithms in symbolic computation``" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# question 3" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Consider the polynomial $p = x^4 + x^2 + 1$\n", "over the field ${\\mathbb Z}_2$, the field of bits, 0 and 1.\n", " \n", " 1. Is $p$ irreducible? If not, then what are its factors?\n", " \n", " 2. Extend the field ${\\mathbb Z}_2$ with sufficiently many formal roots\n", " so $p$ factors as a product of linear factors.\n", " \n", " Write the factorization of $p$." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# question 4" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Write a Python function ``python_sum`` which takes on input a positive integer $n$ and which returns\n", "the floating-point value of\n", "\n", "$$\n", " \\frac{\\pi}{n} \\sum_{i=1}^{n-1} \\cos\\left( - \\frac{\\pi}{2} + i \\frac{\\pi}{n} \\right).\n", "$$\n", "\n", "Write a more efficient version ``numpy_sum`` using vectorization.\n", "\n", "Time the two versions to illustrate the efficiency." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# question 5" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Explain what is the fully factored normal form of rational polynomials.\n", "\n", "Why does this automatic simplification not happen automatically?\n", "\n", "Illustrate with a good example." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# question 6" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Type \n", "``reset(); x, y = var('x,y'); q = (x^2 - y)/(y^2 - x)``\n", "and draw the expression tree of ``q.``" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# question 7" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Rewrite\n", "\n", "$$\n", " x + \\frac{(x - y)^5}{(x + y)^5}\n", "$$\n", "\n", "into\n", "\n", "$$\n", " \\frac{(x + y)^5 \\cdot x + (x - y)^5}{(x + y)^5}.\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# question 8" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Consider $p = -y^2 z^3 - y z^4 + 3 x y^3 + x^3 + z^2$\n", "as a polynomial with integer coefficients in the variables $x$, $y$, and $z$.\n", " \n", "The monomials of $p$ are sorted in the degree lexicographical order.\n", " \n", "Convert $p$ (*without retyping $p$!*) into the pure lexicographical term order." ] } ], "metadata": { "kernelspec": { "display_name": "SageMath 10.3", "language": "sage", "name": "sagemath" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10" } }, "nbformat": 4, "nbformat_minor": 4 }