python_reference/funstuff/happy_mothers_day.ipynb

128 lines
46 KiB
Plaintext
Raw Normal View History

2014-05-11 16:33:58 +00:00
{
"metadata": {
"name": "",
2014-05-11 17:13:47 +00:00
"signature": "sha256:c47e61a194d5b7fe9015e4a6494048a41f535f22a9a874def78f1a7fc13b1243"
2014-05-11 16:33:58 +00:00
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
2014-05-11 17:13:47 +00:00
"[Sebastian Raschka](http://sebastianraschka.com) \n",
2014-05-11 16:33:58 +00:00
"last updated: 05/11/2014\n",
"\n",
2014-05-11 16:38:08 +00:00
"- Link to [this IPython Notebook](https://github.com/rasbt/python_reference/blob/master/funstuff/happy_mothers_day.ipynb) on GitHub\n",
2014-05-11 17:13:47 +00:00
"- Link to the [GitHub repository](https://github.com/rasbt/python_reference)"
2014-05-11 16:33:58 +00:00
]
},
2014-05-11 16:44:26 +00:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<br>\n",
"<br>"
]
},
2014-05-11 16:33:58 +00:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Happy Mother's Day!"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import numpy as np"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"x = np.arange(-1,1.001,0.001)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 2
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"y1 = (x**2)**(1.0/3) + np.sqrt(1-x**2)\n",
"y2 = (x**2)**(1.0/3) - np.sqrt(1-x**2)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 4
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"%matplotlib inline"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 5
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import matplotlib.pyplot as plt\n",
"\n",
"plt.rcParams.update({'font.size': 12})\n",
"fig = plt.figure(figsize=(8,8))\n",
"plt.plot(x, y1, lw=15, color='r')\n",
"plt.plot(x, y2, lw=15, color='r')\n",
"plt.xlim(-1.2, 1.2)\n",
"plt.title(\"Happy Mother's Day\")\n",
"\n",
"ftext = 'x = np.arange(-1,1.001,0.001)'\\\n",
" '\\ny1 = (x**2)**(1.0/3) + np.sqrt(1-x**2) '\\\n",
" '\\ny2 = (x**2)**(1.0/3) - np.sqrt(1-x**2)'\\\n",
" '\\n\\n\\n[inspired by a MATLAB impl. by TU Delft]'\n",
"plt.figtext(.32,.45, ftext, fontsize=11, ha='left')\n",
"\n",
"plt.show()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAesAAAHtCAYAAAA5qla8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzs3XdYFFf3B/DvAmKhWFFQpAjYaKuigImKxqgx8afGHhv2\nGvVNNLFE0ajJa4lJXktMbJhYorEkJtFYohixYEMU7GIFsaCooPTz++PKhqUssDPb4HyeZx/dnZk7\nZwt7dmbuPVdBRATGGGOMGS0zQwfAGGOMMc04WTPGGGNGjpM1Y4wxZuQ4WTPGGGNGjpM1Y4wxZuQ4\nWTPGGGNGjpM1Y6xYQkNDUa5cOUOHwViZxMmalUnBwcF4++23C1xmZmaGTZs26Tki7ZmZmcHMzAy/\n//57vmXdu3eHmZkZRowYUaI2LSws8OOPP8oVYrGEhobC1dVV6+1v3bqlei3MzMxgbW2N+vXrY9Cg\nQTh+/LiMkTKmf5ysWZmkUCigUCgMHYZsnJ2dsXr1arXH4uPjsXv3bjg5OZX4uSoUCuirXhIRITMz\nU7b2du3ahYSEBFy8eBHfffcdiAhvvvkmvv76a9n2wZi+cbJmZVJJEtG3336LJk2awMbGBg4ODujX\nrx8SEhJUy8PCwmBmZoY//vgDLVq0QMWKFeHt7Y1Dhw4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NnP62RkZKB///4IDg4ucOhIcnKy2nhLW1tbAMCLFy/UkrVSqURUVJTc4THGGGNGydfXt8DC\nTIDM46yzs7MxcOBAVKhQocCi
"text": [
"<matplotlib.figure.Figure at 0x105422790>"
]
}
],
"prompt_number": 6
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[Source: Equation was adopted from a [MATLAB implementation](https://twitter.com/tudelft/status/465500616891330561/photo/1) by researches from Delft University of Technology]"
]
}
],
"metadata": {}
}
]
}