Added brackets to plt.show()

This commit is contained in:
udlbook
2024-04-10 15:38:29 -04:00
parent 5492ed0ee5
commit ea248af22f

View File

@@ -1,18 +1,16 @@
{ {
"cells": [ "cells": [
{ {
"attachments": {},
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"colab_type": "text", "id": "view-in-github",
"id": "view-in-github" "colab_type": "text"
}, },
"source": [ "source": [
"<a href=\"https://colab.research.google.com/github/udlbook/udlbook/blob/main/Notebooks/Chap01/1_1_BackgroundMathematics.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" "<a href=\"https://colab.research.google.com/github/udlbook/udlbook/blob/main/Notebooks/Chap01/1_1_BackgroundMathematics.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
] ]
}, },
{ {
"attachments": {},
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "s5zzKSOusPOB" "id": "s5zzKSOusPOB"
@@ -41,7 +39,6 @@
] ]
}, },
{ {
"attachments": {},
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "WV2Dl6owme2d" "id": "WV2Dl6owme2d"
@@ -49,11 +46,11 @@
"source": [ "source": [
"**Linear functions**<br> We will be using the term *linear equation* to mean a weighted sum of inputs plus an offset. If there is just one input $x$, then this is a straight line:\n", "**Linear functions**<br> We will be using the term *linear equation* to mean a weighted sum of inputs plus an offset. If there is just one input $x$, then this is a straight line:\n",
"\n", "\n",
"\\begin{equation}y=\\beta+\\omega x,\\end{equation} \n", "\\begin{equation}y=\\beta+\\omega x,\\end{equation}\n",
"\n", "\n",
"where $\\beta$ is the y-intercept of the linear and $\\omega$ is the slope of the line. When there are two inputs $x_{1}$ and $x_{2}$, then this becomes:\n", "where $\\beta$ is the y-intercept of the linear and $\\omega$ is the slope of the line. When there are two inputs $x_{1}$ and $x_{2}$, then this becomes:\n",
"\n", "\n",
"\\begin{equation}y=\\beta+\\omega_1 x_1 + \\omega_2 x_2.\\end{equation} \n", "\\begin{equation}y=\\beta+\\omega_1 x_1 + \\omega_2 x_2.\\end{equation}\n",
"\n", "\n",
"Any other functions are by definition **non-linear**.\n", "Any other functions are by definition **non-linear**.\n",
"\n", "\n",
@@ -99,7 +96,7 @@
"ax.plot(x,y,'r-')\n", "ax.plot(x,y,'r-')\n",
"ax.set_ylim([0,10]);ax.set_xlim([0,10])\n", "ax.set_ylim([0,10]);ax.set_xlim([0,10])\n",
"ax.set_xlabel('x'); ax.set_ylabel('y')\n", "ax.set_xlabel('x'); ax.set_ylabel('y')\n",
"plt.show\n", "plt.show()\n",
"\n", "\n",
"# TODO -- experiment with changing the values of beta and omega\n", "# TODO -- experiment with changing the values of beta and omega\n",
"# to understand what they do. Try to make a line\n", "# to understand what they do. Try to make a line\n",
@@ -107,7 +104,6 @@
] ]
}, },
{ {
"attachments": {},
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "AedfvD9dxShZ" "id": "AedfvD9dxShZ"
@@ -192,7 +188,6 @@
] ]
}, },
{ {
"attachments": {},
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "i8tLwpls476R" "id": "i8tLwpls476R"
@@ -236,7 +231,6 @@
] ]
}, },
{ {
"attachments": {},
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "fGzVJQ6N-mHJ" "id": "fGzVJQ6N-mHJ"
@@ -279,7 +273,6 @@
] ]
}, },
{ {
"attachments": {},
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "3LGRoTMLU8ZU" "id": "3LGRoTMLU8ZU"
@@ -293,7 +286,6 @@
] ]
}, },
{ {
"attachments": {},
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "7Y5zdKtKZAB2" "id": "7Y5zdKtKZAB2"
@@ -325,11 +317,10 @@
"ax.plot(x,y,'r-')\n", "ax.plot(x,y,'r-')\n",
"ax.set_ylim([0,100]);ax.set_xlim([-5,5])\n", "ax.set_ylim([0,100]);ax.set_xlim([-5,5])\n",
"ax.set_xlabel('x'); ax.set_ylabel('exp[x]')\n", "ax.set_xlabel('x'); ax.set_ylabel('exp[x]')\n",
"plt.show" "plt.show()"
] ]
}, },
{ {
"attachments": {},
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "XyrT8257IWCu" "id": "XyrT8257IWCu"
@@ -345,7 +336,6 @@
] ]
}, },
{ {
"attachments": {},
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "R6A4e5IxIWCu" "id": "R6A4e5IxIWCu"
@@ -373,11 +363,10 @@
"ax.plot(x,y,'r-')\n", "ax.plot(x,y,'r-')\n",
"ax.set_ylim([-5,5]);ax.set_xlim([0,5])\n", "ax.set_ylim([-5,5]);ax.set_xlim([0,5])\n",
"ax.set_xlabel('x'); ax.set_ylabel('$\\log[x]$')\n", "ax.set_xlabel('x'); ax.set_ylabel('$\\log[x]$')\n",
"plt.show" "plt.show()"
] ]
}, },
{ {
"attachments": {},
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
"id": "yYWrL5AXIWCv" "id": "yYWrL5AXIWCv"
@@ -397,8 +386,8 @@
], ],
"metadata": { "metadata": {
"colab": { "colab": {
"include_colab_link": true, "provenance": [],
"provenance": [] "include_colab_link": true
}, },
"kernelspec": { "kernelspec": {
"display_name": "Python 3 (ipykernel)", "display_name": "Python 3 (ipykernel)",