diff --git a/LearningPhysics-Programming.ipynb b/LearningPhysics-Programming.ipynb index 743b2b3..cf46fcf 100644 --- a/LearningPhysics-Programming.ipynb +++ b/LearningPhysics-Programming.ipynb @@ -1,836 +1,826 @@ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", + "# Workshop \"Teaching and Learning with Jupyter Notebooks\" 2021\n", + "C. Hardebolle, CC BY-NC-SA 4.0 Int.\n", + "\n", "
\n", - " Workshop \"Teaching and Learning with Jupyter Notebooks\" 2021
\n", - " C. Hardebolle, CC BY-NC-SA 4.0 Int.

\n", " How to use this notebook?
\n", " This notebook is made of text cells and code cells. The code cells have to be executed to see the result of the program.
To execute a cell, simply select it and click on the \"play\" button () in the tool bar just above the notebook, or type shift + enter.
It is important to execute the code cells in their order of appearance in the notebook.\n", "
" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "

" - ] - }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Learning goals\n", "\n", "After using this notebook, you should be able to:\n", "* Analyze how the position of the cable influences the tension force in the jeans problem\n", "* Describe how the counterweight influences the position of the cable in the jeans problem\n", "* Use Python to make calculations\n", "\n", "

\n", "\n", "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 1. The problem\n", "\n", "The question we are trying to answer in this notebook is the following: \n", "**Estimate which counterweight allows to suspend wet jeans (3kg) on the cable in the position illustrated below.**\n", "\n", "\"suspended\n", "\n", "
\n", " Activity
\n", " \n", "Execute the cell below, then **use the interactive question to vote for the answer you think is correct**:
\n", " A. 1.5 kg
\n", " B. 3 kg
\n", " C. 6 kg
\n", " D. 20 kg
\n", " E. 50 kg or more\n", "
\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from IPython.display import IFrame\n", "IFrame('https://speakup.epfl.ch/ng/room/27058', 600, 600)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "\n", - "**The goal of the activities in this notebook is to help you find the correct answer by exploring how the counterweight affects the position of the jeans suspended on the cable.**" + "**The goal of the activities in this notebook is to help you find out the correct answer** by exploring how the counterweight affects the position of the jeans suspended on the cable." ] }, { "cell_type": "markdown", "metadata": { "toc-hr-collapsed": false }, "source": [ "

\n", "\n", "---" ] }, { "cell_type": "markdown", "metadata": { "toc-hr-collapsed": false }, "source": [ "# 2. Analyzing the problem\n", "\n", "Our first step, as with any problem, should be to analyze the question into more details and this includes:\n", "* Identifying assumptions we can make to simplify the question\n", "* Making a sketch \n", "* Identifying the parameters of the problem" ] }, { "cell_type": "markdown", "metadata": { "toc-hr-collapsed": false }, "source": [ "## How can we simplify the problem?\n", "We can make the assumption that the jeans do not move on the cable, i.e. the whole system is in static equilibrium. \n", "In that case, it is like the cable is attached to fixed points on both sides, we can ignore the pulley. Let's make a sketch.\n", "\n", "\"sketch\"\n", "\n", "Therefore we are in a situation which is **identical to the one seen in the mini-lecture**.
\n", "The only difference is that the cable is attached to poles instead of the ceiling but this doesn't change anything in terms of the forces applied to the jeans, which are:\n", "* the weight $\\vec{F}$ \n", - "* the tensions $\\vec{T}$ on both sides of the cable, which are identical in norm if we assume that the jeans are suspended right in the middle of the cable" + "* the tensions $\\vec{T}$ on both sides of the cable, which are identical in norm if we assume that the jeans are suspended right in the middle of the cable\n", + "\n", + "However we need to figure out where the angle $\\alpha$ is. \n" ] }, { "cell_type": "markdown", "metadata": { "toc-hr-collapsed": false }, "source": [ "## Where is the angle $\\alpha$?\n", - "However we need to figure out where the angle $\\alpha$ is. If we draw a line that represents the horizon, then **the angle $\\alpha$ is the angle between the cable and the horizon**.
\n", + "If we draw a line that represents the horizon, then **the angle $\\alpha$ is the angle between the cable and the horizon**.
\n", "Let's add the forces and the angle to our sketch.\n", "\n", "\"sketch\"\n", "\n", "We can therefore **use the equation seen in the mini-lecture, which gives the tension in the cable** depending on the mass $m$ of the suspended object, the angle $\\alpha$ that the cable makes with the horizon and the gravity of earth $g$:\n", "\n", "$\n", "\\begin{align}\n", "\\lvert\\vec{T}\\rvert = \\frac{\\frac{1}{2}.m.g}{sin(\\alpha)}\n", "\\end{align}\n", "$\n", "\n", "Computing the tension in the cable will help us figure out the counterweight necessary to maintain the cable taught: intuitively, we can predict that **the higher the tension in the cable, the heavier the counterweight needed** to keep the cable taught. \n", "\n", "Now, we know that the mass of the jeans is $m =$ 3kg and that the gravity of earth is $g =$ 9.81m.s$^{-2}$, but we don't know the value of $\\alpha$..." ] }, { "cell_type": "markdown", "metadata": { "toc-hr-collapsed": false }, "source": [ "## How much is the angle $\\alpha$?\n", "\n", "From the sketch in the original question, we can guess that $\\alpha$ is probably quite small, but how small?\n", "\n", - "Of course this depends somewhat on the geometry of the installation. \n", - "In the following, we are going to consider a situation with poles 1.5 meters high, separated by a 5 meter distance.\n", - "\n", - "We are going to use the ``suspendedobjects`` library to visualize concretely what a particular value for $\\alpha$ means in this configuration.\n", + "One option would be to guess a value, but of course this depends somewhat on the geometry of the installation. \n", + "In the following, we are going to consider a situation with poles 1.5 meters high, separated by a 5 meter distance, and we are going to use the ``suspendedobjects`` library to visualize concretely what a particular value for $\\alpha$ means in this configuration.\n", "\n", "
\n", " Activity
\n", " \n", "Execute the code cell below to generate the visualization.
\n", "Then **change the value of ``alpha`` and experiment with multiple values**, to decide which value best reflects the angle in the original question above.\n", "
\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Import the library\n", "from lib.suspendedobjects import *\n", "\n", "# Choose a value for alpha, in degrees\n", "alpha = 20 # CHANGE THE VALUE HERE\n", "\n", "# Build a concrete situation where poles measure 1.5 meters and are distant from 5 meters\n", "lab = SuspendedObjectsLab(m_object = 3, height = 1.5, distance = 5)\n", "\n", "# Visualize the angle\n", "lab.visualize_angle(alpha);" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "So, which value do you think we should use for $\\alpha$?
\n", "\n", "
\n", " Activity
\n", "\n", "Execute the code cell below and **post a message in the chat with the value you suggest for $\\alpha$**.
\n", "If someone already posted the value you were thinking about, simply vote for it (thumb-up icon on the left).\n", "
\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from IPython.display import IFrame\n", "IFrame('https://speakup.epfl.ch/ng/room/50676', 600, 600)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

\n", "\n", "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 2. Computing the tension in the cable with Python\n", "\n", "Now that we have a value for $\\alpha$, we can compute the tension in the cable using the equation from the mini-lecture:\n", "\n", "$\n", "\\begin{align}\n", "\\lvert\\vec{T}\\rvert = \\frac{\\frac{1}{2}.m.g}{sin(\\alpha)}\n", "\\end{align}\n", "$, where $m$ is the mass of the suspended object, $\\alpha$ the angle that the cable makes with the horizon and $g$ the gravity of earth.\n", "\n", "In the following we are going to use Python to **compute the tension in the cable** for **different values of the angle $\\alpha$**." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Creating a function to compute the tension in the cable\n", "\n", "Let's define a Python function that represents the equation of the tension and in which we are going to vary $\\alpha$:\n", "* The function takes one input parameters, `alpha`, which is the angle that the cable makes with the horizon. \n", "* It returns the value of the mass of the counterweight as computed with the equation: \n", "$\n", "\\begin{align}\n", "\\frac{\\frac{1}{2}.m.g}{sin(\\alpha)}\n", "\\end{align}\n", "$\n", "\n", "For this function to work, we need to define the values of two constants in the above equation:\n", "- $m$ the mass of the suspended object, which is 3 kg in the case of the jeans\n", "- $g$ the gravity of earth, which is 9.81 m.s$^{-2}$\n", "\n", "
\n", " Activity
\n", "\n", "**Execute the code cell below** so that this function gets defined in Python.\n", "
\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Let's define the mass of the jeans\n", "m = 3\n", "\n", "# And the value of gravity\n", "g = 9.81\n", "\n", "# Then let's define the function\n", "def tension_norm(alpha):\n", - " return (.5 * m * g) / np.sin(alpha)\n", + " return (1/2 * m * g) / np.sin(alpha)\n", "\n", "# And display a message once it is defined\n", "print(\"Function defined.\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Computing the tension in the cable using our function\n", "\n", "Now let's use this Python function to compute the norm of the tension in the cable for a given angle of $\\alpha$.\n", "\n", "Because our function takes the sinus of our angle $\\alpha$, we first need to convert it from degrees into radians. \n", "This is where the library we have imported gets useful as it provides us with a function `degrees_to_radians` which we can use to convert our angle.\n", "\n", "The code cell below defines a value for $\\alpha$ in degrees, converts it to radians, then computes the tension on the cable using our previously defined function and prints the result." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# First choose an angle alpha\n", "alpha = 20 # CHANGE THE VALUE HERE\n", "\n", "# Then convert it to radians\n", "alpha_radians = degrees_to_radians(alpha)\n", "\n", "# Then compute the tension using our equation\n", "T = tension_norm(alpha_radians)\n", "\n", "# And print the result with a pretty format\n", "display(Math(r'$\\lvert\\vec{T}\\rvert = $'+' {:8.0f} $N $'.format(T)))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", " Activity
\n", "\n", "**Change the value of $\\alpha$ in the code cell above, then execute it** to see the value of the corresponding tension force $\\lvert\\vec{T}\\rvert$, expressed in Newtons. \n", " \n", "You can compare the value you obtain to the force exerted by earth gravity on the jeans, which weight 3 kg: $\\lvert\\vec{F}\\rvert = $ 29 $N$ \n", "Is the tension in the cable bigger or smaller than the weight of the jeans on the cable? Why?\n", "
" ] }, { "cell_type": "raw", "metadata": {}, "source": [ "Just note down your answer here (this cell is for note taking)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

\n", "\n", "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 3. From the tension to the counterweight\n", "\n", "Now how can we relate this tension to the counterweight in our original question? \n", "A key here is to understand that **the tension is transmitted in the cable to the counterweight**, and that **the pulley only changes the direction of the force**, it does not affect its value.\n", "\n", "Therefore the weight $\\vec{F_{cw}}$ of the counterweight will have to compensate exactly the tension $\\vec{T}$ in the cable, as indicated on the sketch below.\n", "\n", "\"sketch\"\n", "\n", "We can write this as an equation: \n", "$\n", "\\begin{align}\n", "\\lvert\\vec{T}\\rvert = \\lvert\\vec{F_{cw}}\\rvert\n", "\\end{align}\n", "$\n", "\n", "Since the weight of the counterweight is $\\lvert\\vec{F_{cw}}\\rvert = m_{cw}.g$, we can therefore write: \n", "$\n", "\\begin{align}\n", "\\lvert\\vec{T}\\rvert = m_{cw}.g\n", "\\end{align}\n", "$\n", "\n", "From there we can find the mass of the counterweight $m_{cw}$: \n", "$\n", "\\begin{align}\n", "m_{cw} = \\frac{\\lvert\\vec{T}\\rvert}{g}\n", "\\end{align}\n", "$\n", "\n", "\n", "Again we can use python to make this simple computation, using the values ``T`` and ``g`` computed earlier." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", " Activity
\n", "\n", "**Execute the code cell below** to see which counterweight would allow to suspend the jeans on the cable with the angle $\\alpha$ you have chosen earlier.\n", "
\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Let's compute the mass of the counterweight to compensate for the tension in the cable\n", "m_cw = T / g\n", "\n", "# And print the result\n", "print(\"Mass of the counterweight: {:.1f} kg\".format(m_cw))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "So let's come back to our question: which counterweight do you think would allow to suspend the jeans (3kg) on the cable in the position illustrated below? \n", - "Did your opinion change after doing the activities above?\n", + "Did your opinion change after doing the activities above (you can check what you voted on the interactive question above in the notebook) ?\n", "\n", "\"suspended\n", "\n", "\n", "
\n", " Activity
\n", "\n", "Execute the code cell below and **post a message in the chat with the counterweight you think is necessary** to suspend the jeans in the desired position. \n", "If someone already posted the value you were thinking about, simply vote for it (thumb-up icon on the left).\n", "
\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from IPython.display import IFrame\n", "IFrame('https://speakup.epfl.ch/ng/room/241665', 600, 600)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

\n", "\n", "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 4. Going further: looking at how the tension in the cable evolves with the angle $\\alpha$\n", "\n", "Now we want to look at **how the tension evolves** when the angle $\\alpha$ changes. \n", "Thanks to our previously defined Python function, we are going to compute the tension in the cable for 100 different values of $\\alpha$, from 20$^\\circ$ to 0$^\\circ$, and plot the result on a graph. \n", "\n", "
\n", " Activity
\n", "\n", "**Execute the code cell below** to see the resulting graph.\n", "
\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Let's define the boundaries of the graph\n", "a_start = 20 # start the angle at 20°\n", "a_stop = 0 # stop at O°\n", "\n", "# Now we generate 100 possible values for the angle alpha between a_start and a_stop (excluded)\n", "a_deg = np.linspace(start=a_start, stop=a_stop, num=100, endpoint = False)\n", "\n", "# Since our previously defined function works with angles expressed in radians, we first convert our list of angles from degrees to radians\n", "a_rad = degrees_to_radians(a_deg)\n", "\n", "# Then we compute the value of the tension for all the 100 possible angles alpha using our previously defined function\n", "t = tension_norm(a_rad)\n", "\n", "# Finally we generate the plot and customize its appearance\n", "fig = figure(title='Tension in the cable', x_axis_label = 'Angle ⍺ (°)', y_axis_label = 'Tension T (N)', x_range=(a_deg[0],0), width=500, height=400, toolbar_location=None)\n", "fig.line(a_deg, t, color=\"red\", line_width=2)\n", "show(fig)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", " Activity
\n", "\n", "What happens to the tension when the angle $\\alpha$ gets closer to 0$^\\circ$? \n", "Could we ever have $\\alpha$ = 0$^\\circ$, i.e. **could we ever pull the cable taught completely horizontally**?\n", " \n", "Note down your answer in the cell below.\n", "
\n" ] }, { "cell_type": "raw", "metadata": {}, "source": [ "Just note down your answer here (this cell is for note taking)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "You can find out the detailed answer to this question below, in the solution section of the notebook." + "You can find out the detailed answer to this question below, in the [solution section of the notebook](#Solution:-Is-it-possible-to-pull-the-cable-taut-completely-horizontally?)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

\n", "\n", "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 5. What have you learned so far?\n", "\n", "
\n", " Activity
\n", "\n", "Write **2 things you have learned** about the **tension force** in a cable that is used to suspend an object:\n", " \n", "
" ] }, { "cell_type": "raw", "metadata": {}, "source": [ "- \n", "- " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "\n", "Can you identify **other real-life situations** in which cables are used to suspend objects or in which cables are taut between poles? \n", "Write 2 ideas:\n", "\n", "
" ] }, { "cell_type": "raw", "metadata": {}, "source": [ "- \n", "- " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "
\n", - "\n", - "Once you are finished with the above questions, **check-in with the instructor**.\n", - "\n", - "
" + "Once you are finished with the above questions, **check-in with the instructor**.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "



\n", "\n", "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Solution: Is it possible to pull the cable taut completely horizontally?\n", "\n", "In this section we demonstrate the physical and mathematical reasoning to answer this question.\n", "\n", "### Goal\n", "\n", "For the cable to be taut completely horizontally means that the angle $\\alpha$ that the cable makes with the horizon is 0$^\\circ$. \n", "In other words, the question could be reframed as: which mass $m_{cw}$ should we put as a counterweight to get $\\alpha$ = 0$^\\circ$?\n", "If we can find a 'reasonable' value for the counterweight then it will mean that it is possible to pull the cable taut completely horizontally.\n", "\n", "To answer this question, we therefore look for an expression relating the **mass of the counterweight $m_{cw}$** and the **angle $\\alpha$** that the cable makes with the horizon.\n", "\n", "\n", "### Method\n", "\n", "Given that the system is in static equilibrium, the sum of external forces exerted on the system will be zero, so using Newton's second law should be easy. The force that the counterweight exerts on the system will involve the mass of the counterweight so we should be able to rewrite Newton's second law to get an expression of the form $m_{cw} = ...$.\n", "\n", "### Hypotheses and simplifications\n", "\n", "We make the following assumptions and simplifications:\n", "* the jeans are considered as positioned exactly mid-way between the poles so the tension is equal on both sides of the cable\n", "* we represent the jeans by the point at which they are suspended\n", "* the cable is considered as rigid (not bended), with a negligible mass\n", "* the pulley is considered as perfect, without mass nor friction\n", "* we consider the static equilibrium obtained after changing the weight, once the system is stabilized\n", "\n", "### Resolution\n", "\n", "First, let's draw a diagram and represent the different forces involved.\n", "\n", "\n", "The *forces applied on the jeans* are:\n", "* the weight: $\\vec F_j = m_j \\vec g$ \n", "* the force exerted by the cable on each side of the jeans: assuming the jeans are suspended at the exact center of the cable, then the tension applied on each of the two sides is equally distributed with two tensions of equal magnitude $T$ on each side but with opposite directions on the $x$ axis, which combine into a vertical resulting tension $\\vec T_r$\n", "\n", "From Newton's second law in a static equilibrium we can write: $\\sum \\vec F_j = \\vec 0$ \n", "With the forces on the jeans we get: $\\vec F_j + \\vec T_r = 0$ \n", "\n", "If we project on $x$ and $y$ axes, we get: \n", "$\\left\\{\\begin{matrix} F_{jx} + T_{rx} = 0 \\\\ F_{jy} + T_{ry} = 0\\end{matrix}\\right. $\n", "\n", "Since $\\vec T_r$ is the result of two tensions of same magnitude $T$ on both sides of the jeans but of opposite directions on the $x$ axis, we can decompose $T_{rx}$ and $T_{ry}$ into the $x$ and $y$ components of $T$: \n", "$\\left\\{\\begin{matrix} T_{rx} = T_{x} - T_{x} \\\\ T_{ry} = 2.T_{y} \\end{matrix}\\right. $\n", "\n", "\n", "Now we can use this in our previous equations, which gives: \n", "$\\left\\{\\begin{matrix} F_{jx} + T_{x} - T_{x} = 0 \\\\ F_{jy} + 2.T_{y} = 0\\end{matrix}\\right. $\n", "\n", "\n", "Since the two $T_{x}$ cancel out we cannot know their value yet and so we focus on the second equation: \n", "$\\begin{align} F_{jy} + 2.T_y = 0 \\end{align}$\n", "\n", "The component of the weight on the y axis is $F_{jy} = - m_j.g$, which gives us: \n", "$\\begin{align} - m_j.g + 2.T_y = 0 \\end{align}$\n", "\n", "Using the angle $\\alpha$ we can get the tension $T_y$ expressed as a function of T since $sin(\\alpha) = \\frac{T_y}{T}$, therefore $T_y = T.sin(\\alpha)$\n", "\n", "By replacing $T_y$ by this expression in the above equation we get: \n", "$\\begin{align} - m_j.g + 2.T.sin(\\alpha) = 0 \\end{align}$\n", "\n", "From there we can get $T$, and this is equation number $(1)$: \n", "\n", "$\n", "\\begin{align}\n", "T = \\frac{m_j.g}{2.sin(\\alpha)}\n", "\\end{align}\n", "$\n", "\n", " \n", "\n", "We now want to make the mass of the counterweight appear in this expression. \n", "So we will now look at the forces applied on the *counterweight*.\n", "\n", " \n", "\n", "The forces applied on the *counterweight* are:\n", "* the weight: $\\vec F_{cw} = m_{cw} \\vec g$ \n", "* the force exerted by the cable: a simple pulley simply changes the direction of the tension so the tension applied on the counterweight is therefore of the same magnitude $T$ as before but with a different direction - we will note it $\\vec T$\n", "\n", "From Newton's second law in a static equilibrium we can write: $\\sum \\vec F_{cw} = \\vec 0$ \n", "With the forces involved in our problem : $\\vec F_{cw} + \\vec T = \\vec 0$ \n", "\n", "All forces being vertical, there is no need to project on $x$ so we get: $- F_{cw} + T = 0$ \n", "We replace the weight by its detailed expression: $-m_{cw}.g + T = 0$ \n", "Now we can express $T$ as a function of the other parameters, which is equation number $(2)$: $T = m_{cw}.g$ \n", "\n", " \n", "\n", "Let's now summarize what we have so far with equations $(1)$ and $(2)$: \n", "\n", "$\n", "\\begin{align}\n", "\\left\\{\\begin{matrix}T = \\frac{m_j.g}{2.sin(\\alpha)} \\\\ T = m_{cw}.g\\end{matrix}\\right. \n", "\\end{align}\n", "$\n", "\n", "These two equations combined give us:\n", "\n", "$\n", "\\begin{align}\n", "\\frac{m_j.g}{2.sin(\\alpha)} = m_{cw}.g\n", "\\end{align}\n", "$\n", "\n", "This allow us to find the mass of the counterweight as a function of the *mass of the jeans* and of the *angle that the cable makes with the horizon*: \n", "\n", "
\n", "\n", "$$m_{cw} = \\frac{m_j}{2.sin(\\alpha)}$$\n", "\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Conclusion\n", "\n", "When the cable approaches the horizon, $\\alpha$ is really small i.e. really close to zero. \n", "This means that $sin(\\alpha)$ is also close to zero, which means in turn that $m_{cw}$ is very big.\n", "Therefore, **the more we want the cable to be close to the horizon, the bigger $m_{cw}$ we will need!**\n", "\n", "Mathematically speaking, the limit of the expression defining the mass of the counterweight when alpha tends to 0 is:\n", "\n", "$\n", "\\begin{align}\n", "\\lim_{\\alpha\\to0}m_{cw} = \\lim_{\\alpha\\to0}\\frac{m_j}{2.sin(\\alpha)} = +\\infty\n", "\\end{align}\n", "$\n", "\n", "So basically, we would need to put an **infinitely heavy counterweight** to make the angle null and that is why it is impossible to get the cable taut so that it is absolutely straight (the cable would break before that!)..." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Numerical application\n", "\n", "We have already defined above the constant `m` which represents the mass of our jeans (3 kg).\n", "\n", "Let's define a Python function that represents the above equation. \n", "The function takes one input parameters, `alpha`, the angle that the cable makes with the horizon. \n", "It returns the mass of the counterweight as computed with the equation above." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Define the function\n", "def counterweight_mass(alpha):\n", " return m / (2 * np.sin(alpha))\n", "\n", "# And display a message once it is defined\n", "print(\"Function defined.\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For an angle $\\alpha$ of $1.5^\\circ$, we need to put a counterweight of:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Choose a value for angle alpha\n", "alpha = 1.5\n", "\n", "# Then convert it to radians\n", "alpha_radians = degrees_to_radians(alpha)\n", "\n", "# Compute the mass of the counterweight using our function\n", "m_cw = counterweight_mass(alpha_radians)\n", "\n", "# And print the result\n", "print('{:.02f} kg'.format(m_cw))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### What happens when we use $\\alpha$ = 0?\n", "\n", "What happens with our piece of Python code when we say that the cable it taut completely horizontal, i.e. the angle $\\alpha$ = 0$^\\circ$, which is actually impossible in real life? \n", "\n", "To find out, change the value of `alpha` to $0$ in the code cell above and re-execute the cell. \n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### What are the consequences?\n", "\n", "It is important to know that high tension in a cable is very dangerous and can lead to serious accidents, especially when the cable is not well adapted for its intended use (i.e. not strong enough) or when the cable is progressively deteriorating with use. \n", "\n", "Execute the cell below to see the video and watch the first minute (sound is not necessary). \n", "What happens at time 0:53? Why?" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from IPython.display import YouTubeVideo\n", "YouTubeVideo('KIbd5zBek5s', 600, 337, start=45, mute=1)" ] } ], "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" }, "toc-autonumbering": false }, "nbformat": 4, "nbformat_minor": 4 }