{ "cells": [ { "cell_type": "markdown", "id": "10597d44", "metadata": {}, "source": [ "MCS 320 Quiz 2 Friday 21 June 2024" ] }, { "cell_type": "markdown", "id": "6714c80f", "metadata": {}, "source": [ "# Question 1" ] }, { "cell_type": "markdown", "id": "203118a7-77fd-4a26-98cf-8c75b4589994", "metadata": {}, "source": [ "Compute the polar representation of the complex number $7 - 4 I$.\n", "\n", "Verify that the polar representation you computed corresponds to $7 - 4 I$." ] }, { "cell_type": "markdown", "id": "117c493c-f953-4856-8788-239c9e5ea559", "metadata": {}, "source": [ "## answer to question 1" ] }, { "cell_type": "code", "execution_count": 1, "id": "0659b309-50c1-43f3-b90d-09695b159da2", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "-4*I + 7" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "z = 7 - 4*I\n", "z" ] }, { "cell_type": "code", "execution_count": 2, "id": "273a02f3-9d07-4596-a7bd-fc425792f0b9", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "sqrt(65)" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r = abs(z)\n", "r" ] }, { "cell_type": "code", "execution_count": 3, "id": "4283be30-0807-48db-b3f7-618aae73a777", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "-arctan(4/7)" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a = arg(z)\n", "a" ] }, { "cell_type": "markdown", "id": "b73cac89-57c7-40a4-b3f9-7705374f87e8", "metadata": {}, "source": [ "The polar representation of `z` is `r*exp(I*a)` computed below." ] }, { "cell_type": "code", "execution_count": 4, "id": "08affda4-e5ef-4286-a7e7-cd6036b92acb", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "sqrt(65)*e^(-I*arctan(4/7))" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pz = r*exp(I*a)\n", "pz" ] }, { "cell_type": "code", "execution_count": 5, "id": "b9e1301c-0622-4299-aab1-a34b43e29fba", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "7" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rz = simplify(pz.real())\n", "rz" ] }, { "cell_type": "code", "execution_count": 6, "id": "8d5e38eb-7213-46f5-89fa-09be708f5fee", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "-4" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "iz = simplify(pz.imag())\n", "iz" ] }, { "cell_type": "markdown", "id": "0567ca7c-d842-4fe7-b7e6-a5ae23aaaa52", "metadata": {}, "source": [ "Thus we see that the real part and the imaginary part of the polar representation `pz` simplifies to" ] }, { "cell_type": "code", "execution_count": 7, "id": "a0b654cb-777b-4e58-97fc-6ed164100319", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "-4*I + 7" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rz + iz*I" ] }, { "cell_type": "code", "execution_count": 8, "id": "6004628b-eb64-4888-83d7-a06f9c9b3c64", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "-4*I + 7" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "z" ] }, { "cell_type": "markdown", "id": "85378d99-9980-489a-a6e8-7c4d9d6b6c03", "metadata": {}, "source": [ "which indeed equals `z`." ] }, { "cell_type": "markdown", "id": "bd6eb31f", "metadata": {}, "source": [ "# Question 2" ] }, { "cell_type": "markdown", "id": "b365ff05", "metadata": {}, "source": [ "Consider the polynomial $p = x^3 + 8 x + 7$ and compute modulo 13.\n", "\n", "1. Define $p$ as a polynomial in $x$ with modulo 13 coefficients.\n", " Does $p$ factor?\n", "\n", " \n", "2. Let $\\alpha$ be the formal root of $p$ used in the field extension\n", " of the modulo 13 numbers.\n", " \n", " How many elements are in this extended finite field?\n", " Write $\\alpha^7$ in its normal form." ] }, { "cell_type": "markdown", "id": "039a94a7", "metadata": {}, "source": [ "## answer to question 2" ] }, { "cell_type": "code", "execution_count": 9, "id": "cfda5db0", "metadata": {}, "outputs": [], "source": [ "reset()" ] }, { "cell_type": "code", "execution_count": 10, "id": "fb3e1a20", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "x^3 + 8*x + 7 has type \n" ] } ], "source": [ "x = polygen(GF(13))\n", "p = x^3 + 8*x + 7\n", "print(p, 'has type', type(p))" ] }, { "cell_type": "code", "execution_count": 11, "id": "dd718a54", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p.is_irreducible()" ] }, { "cell_type": "code", "execution_count": 12, "id": "5cdad283", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Finite Field in alpha of size 13^3" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "K. = GF(13).extension(p)\n", "K" ] }, { "cell_type": "code", "execution_count": 13, "id": "28766f78", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2197" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "13^3" ] }, { "cell_type": "markdown", "id": "5f4a06ff", "metadata": {}, "source": [ "There are 2197 elements in the extension field." ] }, { "cell_type": "code", "execution_count": 14, "id": "f9351c7f", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "8*alpha^2 + 5*alpha + 7" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "alpha^7" ] }, { "cell_type": "markdown", "id": "9e70e2b7", "metadata": {}, "source": [ "The representation of $\\alpha^7$ is $8 \\alpha^2 + 5 \\alpha + 7$." ] } ], "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.14" } }, "nbformat": 4, "nbformat_minor": 5 }