{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Workbook for Chapter 11 of Explorations in Computing"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Section 11.3: Force Vectors"
]
},
{
"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": [
"T41. Load the data set with the six bodies used in this experiment and initialize the canvas:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"T42. Save the first body in a variable named `f1`, and make two copies of the object, calling them `f2` and `f3`:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"T43. Type the expression that asks Python to print the current location of the first body:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"T44. Move the two copies slightly to the right by adding a small amount to their $x$ coordinates:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"T45. Run the simulation with the first falling body for 10 time steps:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"T46. Edit the previous expression to move the falling body for 40 steps and execute the cell again."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"T47. Were you able to anticipate how the body moved as it got closer to the others?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"T48. Can you guess where the body will be after the next 10 time steps? Type a command to move the body for one time step:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"T49. Keep repeating the previous expression and watch the progress of the falling body."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"T50. Run the experiment again, but this time use `f2`, the green copy of the falling body, and run it for 50 time steps."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"T51. Because the tracks left by `f1` are still on the screen it's easy to compare the trajectories of the two bodies. Can you see how a small change in the starting position of the body led to a pretty big difference after 50 time steps?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"T52. Repeat the command, but move the third (yellow) body:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"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
}