Skip to content

Commit

Permalink
Added brackets to plt.show()
Browse files Browse the repository at this point in the history
  • Loading branch information
udlbook committed Apr 10, 2024
1 parent 5492ed0 commit ea248af
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions Notebooks/Chap01/1_1_BackgroundMathematics.ipynb
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "view-in-github"
"id": "view-in-github",
"colab_type": "text"
},
"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>"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "s5zzKSOusPOB"
Expand Down Expand Up @@ -41,19 +39,18 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "WV2Dl6owme2d"
},
"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",
"\n",
"\\begin{equation}y=\\beta+\\omega x,\\end{equation} \n",
"\\begin{equation}y=\\beta+\\omega x,\\end{equation}\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",
"\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",
"Any other functions are by definition **non-linear**.\n",
"\n",
Expand Down Expand Up @@ -99,15 +96,14 @@
"ax.plot(x,y,'r-')\n",
"ax.set_ylim([0,10]);ax.set_xlim([0,10])\n",
"ax.set_xlabel('x'); ax.set_ylabel('y')\n",
"plt.show\n",
"plt.show()\n",
"\n",
"# TODO -- experiment with changing the values of beta and omega\n",
"# to understand what they do. Try to make a line\n",
"# that crosses the y-axis at y=10 and the x-axis at x=5"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "AedfvD9dxShZ"
Expand Down Expand Up @@ -192,7 +188,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "i8tLwpls476R"
Expand Down Expand Up @@ -236,7 +231,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "fGzVJQ6N-mHJ"
Expand Down Expand Up @@ -279,7 +273,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "3LGRoTMLU8ZU"
Expand All @@ -293,7 +286,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "7Y5zdKtKZAB2"
Expand Down Expand Up @@ -325,11 +317,10 @@
"ax.plot(x,y,'r-')\n",
"ax.set_ylim([0,100]);ax.set_xlim([-5,5])\n",
"ax.set_xlabel('x'); ax.set_ylabel('exp[x]')\n",
"plt.show"
"plt.show()"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "XyrT8257IWCu"
Expand All @@ -345,7 +336,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "R6A4e5IxIWCu"
Expand Down Expand Up @@ -373,11 +363,10 @@
"ax.plot(x,y,'r-')\n",
"ax.set_ylim([-5,5]);ax.set_xlim([0,5])\n",
"ax.set_xlabel('x'); ax.set_ylabel('$\\log[x]$')\n",
"plt.show"
"plt.show()"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"id": "yYWrL5AXIWCv"
Expand All @@ -397,8 +386,8 @@
],
"metadata": {
"colab": {
"include_colab_link": true,
"provenance": []
"provenance": [],
"include_colab_link": true
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
Expand All @@ -420,4 +409,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}

0 comments on commit ea248af

Please sign in to comment.