{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", " WORK IN PROGRESS  This notebook is under development, please bear with us...\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Falling objects - computational exercise\n", "\n", "## 1. Get into the \"Falling objects\" virtual lab\n", "\n", "A. First, do the [exercise with the \"Falling objects\" virtual lab](FallingObjects-exercise.ipynb)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "from lib.fallingobjects import *\n", "FallingObjectsLab();" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "B. Draw a diagram representing the different elements of the code [available in this python file](lib/suspendedobjects.py). " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2. Extend the virtual lab\n", "\n", "You can extend the virtual lab by redefining the following elements:\n", "* The list of the objects available in the lab so that you can add properties to these objects\n", "* The functions representing the equations of motion\n", " \n", "**Goal:** redefine the necessary elements to implement **a quadratic model of air friction** and **Archimed's principle** in the virtual lab.\n", "\n", "### 2.1. Rewrite the functions below" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "###--- Functions representing the equations of the movement as functions of time and the problem parameters\n", "def accel_time_withair(obj, g, h_0, v_0, t):\n", " # TODO to replace!! -->\n", " lamb = obj.k / obj.mass\n", " return -g * np.exp(- lamb * t)\n", " # <--\n", "\n", "def veloc_time_withair(obj, g, h_0, v_0, t):\n", " # TODO to replace!! -->\n", " lamb = obj.k / obj.mass\n", " return (v_0 + (g / lamb)) * np.exp(- lamb * t) - (g / lamb)\n", " # <--\n", "\n", "def height_time_withair(obj, g, h_0, v_0, t):\n", " # TODO to replace!! -->\n", " lamb = obj.k / obj.mass\n", " return (1 / lamb) * (v_0 + (g / lamb)) * (1 - np.exp(- lamb * t)) - (g / lamb) * t + h_0\n", " # <--" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2.2. Extend the list of objects with the characteristics that you need in the equations" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "###--- Static list of objects with which we can experiment.\n", "# Objects come with a number of attributes, of which:\n", "# - a name and a color : mandatory so that the virtual lab executes\n", "# - a mass and a friction coefficient : used by the functions implementing the motion equations, can be replaced or renamed \n", "# as long as the three functions accel_time_withair, veloc_time_withair and height_time_withair are redefined\n", "objects_with_k = [{\n", " 'name':'Bowling ball',\n", " 'mass':5.0,\n", " 'k': (6*np.pi*0.11) * 1.8*10**-5,\n", " 'color':'#DC143C'\n", " },{\n", " 'name':'Tennis ball',\n", " 'mass':0.0567,\n", " 'k': (6*np.pi*0.032) * 1.8*10**-5,\n", " 'color':'#2E8B57'\n", " },{\n", " 'name':'Ping-pong ball',\n", " 'mass':0.0027,\n", " 'k': (6*np.pi*0.02) * 1.8*10**-5,\n", " 'color':'#FF4500'\n", " },{\n", " 'name':'Balloon',\n", " 'mass':0.013,\n", " 'k': 0.02,#(6*np.pi*0.28) * 1.8*10**-5,\n", " 'color':'#000080'\n", "}]\n", "\n", "## Utility function to print objects nicely\n", "def object_string(obj):\n", " return '{!s}:\\n mass = {} kg \\n friction coeff. = {:.2e}'.format(obj.name, obj.mass, obj.k)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2.3. Test your code \n", "\n", "Execute the following cell:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "FallingObjectsLab(objects = objects_with_k, show_withair = True,\n", " accel_time_withair = accel_time_withair, veloc_time_withair = veloc_time_withair, height_time_withair = height_time_withair);" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## References : \n", "\n", "frottements linéaires vs. quadratiques : \n", "\n", "http://www.physagreg.fr/mecanique/m12/M12-chute-libre-frottements.pdf\n", "\n", "https://femto-physique.fr/mecanique/problemes-de-chute.php\n", "\n", "equations avec frottements linéaires :\n", "\n", "https://fr.wikipedia.org/wiki/Frottement_fluide\n", "\n", "equations avec frottements quadratiques :\n", "\n", "http://hyperphysics.phy-astr.gsu.edu/hbase/Mechanics/fallq.html\n", "\n", "https://studylibfr.com/doc/4875224/chute-libre-avec-frottement---gilles-auriol\n", "\n", "https://fr.wikipedia.org/wiki/Chute_avec_r%C3%A9sistance_de_l%27air" ] } ], "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.9" } }, "nbformat": 4, "nbformat_minor": 4 }