{ "cells": [ { "cell_type": "markdown", "id": "1cc0b339", "metadata": {}, "source": [ "# Basics of Python" ] }, { "cell_type": "markdown", "id": "40acd0bd", "metadata": {}, "source": [ "## Python as a calculator" ] }, { "cell_type": "markdown", "id": "2e6539ec", "metadata": {}, "source": [ "Given the price $p=27$ and quantity $q=97$, determine the revenue $r=pq$." ] }, { "cell_type": "code", "execution_count": 9, "id": "b719930e", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Revenue is 2619\n" ] } ], "source": [ "p=27\n", "q=97\n", "r=p*q\n", "print(\"Revenue is\", r)" ] }, { "cell_type": "markdown", "id": "c3815385", "metadata": {}, "source": [ "Suppose the cost of producing $q$ units is $c(q)=\\dfrac{q^2}{10}$, determine the profits, $pr=r-c(97)$" ] }, { "cell_type": "code", "execution_count": 10, "id": "2bde9df1", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Profits equal 1678.1\n" ] } ], "source": [ "c=(q**2)/10\n", "pr=r-c\n", "print(\"Profits equal\", pr)" ] }, { "cell_type": "markdown", "id": "b5251362", "metadata": {}, "source": [ "An individual takes a loan of $a=90000$ for $t=5$ years at the rate of interest of $r=10$ percent per annum compounded annually, determine the amount payable at maturity is $f=a\\left(1+\\dfrac{r}{100}\\right)^t$. Round it two decimal places." ] }, { "cell_type": "code", "execution_count": 11, "id": "f36b9f18", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Amount payable is 144945.9\n" ] } ], "source": [ "a=90000\n", "t=5\n", "r=10\n", "f=a*((1+(r/100))**t)\n", "print(\"Amount payable is\",round(f,2))" ] }, { "cell_type": "markdown", "id": "6cb4a314", "metadata": {}, "source": [ "Is $f > 145000$?" ] }, { "cell_type": "code", "execution_count": 12, "id": "f146db8f", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "False\n" ] } ], "source": [ "print(f > 145000)" ] }, { "cell_type": "markdown", "id": "269a4001", "metadata": {}, "source": [ "Is $f=145000$?" ] }, { "cell_type": "code", "execution_count": 4, "id": "8aec9731", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "False\n" ] } ], "source": [ "print(f==145000)" ] }, { "cell_type": "markdown", "id": "137035bf", "metadata": {}, "source": [ "Is $f\\neq 145000$?" ] }, { "cell_type": "code", "execution_count": 5, "id": "f0066a08", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "True\n" ] } ], "source": [ "print(f!=145000)" ] }, { "cell_type": "markdown", "id": "36cce229", "metadata": {}, "source": [ "Is $a<100000$ and $f>145000$?" ] }, { "cell_type": "code", "execution_count": 6, "id": "a8fc06e9", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "False\n" ] } ], "source": [ "print(a<100000 and f > 145000)" ] }, { "cell_type": "markdown", "id": "c27eae76", "metadata": {}, "source": [ "Is $a<100000$ or $f>145000$?" ] }, { "cell_type": "code", "execution_count": 7, "id": "7b9103f6", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "True\n" ] } ], "source": [ "print(a<100000 or f > 145000)" ] }, { "cell_type": "markdown", "id": "fcc9d3de", "metadata": {}, "source": [ "## Conditionals" ] }, { "cell_type": "markdown", "id": "962f0cc0", "metadata": {}, "source": [ "Suppose you invest 100000 for 3 years. Rate of interest is 8% per annum compounded annually. If the amount recieved after 3 years exceeds 125000, print `Good`, else print `Not Good`." ] }, { "cell_type": "code", "execution_count": 13, "id": "0a75797f", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Good\n" ] } ], "source": [ "a = 100000\n", "r = 8\n", "t = 3\n", "f=a*((1+(r/100))**t)\n", "if f > 125000:\n", " print(\"Good\")\n", "else:\n", " print(\"Not Good\")" ] }, { "cell_type": "code", "execution_count": 14, "id": "3739bf56", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "125971.20000000001\n" ] } ], "source": [ "print(f)" ] }, { "cell_type": "markdown", "id": "f486a078", "metadata": {}, "source": [ "## Loops" ] }, { "cell_type": "markdown", "id": "7784ea1b", "metadata": {}, "source": [ "## Lists" ] }, { "cell_type": "markdown", "id": "9e51137c", "metadata": {}, "source": [ "## Dictionary" ] }, { "cell_type": "markdown", "id": "b9634268", "metadata": {}, "source": [ "## Functions" ] }, { "cell_type": "markdown", "id": "020d05b2", "metadata": {}, "source": [ "Define a function $u_1(x,y) = \\max(\\min(x,2y), \\min(2x, y))$ and print its value at $(2,4)$." ] }, { "cell_type": "code", "execution_count": 19, "id": "7f96589f", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "u1(2,4) = 4\n" ] } ], "source": [ "def u1(x,y):\n", " return max(min(x, 2*y), min(2*x, y))\n", "\n", "print(\"u1(2,4) = \" + str(u1(2,4)))" ] }, { "cell_type": "markdown", "id": "23951410", "metadata": {}, "source": [ "Defining a utility function $u_2(x, y) = \\begin{cases} x+2y & \\text{if } x \\geq y\\\\ 2x+y & \\text{if } x < y \\end{cases} $ and finding the (approximate) demand for $x$ and $y$ as a function of $p_x$, $p_y$ and $m$." ] }, { "cell_type": "code", "execution_count": 18, "id": "1e09c788", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Demand is approximately equal to (99.99900000011343, 0.00024999997164343313)\n" ] } ], "source": [ "def u2(x,y):\n", " if x >= y:\n", " return x+2*y\n", " else:\n", " return 2*x+y\n", " \n", " \n", "def approx_demand(u, px, py, m, epsilon = 10**(-3)):\n", " xstar, ystar = 0, m/py \n", " u_max = u(xstar, ystar) \n", " n_steps = int(m/(px*epsilon)) \n", " x, y = 0, m/py \n", " for i in range(n_steps):\n", " if u(xstar, ystar) < u(x,y):\n", " xstar, ystar = x, y \n", " u_max = u(xstar, ystar) \n", " x = x + epsilon\n", " y = (m-px*x)/py\n", " return (xstar, ystar)\n", "\n", "print(\"Demand is approximately equal to \" + str(approx_demand(u2, 1, 4, 100)))" ] }, { "cell_type": "markdown", "id": "1cb60268", "metadata": {}, "source": [ "## Libraries\n", "### Math\n", "### Random\n", "### Numpy\n", "### Matplotlib" ] }, { "cell_type": "markdown", "id": "7b1ecbb5", "metadata": {}, "source": [ "## Exercises: \n", "\n", "Use the approx_demand function above to perform the following tasks:\n", "- For $u_3(x, y)= x + 2\\sqrt{y}$, find the approx-demand for $x$ and $y$ when $p_x=2$, $p_y=1$ and $m=1$.\n", "- Create a dictionary where demand for $x$ (using utility function $u_3$) is written as a function of $p_x$, holding $p_y=1$ and $m=1$ as fixed. Keys are different prices of $x$ from the set $\\{\\frac{n}{10}: n\\in\\mathbb{N} \\wedge n \\leq 30\\} = \\{0.1, 0.2, 0.3, \\ldots, 3.0\\}$ and values are the corresponding demands for $x$. We'll use this data to sketch the demand curve.\n", "- For $u_4(x, y)= \\min(x, 2y)$, create a dictionary where demand for $x$ is written as a function of $m$, holding $p_x=1$ and $p_y=2$ as fixed. Keys are different incomes from the set $\\{\\frac{n}{10}: n\\in\\mathbb{N} \\wedge n \\leq 50\\} = \\{0.1, 0.2, 0.3, \\ldots, 5.0\\}$ and values are the corresponding demands for $x$. We'll use this data to sketch the Engel curve.\n", "- For $u_5(x, y)= x+2y$, create two lists: demand_x and xdemand_y. For different prices of $x$ from the set $\\{\\frac{n}{10}: n\\in\\mathbb{N} \\wedge n \\leq 50\\} = \\{0.1, 0.2, 0.3, \\ldots, 5.0\\}$, demand_x is the list of quantity of $x$ demanded holding $p_y=1$ and $m=2$ as fixed. Similarly, for different prices of $x$ from the set $\\{\\frac{n}{10}: n\\in\\mathbb{N} \\wedge n \\leq 50\\} = \\{0.1, 0.2, 0.3, \\ldots, 5.0\\}$, xdemand_y is the list of quantity of $y$ demanded holding $p_y=1$ and $m=2$ as fixed. We'll use this data to sketch the price consumption curve.\n", "\n" ] }, { "cell_type": "code", "execution_count": 22, "id": "fcaf25b5", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "8.000000000001005\n" ] } ], "source": [ "def u3(x,y):\n", " return x + 2*(y**0.5)\n", "\n", "print(approx_demand(u=u3, m=20, px = 2, py =1)[0])\n", "\n", "d_x = {}\n", "for i in range(1,31):\n", " px = i/10\n", " d_x[px] = approx_demand(u=u3, m=1, px = px, py =1)[0]" ] }, { "cell_type": "code", "execution_count": 21, "id": "354bff6e", "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEbCAYAAADXk4MCAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAlCklEQVR4nO3deZxWdd3/8debWYBhEZABEVDc0lQECVzS0tK7xD2z1CzL8jZbLev21u4W6277tZi5pGmaWtadqXWb6W3u+8KACApppBgDKINssijb5/fHOaMXwzUz1wxzrouZ834+HtdjrrN/zpmZ632d79kUEZiZWX71qnQBZmZWWQ4CM7OccxCYmeWcg8DMLOccBGZmOecgMDPLOQeBmVnOOQjMzHKuutIFmFn3JGkAsKIj00SEMirHtoCDwMw661R/sPcMbhrqhiRdK+m7rQzbXdJTkl6T9MVy11YKSXMlHV7pOgAk/UDSlzKc/5OS9spq/pUiaTtgYaXrsK6R2yBIP4zWpB+YyyQ9KuksSd19m5wL3B8RAyLi4koXszWTVA+cBvwyw8X8BPhOhvPfYpJ6S7pa0kvp/8NTkia3M9nhwN3lqK+rSfq8pAZJb0i6ttL1tFSJ+rr7h96WOiYiBgA7Aj8E/hO4urIlbbEdgWc7M6GkvDUVfgK4PSLWZLiMW4H3SBqR4TJaJekCSRe0M1o1MA84BNgG+AZwo6QxbUzTPyJWdUmR5bcA+C5wTaULaUXZ68t7EAAQEcsj4lbgJODjkvYGkLS9pJslNUl6sbCpJd2j+A9JMyStSr9RDZd0R/qt6m5JgwvGP0/SP9NhsyR9oMW8vprOa7mkP0jqUzB8X0nT0mn/ALw5rJCke4H3AJdKWinpbZLeLun+dK/nWUnHtphmrq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aWcw4CM7OccxCYmeWcg8DMLOccBGZmOecgMDPLuf8PcBEMgR7AuOAAAAAASUVORK5CYII=\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "import matplotlib.pyplot as plt\n", "\n", "price_of_x = list(d_x.keys())\n", "demand_for_x = list(d_x.values())\n", "\n", "plt.plot(demand_for_x, price_of_x)\n", "plt.xlabel(\"Demand for x\")\n", "plt.ylabel(\"Price of x\")\n", "plt.title(\"Demand for x when \" + r\"$u(x,y) = x+2\\sqrt{y}, p_y = 1, m = 1$\")\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": 23, "id": "bf891d24", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/Users/amitgoyal/opt/anaconda3/lib/python3.9/site-packages/IPython/core/display.py:724: UserWarning: Consider using IPython.display.IFrame instead\n", " warnings.warn(\"Consider using IPython.display.IFrame instead\")\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from IPython.display import HTML\n", "\n", "# Youtube\n", "HTML('')" ] }, { "cell_type": "code", "execution_count": 24, "id": "1df7c31b", "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "HTML('')" ] }, { "cell_type": "code", "execution_count": 25, "id": "537c38e3", "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "HTML('')" ] }, { "cell_type": "code", "execution_count": 26, "id": "258203a1", "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "HTML('')" ] }, { "cell_type": "code", "execution_count": null, "id": "88be4018", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "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.9.7" } }, "nbformat": 4, "nbformat_minor": 5 }