{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Workbook for Chapter 11 of Explorations in Computing" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Section 11.2: The Force of Gravity" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### Execute these cells to initialize the notebook:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "from PythonLabs.SphereLab import *" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "%matplotlib tk" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### Exercises: " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "T23. Use the `make_system` function to create the Body objects for the ``two-body'' problem with a watermelon and the Earth:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "T24. Verify the variable `b` is now a list with two objects:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "T25. Call `view_melon` to make a drawing showing the two bodies in this system:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "T26. Type the statement that raises the melon to a position 100 meters above the Earth's surface:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "T27. Print the current height of the melon to verify it was raised to 100 meters:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "T28. Call `step_system` to compute the melon's new position after a time step of one second and print the melon's height again:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "T29. Execute the previous code cell a couple more times. Do you see the melon moving on the canvas?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "T30. Call `view_melon` to clear the dashes from the screen and position the melon 100 meters above the Earth again:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "T31. Call `step_system` with a time step of 0.1 seconds:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "T32. Call the method that updates the position nine more times and get the height of the melon:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "T33. Reinitialize the drawing and reposition the melon at 50 meters:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "T34. Call `drop_melon` to run the simulation with a time step size of 0.5 seconds:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "T35. Repeat the simulation using a smaller time step:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "T36. Use the formula to figure out how long a melon will fall if it is dropped from a seventh-floor balcony that is 35 meters above the ground." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "T37. Reinitialize the screen, reposition the melon at 100 meters above the ground, and assign a velocity of 5 meters/second in the $x$ (horizontal) dimension:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "T38. Run the simulation using a 0.1 second time step:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "T39. How far to the right should the melon move in the amount of time it takes to fall 100 meters?" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "T40. If the scale of the drawing is such that the vertical distance in the path shown on your screen is 100 meters, is the horizontal distance consistent with your answer to the previous problem?" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "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.4.2" } }, "nbformat": 4, "nbformat_minor": 0 }