{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "5d47aa17-9cde-4b6c-8ac7-ef883ff9702f",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "b283c23c-32b4-4eb7-9689-1647456de783",
   "metadata": {},
   "outputs": [],
   "source": [
    "def f(x):\n",
    "    return x*np.sin(x**2)\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "e4bbfa05-3d72-418f-b031-7ee9361ae265",
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7efce073f580>]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 75272 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.arange(-10, 10, 0.1)\n",
    "y = f(x)\n",
    "plt.plot(x,y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "67935f5e-a80a-4227-a791-31d086715b26",
   "metadata": {},
   "outputs": [],
   "source": [
    "def g(x):\n",
    "    return x*np.tan(x**2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "bebda7e8-d51e-47bc-8e43-becd7678266b",
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7efce87cb3d0>]"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 22644 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.arange(-1, 1, 0.0001)\n",
    "y = g(x)\n",
    "plt.plot(x,y)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "2d5cc433-d379-409e-ad0d-3198924438dc",
   "metadata": {},
   "outputs": [],
   "source": [
    "def h(x):\n",
    "    return 1/(x**2+1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "d1571682-d375-48ff-9d1b-353d4c2cd955",
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7efcdf117190>]"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 23980 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.arange (-5, 5, 0.1)\n",
    "y = h(x)\n",
    "plt.plot(x,y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "d21ed9ef-51c9-4484-9033-fbcc4c70151f",
   "metadata": {},
   "outputs": [],
   "source": [
    "def n(x):\n",
    "    return 1/np.sqrt(2*np.pi)*np.exp(-x**2/2)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "fc13cc99-5670-4a24-9c87-b17da9cc2f61",
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7efcdf2a8f10>]"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 26704 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.arange (-5,5,0.1)\n",
    "y = n(x)\n",
    "plt.plot(x,y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "790f935d-f36c-492c-a787-64f835f95116",
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7efcdea12da0>]"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 40160 characters]",
      "text/plain": [
       "<Figure size 1000x600 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig,ax = plt.subplots(figsize=(10,6))\n",
    "ax.plot(x,h(x))\n",
    "ax.plot(x,n(x))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c40d7a91-bacf-4470-ba3e-080378923606",
   "metadata": {},
   "source": [
    "# Graphing Function"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4a750a94-e153-4006-b2a4-1bd83f57d960",
   "metadata": {},
   "outputs": [],
   "source": [
    "def graph(f, a=-5, b=5, n=100):\n",
    "    x = np.arange (a, b, (b-a)/n)\n",
    "    y = f(x)\n",
    "    fig,ax = plt.subplots(figsize=(10,6))\n",
    "    ax.plot(x,y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "b0cb340f-686f-4acb-9db6-0a5b607ccac3",
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 30868 characters]",
      "text/plain": [
       "<Figure size 1000x600 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 31324 characters]",
      "text/plain": [
       "<Figure size 1000x600 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "graph(h,b=12)\n",
    "graph(h, -5, 5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "id": "c4f0ea76-8786-49b9-9484-9fea2a0f54d6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 16904 characters]",
      "text/plain": [
       "<Figure size 1000x600 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "graph(g, 2, 2.5, 1000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7248cacf-67ca-4e96-93d2-f6be9828c87f",
   "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.10.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
