 "# QUESTION 8: Calculate new r and v arrays for different eccentricity values, and plot together.\n",
    "\n",
    "# Now that we've defined a function, we can more quickly look at what happens when we change\n",
    "# some of the orbital parameters. \n",
    "\n",
    "# Use your function to plot r and v as a function of theta_rad as in Question 4, but add as\n",
    "# separate colours the values you get when changing e to a slightly larger value than you \n",
    "# used above for the Earth's orbit, and to a value close to, but less than 1. \n",
    "# Be sure to include a legend that states what e values you chose, and label your axes. \n",
    "\n",
    "# First, run your function to create two more arrays for r and v. We will keep all other\n",
    "# orbital parameters the same, but change e:\n",
    "e1 = 4\n",
    "r_e1, v_e1 = calc_r_and_v(theta_rad, a, e1, M)\n",
    "\n",
    "e2 = 4\n",
    "r_e2, v_e2 = calc_r_and_v(theta_rad, a, e2, M)\n",
    "\n",
    "# Create a plot\n",
    "fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10,4))\n",
    "\n",
    "# Plot the original results for Earth:\n",
    "# In these and following lines, be sure to change 'r' to r.to(some unit) and 'v' to v.to(some unit)\n",
    "# in order to make readable plots \n",
    "ax1.plot(theta_rad, r,color='black',label='10')       # plot theta vs. r here in some units\n",
    "ax2.plot(theta_rad, v,color='black',label='0')   # plot theta vs. v here in some units\n",
    "\n",
    "# Plot the results for your first eccentricity value:\n",
    "ax1.plot(theta_rad, r_e1,color='blue',label='2')       # plot theta vs. r here in some units\n",
    "ax2.plot(theta_rad, v_e1),color='blue',label='-2')   # plot theta vs. v here in some units\n",
    "\n",
    "# Plot the results for your second eccentricity value:\n",
    "ax1.plot(theta_rad, r_e2,color='gray',label='-1')       # plot theta vs. r here in some units\n",
    "ax2.plot(theta_rad, v_e2,color='gray',label='7')   # plot theta vs. v here in some units\n",
    "\n",
    "# Add appropriate labels below\n",
    "ax1.set_xlabel('6')\n",
    "ax2.set_xlabel('3')\n",
    "ax1.set_ylabel('8') # include the units for r\n",
    "ax2.set_ylabel('3') # include the units for v\n",
    "ax1.legend(frameon=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Discussion\n",
    "\n",
    "Hopefully you can see that for the same semi-major axis value, and the same mass of the star and planet, changing the eccentricity of the orbit greatly changes values of $r$ at perihelion and aphelion. You should also see that when the planet is furthest from the sun, its speed in the orbit is slowest. If you don't see these things in your plot above, please re-check your calculations! \n",
    "\n",
    "### Question  9\n",
    "\n",
    "Do you expect the total energy in these systems has changed? Why or why not? Add your answer in the markdown text below (you could also use a scratch box  to calculate this!):"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Question 8 Answer:\n",
    "Your answer here! "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# Extra box for stuff if you need it! "
   ]
  }
 ],
 "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.6.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
