{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "e52976ee", "metadata": { "execution": { "iopub.execute_input": "2024-07-23T15:01:55.394604Z", "iopub.status.busy": "2024-07-23T15:01:55.393785Z", "iopub.status.idle": "2024-07-23T15:01:58.762999Z", "shell.execute_reply": "2024-07-23T15:01:58.762065Z" } }, "outputs": [ { "data": { "text/html": [ "\\(\\displaystyle z^{12}\\)" ], "text/latex": [ "$\\displaystyle z^{12}$" ], "text/plain": [ "z^12" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%display latex\n", "var('z')\n", "z^12" ] }, { "cell_type": "code", "execution_count": 2, "id": "e4dc58c3", "metadata": { "execution": { "iopub.execute_input": "2024-07-23T15:01:58.766644Z", "iopub.status.busy": "2024-07-23T15:01:58.765670Z", "iopub.status.idle": "2024-07-23T15:01:58.776553Z", "shell.execute_reply": "2024-07-23T15:01:58.775839Z" } }, "outputs": [ { "data": { "text/html": [ "\\(\\displaystyle \\sqrt{z^{2} + \\frac{1}{2}}\\)" ], "text/latex": [ "$\\displaystyle \\sqrt{z^{2} + \\frac{1}{2}}$" ], "text/plain": [ "sqrt(z^2 + 1/2)" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sqrt(z^2 + 1/2)" ] }, { "cell_type": "code", "execution_count": 3, "id": "58c82d8d", "metadata": { "execution": { "iopub.execute_input": "2024-07-23T15:01:58.779865Z", "iopub.status.busy": "2024-07-23T15:01:58.779108Z", "iopub.status.idle": "2024-07-23T15:01:58.791789Z", "shell.execute_reply": "2024-07-23T15:01:58.791077Z" } }, "outputs": [ { "data": { "text/html": [ "\\(\\displaystyle \\verb|a|\\verb| |\\verb|string|\\)" ], "text/latex": [ "$\\displaystyle \\verb|a|\\verb| |\\verb|string|$" ], "text/plain": [ "'a string'" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "'a string'" ] }, { "cell_type": "code", "execution_count": 4, "id": "8cfcc3f3", "metadata": { "execution": { "iopub.execute_input": "2024-07-23T15:01:58.795048Z", "iopub.status.busy": "2024-07-23T15:01:58.794092Z", "iopub.status.idle": "2024-07-23T15:01:58.805406Z", "shell.execute_reply": "2024-07-23T15:01:58.804639Z" } }, "outputs": [ { "data": { "text/html": [ "\\(\\displaystyle \\newcommand{\\Bold}[1]{\\mathbf{#1}}\\Bold{Q}\\)" ], "text/latex": [ "$\\displaystyle \\newcommand{\\Bold}[1]{\\mathbf{#1}}\\Bold{Q}$" ], "text/plain": [ "Rational Field" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "QQ" ] }, { "cell_type": "code", "execution_count": 5, "id": "3cfcfcf0", "metadata": { "execution": { "iopub.execute_input": "2024-07-23T15:01:58.808755Z", "iopub.status.busy": "2024-07-23T15:01:58.807941Z", "iopub.status.idle": "2024-07-23T15:01:58.816929Z", "shell.execute_reply": "2024-07-23T15:01:58.816167Z" } }, "outputs": [ { "data": { "text/html": [ "\\(\\displaystyle \\newcommand{\\Bold}[1]{\\mathbf{#1}}\\Bold{Z}[x]\\)" ], "text/latex": [ "$\\displaystyle \\newcommand{\\Bold}[1]{\\mathbf{#1}}\\Bold{Z}[x]$" ], "text/plain": [ "Univariate Polynomial Ring in x over Integer Ring" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ZZ['x']" ] }, { "cell_type": "code", "execution_count": 6, "id": "1e6b8f90", "metadata": { "execution": { "iopub.execute_input": "2024-07-23T15:01:58.820760Z", "iopub.status.busy": "2024-07-23T15:01:58.819729Z", "iopub.status.idle": "2024-07-23T15:01:58.832499Z", "shell.execute_reply": "2024-07-23T15:01:58.831931Z" } }, "outputs": [ { "data": { "text/html": [ "\\(\\displaystyle \\left(\\begin{array}{rrr}\n", "2 & 4 & 6 \\\\\n", "-1 & -1 & -1\n", "\\end{array}\\right)\\)" ], "text/latex": [ "$\\displaystyle \\left(\\begin{array}{rrr}\n", "2 & 4 & 6 \\\\\n", "-1 & -1 & -1\n", "\\end{array}\\right)$" ], "text/plain": [ "[ 2 4 6]\n", "[-1 -1 -1]" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "matrix(QQ, 2, 3, [[2,4,6],[-1,-1,-1]])" ] }, { "cell_type": "code", "execution_count": 7, "id": "d787b816", "metadata": { "execution": { "iopub.execute_input": "2024-07-23T15:01:58.835861Z", "iopub.status.busy": "2024-07-23T15:01:58.835037Z", "iopub.status.idle": "2024-07-23T15:01:58.842282Z", "shell.execute_reply": "2024-07-23T15:01:58.841473Z" } }, "outputs": [], "source": [ "%display plain" ] }, { "cell_type": "code", "execution_count": 8, "id": "a02096b7", "metadata": { "execution": { "iopub.execute_input": "2024-07-23T15:01:58.846155Z", "iopub.status.busy": "2024-07-23T15:01:58.844985Z", "iopub.status.idle": "2024-07-23T15:01:58.855130Z", "shell.execute_reply": "2024-07-23T15:01:58.854306Z" } }, "outputs": [ { "data": { "text/html": [ "\\(\\displaystyle \\newcommand{\\Bold}[1]{\\mathbf{#1}}\\Bold{Q}\\)" ], "text/latex": [ "$\\displaystyle \\newcommand{\\Bold}[1]{\\mathbf{#1}}\\Bold{Q}$" ], "text/plain": [ "Rational Field" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%display latex\n", "QQ" ] }, { "cell_type": "code", "execution_count": 9, "id": "7ca70ec9", "metadata": { "execution": { "iopub.execute_input": "2024-07-23T15:01:58.858981Z", "iopub.status.busy": "2024-07-23T15:01:58.857892Z", "iopub.status.idle": "2024-07-23T15:01:58.865282Z", "shell.execute_reply": "2024-07-23T15:01:58.864534Z" } }, "outputs": [ { "data": { "text/html": [ "\\(\\displaystyle \\newcommand{\\Bold}[1]{\\mathbb{#1}}\\Bold{Q}\\)" ], "text/latex": [ "$\\displaystyle \\newcommand{\\Bold}[1]{\\mathbb{#1}}\\Bold{Q}$" ], "text/plain": [ "Rational Field" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "latex.blackboard_bold(True)\n", "QQ" ] }, { "cell_type": "code", "execution_count": 10, "id": "e10d78f7", "metadata": { "execution": { "iopub.execute_input": "2024-07-23T15:01:58.869074Z", "iopub.status.busy": "2024-07-23T15:01:58.868073Z", "iopub.status.idle": "2024-07-23T15:01:58.874028Z", "shell.execute_reply": "2024-07-23T15:01:58.873242Z" } }, "outputs": [], "source": [ "latex.blackboard_bold(False)\n", "%display plain" ] }, { "cell_type": "code", "execution_count": 11, "id": "32dac6a2", "metadata": { "execution": { "iopub.execute_input": "2024-07-23T15:01:58.877261Z", "iopub.status.busy": "2024-07-23T15:01:58.876353Z", "iopub.status.idle": "2024-07-23T15:01:58.886329Z", "shell.execute_reply": "2024-07-23T15:01:58.885553Z" } }, "outputs": [ { "data": { "text/html": [ "\\(\\displaystyle \\sqrt{x + y}\\)" ], "text/latex": [ "$\\displaystyle \\sqrt{x + y}$" ], "text/plain": [ "sqrt(x + y)" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%display latex\n", "var('x y')\n", "sqrt(x + y)" ] }, { "cell_type": "code", "execution_count": 12, "id": "d4fa93ce", "metadata": { "execution": { "iopub.execute_input": "2024-07-23T15:01:58.890071Z", "iopub.status.busy": "2024-07-23T15:01:58.889074Z", "iopub.status.idle": "2024-07-23T15:01:58.896545Z", "shell.execute_reply": "2024-07-23T15:01:58.895750Z" } }, "outputs": [ { "data": { "text/html": [ "\\(\\displaystyle \\newcommand{\\sqrt}[1]{(#1)^\\frac{1}{2}}\\sqrt{x + y}\\)" ], "text/latex": [ "$\\displaystyle \\newcommand{\\sqrt}[1]{(#1)^\\frac{1}{2}}\\sqrt{x + y}$" ], "text/plain": [ "sqrt(x + y)" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "latex.add_macro(r\"\\newcommand{\\sqrt}[1]{(#1)^\\frac{1}{2}}\")\n", "sqrt(x + y)" ] }, { "cell_type": "code", "execution_count": 13, "id": "41ed7057", "metadata": { "execution": { "iopub.execute_input": "2024-07-23T15:01:58.899550Z", "iopub.status.busy": "2024-07-23T15:01:58.898875Z", "iopub.status.idle": "2024-07-23T15:01:58.904701Z", "shell.execute_reply": "2024-07-23T15:01:58.903977Z" } }, "outputs": [], "source": [ "latex.extra_macros('')\n", "%display plain" ] } ], "metadata": { "kernelspec": { "display_name": "SageMath 10.4", "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.12" } }, "nbformat": 4, "nbformat_minor": 5 }