Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
compmech-project01/02_Analyze-data_project.ipynb
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
295 lines (295 sloc)
29.6 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Computational Mechanics Project #02 - Create specifications for a projectile robot\n", | |
"\n", | |
"On the first day of class, we threw $2\"\\times~2\"$ dampened paper (spitballs) at a target on the whiteboard. Now, we are going to analyze the accuracy of the class with some cool Python tools and design a robot that has the same accuracy and precision as the class, but we will have the robot move farther away from the target and use a simpler projectile i.e. a tennis ball so we don't need to worry about knuckle-ball physics. \n", | |
"\n", | |
"The goal of this project is to determine the precision of necessary components for a robot that can reproduce the class throwing distibution. We have generated pseudo random numbers using `numpy.random`, but the class target practice is an example of truly random distributions. If we repeated the exercise, there is a vanishingly small probability that we would hit the same points on the target, and there are no deterministic models that could take into account all of the factors that affected each hit on the board. \n", | |
"\n", | |
"<img src=\"../images/robot_design.png\" style=\"height: 250px;\"/>\n" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Now, we ask ourselves some questions:\n", | |
"\n", | |
"1. How do we quantify the class accuracy and precision?\n", | |
"\n", | |
"2. If we design a robot, what design components can we control?\n", | |
"\n", | |
"3. How can we relate the controlled components to the class accuracy, and specify the component precision?\n", | |
"\n", | |
"The first question, we have some experience from our work in [02_Seeing_Stats](../notebooks/02_Seeing_Stats.ipynb). We can define the mean, standard deviation, measure the first, second, and third quartiles, etc. \n", | |
"\n", | |
"The second question is a physical question. We cannot control the placement of the robot or the target those are chosen for us. We cannot control temperature, mechanical vibrations, etc. We *can* control the desired initial velocity. The initial velocity will have some speed and direction, and both will be subject to random noise. Once the speed and direction are set, the location on the target is determined by kinematic equations for an object in freefall, as such\n", | |
"\n", | |
"$x_{impact} = \\frac{v_x}{v_y}d + x(0)~~~~~~~~~~~~~~~~~~~~(1.a)$\n", | |
"\n", | |
"$z_{impact} = d\\left(\\frac{v_z(0)}{v_y}-\\frac{g}{2v_y^2}d\\right)+ z(0)~~~~~(1.b)$.\n", | |
"\n", | |
"Where the location of impact is at a $y$-distance of $d$ at a point on the target with coordinates $(x_{impact},~z_{impact})$, and the initial velocity is $\\bar{v}=v_x\\hat{i}+v_y\\hat{j}+v_z(0)\\hat{k}$, the object is released at an initial location $\\bar{r}(0)=x(0)\\hat{i}+0\\hat{j}+z(0)\\hat{k}$, and the only acceleration is due to gravity, $\\bar{a}=-g\\hat{k}$. Equation (1) becomes much easier to evaluate if we assume that $v_x=0$, resulting in an evalution of the accuracy of the height of the impact, $z_{impact}$, as such\n", | |
"\n", | |
"$x_{impact} = x(0)~~~~~~~~~~~~~~~~~~~~(2.a)$\n", | |
"\n", | |
"$z_{impact} = \\frac{d}{\\cos{\\theta}}\\left(\\sin{\\theta}-\\frac{g}{2v_0^2\\cos{\\theta}}d\\right)+ z(0)~~~~~(2.b)$.\n", | |
"\n", | |
"Where $\\theta$ is the angle of the initial velocity and $v_0$ is the initial speed. Equation (2) restricts the analysis to height accuracy. You can incorporate the 2D impact analysis if you finish the 1D analysis. " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"The third question, is how we can relate equation (2) to the measured points of impact? For this, we can use Monte Carlo methods *(There are other methods, but Monte Carlo is one of the most straight-forward)*. Our Monte Carlo approach is as such, if we have a desired initial speed, $v_0$, and desired angle, $\\theta$, we can propagate the uncertainty of our actual speeds and angles into the $z_{impact}$ locations. Then, we can choose distributions in speed and angles that match the distributions in $z_{impact}$ locations. Here are the steps:\n", | |
"\n", | |
"1. Generate random $\\theta_i$ and $v_{0~i}$ variables\n", | |
"\n", | |
"2. Plug into eqn 2 for random $z_{impact~i}$ locations\n", | |
"\n", | |
"3. Compare to our measured $z_{impact}$ location statistics\n", | |
"\n", | |
"4. Repeat 1-3 until the predicted uncertainty matches the desired uncertainty, we can use a number of comparison metrics:\n", | |
" \n", | |
" - standard deviation\n", | |
" \n", | |
" - first, second, and third quartiles\n", | |
" \n", | |
" - visually, with box plots and histograms" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Project Deliverables\n", | |
"\n", | |
"1. Statistical analysis of class accuracy and precision (x- and z-locations) data is in the csv file [../data/target_data.csv](../data/target_data.csv) _Note: if you want to see how I turned the images into data check out the jupyter notebook [process_target_practice](./process_target_practice.ipynb)\n", | |
"\n", | |
"2. A Monte Carlo model to generate impact heights based upon uncertainty in $\\theta_0$ and $v_0$. \n", | |
"\n", | |
"3. The precision required to recreate the class accuracy and precision with a robot. \n", | |
"**You must show some validation of your work**\n", | |
"\n", | |
"4. [BONUS] Repeat 2-3 taking into account the variation in $x_{impact}$ due to misalignment. \n", | |
"\n", | |
"Given constants and constraints:\n", | |
"\n", | |
"- $d=$3 m, distance to target\n", | |
"\n", | |
"- $g=$9.81 m/s$^2$, acceleration due to gravity\n", | |
"\n", | |
"- $z(0)=$0.3 m, the initial height is 0.3 m above the bull's eye\n", | |
"\n", | |
"- 4 m/s$<v_0<$12 m/s, the initial velocity is always higher than 9 mph and less than 27 mph" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 359, | |
"metadata": { | |
"scrolled": true | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"[-0.18031177 0.062429 0.30367765 0.15812724 0.12260135 -0.25306526\n", | |
" -0.15587544 0.38754071 -0.14240104 -0.14101059 -0.50548968 -0.01383176\n", | |
" -0.02339399 -0.34207992 0.49327021 0.10059057 0.05323261 -0.14844383\n", | |
" -0.28597981 0.43300113 -0.26983244 -0.27276515 0.06954583 -0.38871061\n", | |
" -0.4601371 -0.20673234 0.27439518 -0.01004235 0.33819715 -0.21311798\n", | |
" 0.20225833 0.1435592 -0.26030212 0.15031871 0.39115244 -0.2314917\n", | |
" 0.07605636 -0.17154839 0.17731786 -0.15640621 -0.42359454 0.00891441\n", | |
" -0.36703991 -0.1420244 0.43270682 0.02015643 0.05252714 -0.52257463\n", | |
" 0.30521108 0.05773216 -0.36922583 -0.36358543 -0.62430491] \n", | |
"\n", | |
"z_mean = -0.05341131259475714\n", | |
"z_std = 0.2751342116268382\n", | |
"class mean = -0.047397370492807414\n", | |
"class std = 0.2572542284595757\n" | |
] | |
} | |
], | |
"source": [ | |
"import matplotlib.pyplot as plt\n", | |
"import numpy as np\n", | |
"import pandas as pd\n", | |
"import math\n", | |
"\n", | |
"def z_coordinate(theta,v_0):\n", | |
" z = ((3/math.cos(theta))*(math.sin(theta)-((9.81*3)/(2*v_0**2*math.cos(theta))))+.3)\n", | |
" return z\n", | |
"\n", | |
"#Import rcParams to set font styles\n", | |
"from matplotlib import rcParams\n", | |
"\n", | |
"#Set font style and size \n", | |
"rcParams['font.family'] = 'sans'\n", | |
"rcParams['font.size'] = 16\n", | |
"rcParams['lines.linewidth'] = 3\n", | |
"\n", | |
"#1. generate random theta_i and v_0i variables:\n", | |
"pi = np.pi\n", | |
"theta_i = (pi/36)+((pi/12)-(pi/36))*np.random.rand(53) #assuming 10 degree (pi/18 rad) spread for a sample size of 53 (with a lower bound of 5 degrees (pi/36 rads) and an upper bound of 15 degrees pi/12 rads)\n", | |
"v_0i = 6+(9-6)*np.random.rand(53) # assuming 6 - 9 m/s variance in v0 for sample size of 53\n", | |
"\n", | |
"#2. plug into equation 2:\n", | |
"z_impact = np.zeros(53)\n", | |
"for i in range (0,53):\n", | |
" z_impact[i] = z_coordinate (theta_i[i],v_0i[i])\n", | |
"z_mean = np.mean(z_impact)\n", | |
"z_std = np.std(z_impact)\n", | |
"\n", | |
"#print our data\n", | |
"print (z_impact, \"\\n\")\n", | |
"print (\"z_mean =\", z_mean)\n", | |
"print (\"z_std =\", z_std)\n", | |
"\n", | |
"#3. Compare with class data:\n", | |
"class_data = pd.read_csv(\"../data/target_data.csv\")\n", | |
"class_y = class_data[\" y position (m)\"]\n", | |
"print (\"class mean =\", class_y.mean())\n", | |
"print (\"class std =\", class_y.std())" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 360, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZUAAAD9CAYAAAB0i+q4AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAVEUlEQVR4nO3df7DddX3n8ecLIiDuUpMKYi0hQRw0LJZtj7vsaluWsQvbUsClAhWstlYcHRTcMkNjuopAR1gdwnS1u8R1ZEu6Kri6QGVACxm2i8b2BsUlKAKbKLSosQlCgATQ9/5xzpXDyUnuufd+Tm7gPh8z37n3fL6fX99A7iuf7+d7zk1VIUlSC3vN9QQkSc8fhookqRlDRZLUjKEiSWrGUJEkNbNgricwl17ykpfUkiVL5noakvScsm7duh9V1YHDzs3rUFmyZAkTExNzPQ1Jek5J8t2dnfP2lySpGUNFktTMWEMlySFJPpfkx0keSfL5JItHbFs7OY4eqLdXkuVJNibZluTOJKeO54okSbsytj2VJPsDtwLbgbcCBVwCrEnymqp6bIRurgKuHCj7zsDri4HzgRXAOuAM4NokJ1bVjTO/AknSdI1zo/4dwGHAEVV1H0CSbwL3Au8ELh+hj7+vqrU7O5nkILqBcmlVfbRXvCbJ4cClgKEiSbvROG9/nQSsnQwUgKraANwOnNxojOOBfYDVA+WrgaOSLG00jiRpBOMMlSOBu4aUrweWjdjHu5JsT/J4kluT/OqQMbYD9w2Ur+99HXUcSVID4wyVRcCWIeWbgYUjtF8NvBt4A3A28PPArUm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xX2NrpB8HpgI31Pf9FdffwXunsgj9INhqW9/i/sq/ciuo8kb+md29gr34tuAP4D8DjdldU/HxzHw6P/8KPvJUnNuKciSWrGUJEkNWOoSJKaMVQkSc0YKpKkZgwVSVIzhookqRlDRZLUzP8Hw42LV38O65MAAAAASUVORK5CYII=\n", | |
"text/plain": [ | |
"<Figure size 432x288 with 1 Axes>" | |
] | |
}, | |
"metadata": { | |
"needs_background": "light" | |
}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"#4. Adjust box plot of the robot's data until it is similar to the class data\n", | |
"plt.boxplot (z_impact, labels = [\"robot data\"]);" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 361, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZUAAAD9CAYAAAB0i+q4AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAVhElEQVR4nO3df5SkVX3n8fdHEJBkNc0KYlx+DOJBh8W4SeOygc2yrFnYiGA0AgquRgOsBISckCUwWUTAFaIrHvNrGZNjIuNGxaMLGA5oAEmiYuhBYBlkBBwUEwijM8gvGUC/+8dTHYua6u7qmVvTMP1+nVOnuu9zfz1zputz7nOfqkpVIUlSC89Z6AlIkrYehookqRlDRZLUjKEiSWrGUJEkNbPtQk9gIb3whS+sPffcc6GnIUnPKitXrvxeVe087NiiDpU999yTqamphZ6GJD2rJPn2TMe8/CVJasZQkSQ1Y6hIkpoxVCRJzRgqkqRmDBVJUjOGiiSpGUNFktTMon7zo7SlJNki4/j9SFpohoq0Bcz3xT6JAaFnJS9/SZKaMVQkSc0YKpKkZgwVSVIzYw2VJLsl+UySHyR5KMlnk+w+Ytua4fGqgXrPSXJmknuSPJ7kliRvHM8ZSZJmM7a7v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T/esjx+6vqT+lWBRsd73Mr3aW2owbKj5lhnk8OlP36kHobgGHnP2p76WlcqWgxOx24Hvhqkv9FdylsL+BVVXXKDG2uAl6f5CLg88AvAO8GHpyukOQFdAHxCeAOuhfnI+kuuX2hV+cy4BbgJrqw+TfAYcDFM022qh7sjbssycO9vvYH3jnDPN+W5P/R3d32BuAXh9S7HTgpydHA3cDDVbW61/6MJGcBfw8cAvzaTHOTphkqWrSq6sYkBwLnAn9AdxfXt4GPzdLso8BudO9CP5Fuw/11QP/dUI/ThcXxdLcV/xhYDRxbVZf16vwN8Ca6S2Q70m2C/z7wvjmmfQ4Q4DeAk4Gv9cZfNVDvlF696f6uBN5MFxD9LqTbeP9TupsNrgcOpvs3+Rm625536JUfCnxrjvlpkfOWYklSM+6pSJKaMVQkSc0YKpKkZgwVSVIzhookqRlDRZLUjKEiSWrGUJEkNfP/AfFj1f8xlYvQAAAAAElFTkSuQmCC\n", | |
"text/plain": [ | |
"<Figure size 432x288 with 1 Axes>" | |
] | |
}, | |
"metadata": { | |
"needs_background": "light" | |
}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"#box plot of the class data\n", | |
"plt.boxplot (class_y, labels = [\"class data\"]);" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 377, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"ename": "TypeError", | |
"evalue": "'int' object is not callable", | |
"output_type": "error", | |
"traceback": [ | |
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", | |
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", | |
"\u001b[0;32m<ipython-input-377-7fdfc6b1cf4d>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 27\u001b[0m \u001b[0mx_impact\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mzeros\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m53\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 28\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m53\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 29\u001b[0;31m \u001b[0mz_impact2\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mz_coordinate2\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mv_z\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mv_y\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 30\u001b[0m \u001b[0mx_impact\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mx_coordinate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mv_x\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mv_y\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 31\u001b[0m \u001b[0mz_mean2\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmean\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mz_impact2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |
"\u001b[0;32m<ipython-input-377-7fdfc6b1cf4d>\u001b[0m in \u001b[0;36mz_coordinate2\u001b[0;34m(v_z0, v_y)\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mz_coordinate2\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mv_z0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mv_y\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 8\u001b[0;31m \u001b[0mz\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m3\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mv_z0\u001b[0m\u001b[0;34m/\u001b[0m\u001b[0mv_y\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m9.81\u001b[0m\u001b[0;34m/\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mv_y\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0;36m3\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0;36m0.3\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 9\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mz\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", | |
"\u001b[0;31mTypeError\u001b[0m: 'int' object is not callable" | |
] | |
} | |
], | |
"source": [ | |
"#Bonus with x variation (x(0) = 0)\n", | |
"\n", | |
"def x_cordinate(v_x, v_y):\n", | |
" x = (v_x*3)/v_y \n", | |
" return x\n", | |
"\n", | |
"def z_coordinate2(v_z0, v_y):\n", | |
" z = 3((v_z0/v_y)-(9.81/(2*v_y**2))*3)+0.3\n", | |
" return z\n", | |
"\n", | |
"#Import rcParams to set font styles\n", | |
"from matplotlib import rcParams\n", | |
"\n", | |
"#Set font style and size \n", | |
"rcParams['font.family'] = 'sans'\n", | |
"rcParams['font.size'] = 16\n", | |
"rcParams['lines.linewidth'] = 3\n", | |
"\n", | |
"#1. generate random v_x, v_y, and v_z variables:\n", | |
"\n", | |
"v_x = np.random.rand(53)*0.5 #v_x and v_z should be small relative to v_y, so they will be scaled by 0.5\n", | |
"v_z = np.random.rand(53)*0.5\n", | |
"v_y = 6+(9-6)*np.random.rand(53) #again assuming 6 - 9 m/s variance for v_y\n", | |
"\n", | |
"#2. plug into equations 1.a and 1.b\n", | |
"z_impact2 = np.zeros(53)\n", | |
"x_impact = np.zeros(53)\n", | |
"for i in range (0,53):\n", | |
" z_impact2[i] = z_coordinate2(v_z[i],v_y[i])\n", | |
" x_impact[i] = x_coordinate(v_x[i],v_y[i])\n", | |
"z_mean2 = np.mean(z_impact2)\n", | |
"z_std2 = np.std (z_impact2)\n", | |
"x_mean = np.mean (x_impact)\n", | |
"x_std = np.std (x_impact)\n", | |
"print (z_mean2,z_std2,x_mean,x_std)\n", | |
"\n", | |
"#I can not for the life of me figure out what I'm doing wrong here" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"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.7.3" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 4 | |
} |