diff --git a/TeachingExamples/01_Demonstrations.ipynb b/TeachingExamples/01_Demonstrations.ipynb index 1418022..f99a272 100644 --- a/TeachingExamples/01_Demonstrations.ipynb +++ b/TeachingExamples/01_Demonstrations.ipynb @@ -1,155 +1,155 @@ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Virtual demonstrations - Using digital artefacts to illustrate explanations\n", "\n", "Classroom demonstrations, i.e. showing phenomena in class, make great illustrations that stimulate students’ interest and motivation. \n", "Jupyter Notebooks allow you to design very easily *virtual demonstrations* to show students *things that you could not demonstrate in real life*.\n", "\n", "But how to make sure that your demonstrations are **more than just entertainment**?\n", "\n", "A few simple ingredients can transform your virtual demonstrations into *powerful teaching and learning tools*. On this page, we summarize briefly some of the [ideas from research on the impact of demonstrations on students learning](#Ingredients-for-effective-virtual-demonstrations-in-class) and share with you [example notebooks](#Examples) which implement these ideas in practice.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ingredients for effective virtual demonstrations in class\n", "\n", "### Questions\n", "\n", "Questions can really help students engage actively with your demonstration: \n", "* Catherine Crouch and her colleagues from Harvard University have shown that having students **predict the outcome of a demonstration before observing it** makes an essential difference in terms of what students remember and understand from a demonstration [(Crouch et al., 2004)](https://aapt.scitation.org/doi/10.1119/1.1707018). This result has been reproduced in a number of other studies, and the reason why this technique works so well seems to be fundamentally linked to how our brain works, according to relatively recent models [(Dehaene, 2011)](https://www.college-de-france.fr/site/en-stanislas-dehaene/course-2011-2012.htm). \n", "* When observing a demonstration, it can be hard for students to focus their attention at the right place at the right time. Asking them **questions that drive them to observe specific features** of what you are showing can greatly help them see what you want them to see. \n", "* Very often, students have a hard time identifying what they need to remember from a demonstration. Asking them **questions at the end of a demonstration to reflect on the important points** which have been illustrated is a very effective way to draw their attention to the right elements.\n", "\n", "

\n", "Key points:
\n", " For a maximized impact on learning, ask students questions before (prediction questions), during (observation questions) and after (reflection questions) your demonstrations with notebooks.\n", "

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Multiple representations\n", "\n", "Presenting students with multiple representations of concepts has been shown to have positive effects on learning [(Mayer, 2009)](http://dx.doi.org/10.1017/CBO9780511811678). Graphical visualizations play an important role in this, but it has been shown that it is the combination of the representations which actually is efficient, which means that *text, equations, tables, videos* or other types of embedded media also are important.\n", "\n", "Two key elements are worth considering particularly in virtual demonstrations:\n", "* Showing explicitely (through visual cues, text, arrows, etc.) **how the different representations relate to each other** is a great way to illustrate different ways of modeling the same reality, which is essential for students to develop their modeling skills.\n", "* Presenting students with the **type of representations that they need to use** when they solve problems in your discipline (for instance when they need to analyze the situation, when they need to choose a model or when they need to check their solution) can help your students develop their problem solving skills \n", "\n", "\n", "

\n", "Key points:
\n", " Virtual demonstrations can serve as a bridge to develop problem solving skills if you design your notebooks with multiple connected representations, which match the representations you want students to use when solving problems.\n", "

\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Discussions with peers\n", "\n", "Usually, the \"why\" things happen is more important than the \"what\" happens in a demonstration. However, it is very difficult for students with a prior misconception to really change their understanding if they do not realize that they have a misconception.\n", "A key to effective demonstrations is therefore to give students an opportunity to **formulate** why they think things happen that way, as a mean for them to clarify their own thinking before hearing your own explanation.\n", "\n", "A simple tool to do this is peer discussion. By encouraging students to **discuss the \"why\" with others**, you give them a chance to put words on the implicit model they have in mind and to confront it to the reasoning of others. After verbalizing their understanding of the concepts, students will be better able to assess it against your own explanations, which will then have much more impact.\n", "\n", "

\n", "Key points:
\n", " To help students develop their reasoning, have them discuss \"why\" things happen this way in the virtual demonstration with their peers before presenting your own explanation.\n", "

\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " \n", "\n", "## Examples\n", "\n", "The following examples show how using the above elements in demonstrations can look like, in different formats:\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
What is involved?Show me an example
\"Low tech\"Ask students questions which they have to answer on a piece of paper.

Show visualizations that you want students to use when they solve problems.
Have a look at the falling objects demo
Interactive questionsUse the notebook to poll students using interactive questions where students vote for the answer of their choice.

Combine and synchronize interactively a diagram and different function plots.
[WORK IN PROGRESS]
Have a look at the suspended objects demo
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " \n", "\n", "## Sharing your demonstration notebooks with students\n", "\n", "Making the virtual demonstrations available to the students can be a good idea. But how will students know (or remember) which parameters to change and what to observe? \n", "By **including questions and instructions** into the notebook together with the virtual demonstration, you will ensure that students can use them effectively in autonomy.\n", "\n", "Have a look at the examples of notebooks for exercises or assignements.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " \n", "\n", "## Bibliography\n", "\n", "Crouch, C., Fagen, A. P., Callan, J. P., & Mazur, E. (2004). Classroom demonstrations: Learning tools or entertainment? American Journal of Physics, 72(6), 835–838. \n", "https://aapt.scitation.org/doi/10.1119/1.1707018\n", "\n", "Dehaen, S. (2011). The Statistician Brain: The Bayesian Revolution in Cognitive Sciences. Lectures at Collège de France. \n", "https://www.college-de-france.fr/site/en-stanislas-dehaene/course-2011-2012.htm\n", "\n", "Mayer, R. E. (2009). Multimedia learning (2nd ed.). Cambridge University Press. \n", "http://dx.doi.org/10.1017/CBO9780511811678\n" ] } ], "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.8" + "version": "3.6.9" } }, "nbformat": 4, "nbformat_minor": 4 } diff --git a/TeachingExamples/FallingObjects-computational.ipynb b/TeachingExamples/FallingObjects-computational.ipynb index fecdd2a..ec5adf3 100644 --- a/TeachingExamples/FallingObjects-computational.ipynb +++ b/TeachingExamples/FallingObjects-computational.ipynb @@ -1,193 +1,193 @@ { "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.8" + "version": "3.6.9" } }, "nbformat": 4, "nbformat_minor": 4 } diff --git a/TeachingExamples/SuspendedObjects-exercise.ipynb b/TeachingExamples/SuspendedObjects-exercise.ipynb index 87f8643..e0a1089 100644 --- a/TeachingExamples/SuspendedObjects-exercise.ipynb +++ b/TeachingExamples/SuspendedObjects-exercise.ipynb @@ -1,244 +1,302 @@ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "

Use case scenario
\n", " This notebook is made to be used by students as an assignment or exercise, in autonomy (at home or in an exercise session).

\n", "

Features
\n", " This notebook embeds auto-corrected quizzes to engage students with the virtual demonstration and uses different types of visualisations to help students understand the phenomena.
\n", " The example chosen is voluntarily simple so that anyone can understand what is illustrated and focus the pedagogical features of the example.

\n", "

More information on using notebooks for exercises or assignements.

\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Suspended objects\n", "\n", "We consider a clothesline made of two poles and a cable.\n", "The cable is fixed on one pole. A pulley on the other pole allows to attach a counterweight to pull the cable taut. \n", "\n", "\n", "\n", "## Exercise 1\n", "Execute the cell below to activate the interactive quiz and answer the question. \n", "If you don't see the question, make sure you are logged on [moodle](https://moodle.epfl.ch/enrol/index.php?id=15917) and registered on our [Noto Community moodle page](https://moodle.epfl.ch/enrol/index.php?id=15917).\n", "\n", "" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "from IPython.display import IFrame\n", "IFrame('https://moodle.epfl.ch/mod/hvp/embed.php?id=1028285', 500, 600)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Exercise 2\n", "\n", "The virtual lab below allows you to experiment with different counterweights to see how it affects the position of the object suspended on the clothesline. \n", "Execute the cell below to launch the virtual lab, then *answer the questions in the quiz below*." ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "bd3abfd177574f2aa6c204469efd5739", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "VBox(children=(Output(layout=Layout(margin='5px 10px')), HBox(children=(Label(value='Mass of the counterweight…" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "%matplotlib inline\n", "from lib.suspendedobjects import *\n", "SuspendedObjectsLab();\n", "IFrame('https://h5p.org/h5p/embed/584119', 1024, 350)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "*If you wonder how the virtual lab works and would like to see the code, [you can have a look at it at the end of this notebook](#How-does-the-virtual-lab-work%3F).*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Exercise 3\n", "\n", "1. Give the expression of the **mass of the counterweight $m_{cw}$ as a function of the other parameters of the problem**.\n", "2. Application: what counterweight allows to suspend wet jeans ($m = 3 kg$) on the cable so that the cable is taut at an angle of $1.5^\\circ = \\frac{\\pi}{120}$ with the horizon?\n", "3. Why is it impossible to pull the cable taut completely horizontally?\n", "\n", " \n", "\n", "## Solution\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 is equally distributed $\\vec T$, which combine into a vertical resulting tension $\\vec T_r = 2.\\vec T$\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", "Using the fact that the tension is equal on both sides of the jeans we get: $\\vec F_j + 2.\\vec T = 0$\n", "\n", "If we project on $x$ and $y$ axes, we get: \n", "$\\left\\{\\begin{matrix} F_{jx} + 2.T_x = 0 \\\\ F_{jy} + 2.T_y = 0\\end{matrix}\\right. $\n", "\n", "Since the weight does not have a component on the x axis, it simplifies into: \n", "$\\left\\{\\begin{matrix} T_x = 0 \\\\ F_{jy} + 2.T_y = 0\\end{matrix}\\right. $\n", "\n", "The component of the weight on the y axis is $F_{jy} = - m_j.g$, which gives us: \n", "$\\left\\{\\begin{matrix} T_x = 0 \\\\ - m_j.g + 2.T_y = 0\\end{matrix}\\right. $\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", "$\\left\\{\\begin{matrix} T_x = 0 \\\\ - m_j.g + 2.T.sin(\\alpha) = 0\\end{matrix}\\right. $\n", "\n", "From there we can get $T$, and this is equation number $(1)$: \n", "$T = \\frac{m_j.g}{2.sin(\\alpha)}$\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 line: a simple pulley simply changes the direction of the tension so the tension applied on the counterweight is therefore $\\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", "$\\left\\{\\begin{matrix}T = \\frac{m_j.g}{2.sin(\\alpha)} \\\\ T = m_{cw}.g\\end{matrix}\\right. $\n", "\n", "These two equations combined give us:\n", "\n", "$\\frac{m_j.g}{2.sin(\\alpha)} = m_{cw}.g$\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 line makes with the horizon*: \n", "\n", "$\\boxed{m_{cw} = \\frac{m_j}{2.sin(\\alpha)}}$\n", "\n", "\n", " \n", "\n", "### Application\n", "\n", "For a pair of wet jeans of $3 kg$ and an angle of $1.5^\\circ = \\frac{\\pi}{120}$, we need to put a counterweight of:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "mcw = 3 / (2 * np.sin(np.pi / 120))\n", "print(mcw)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can **check that you get a similar result** with the virtual lab above!\n", "\n", "\n", "### Conclusion\n", "\n", "For the line to be taut completely horizontal, $\\alpha$ has to be really small i.e. really close to zero. \n", "This means that $sin(\\alpha)$ will also be close to zero, which means in turn that $m_{cw}$ will be very big.\n", "Actually, **the more we want the line to be close to the horizon, the bigger $m_{cw}$ we will need!**\n", "In fact, it is impossible to get the line taut so that it is absolutely straight...\n", "\n", " " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " \n", "\n", "---\n", "\n", "# How does the virtual lab work?\n", "\n", "If you wonder how the virtual lab works: \n", "* You can have a look at the code of the virtual lab by [opening this python file](lib/suspendedobjects.py).\n", "* You can see the documentation by executing the cell below:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "SuspendedObjectsLab?" ] } ], "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.8" + "version": "3.6.9" } }, "nbformat": 4, "nbformat_minor": 4 } diff --git a/TeachingExamples/SuspendedObjects-textbook.ipynb b/TeachingExamples/SuspendedObjects-textbook.ipynb index 0eb1526..61aab78 100644 --- a/TeachingExamples/SuspendedObjects-textbook.ipynb +++ b/TeachingExamples/SuspendedObjects-textbook.ipynb @@ -1,288 +1,326 @@ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", " WORK IN PROGRESS  This notebook is under development, please bear with us...\n", "
" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "\n", "from ipywidgets import interact, interactive, fixed, interact_manual\n", "from ipywidgets import HBox, VBox, Label\n", "import ipywidgets as widgets\n", "\n", "%matplotlib inline\n", "import matplotlib.pyplot as plt\n", "plt.style.use('seaborn-whitegrid') # global style for plotting" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Suspended objects\n", "\n", "**Question:** Estimate which counterweight allows to suspend wet jeans (3kg) on the cable so that the cable is taut as shown on the diagram below? \n", "\n", "\n", "\n", "Select your answer below, then use the virtual lab to determine *order of magnitude* of the mass necessary for the counterweight." ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0e440414664448df8ff42afea7df42e7", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "interactive(children=(Dropdown(description='w', options=(('1,5 kg', 1.5), ('3 kg', 3), ('6 kg', 6), ('20 kg', …" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "f = lambda w: \"Choice registered: \"+str(w)\n", "interact(f, w=[('1,5 kg', 1.5), ('3 kg', 3), ('6 kg', 6), ('20 kg', 20), ('50 kg or more', 50)]);" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Virtual lab" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# Parameters of the situation\n", "m_jeans = 3 # mass of the wet jeans, in kg\n", "\n", "distance = 5 # distance between the poles, in m\n", "height = 1.5 # height of the poles, in m\n", "\n", "x_origin = 0 # x coordinate of point of origin of the figure = x position of the left pole, in m\n", "y_origin = 0 # y coordinate of point of origin of the figure = y position of the lower point (ground), in m" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "# Compute the angle that the line makes with the horizon depending on the counterweight chosen\n", "def get_alpha_from_masses(m_jeans, m_counterweight):\n", " # default angle value \n", " alpha = np.pi / 2\n", " \n", " # let's check that there is actually a counterweight\n", " if m_counterweight > 0:\n", " # then we compute the ratio of masses\n", " ratio = 0.5 * m_jeans / m_counterweight\n", "\n", " # we check if the ratio of masses is in the domaine of validity of arcsin ([-1;1]) and compute the angle\n", " if ratio >= -1 and ratio <= 1:\n", " alpha = np.arcsin(ratio)\n", " \n", " return alpha\n", "\n", "# Update the position of the jean from the angle\n", "def update_jeans(angle, x_origin, y_origin, distance, height):\n", " # the jean is midway between the poles\n", " x_jeans = x_origin + 0.5 * distance\n", " \n", " # default y value: the jean is on the ground \n", " y_jeans = y_origin \n", " \n", " # we check that the angle is comprised between horizontal (greater than 0) and vertical (smaller than pi/2)\n", " if angle > 0 and angle < (np.pi / 2): \n", " # we compute the delta between the horizon and the point given by the angle\n", " delta = (0.5 * distance * np.tan(angle))\n", " # we check that the delta is smaller than the height of the poles (otherwise it just means the jean is on the ground)\n", " if delta <= height:\n", " y_jeans = y_origin + height - delta\n", " \n", " print(\"height of the point at which the jeans are hanged:\", y_jeans) \n", " \n", " return [x_jeans, y_jeans]" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "8fe914a428364f3c8b45134cf1862423", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "interactive(children=(FloatSlider(value=0.0, description='m_counterweight', step=0.5), Output()), _dom_classes…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "# Create visualisation\n", "def create_graph(m_counterweight = 0):\n", " # get angle of line then coordinates of jean\n", " alpha = get_alpha_from_masses(m_jeans, m_counterweight)\n", " coord_jeans = update_jeans(alpha, x_origin, y_origin, distance, height)\n", "\n", " # Create the figure\n", " fig, ax = plt.subplots(1, figsize=(12, 4))\n", " \n", " # Fix graph to problem boundaries\n", " ax.set_ylim(bottom = y_origin) # limit bottom of y axis to ground\n", " ax.set_ylim(top = y_origin + height + .2) # limit top of y axis to values just above height\n", "\n", " # Draw poles\n", " x_pole1 = np.array([x_origin, x_origin])\n", " y_pole1 = np.array([y_origin, y_origin+height])\n", " ax.plot(x_pole1, y_pole1, \"b-\")\n", " x_pole2 = np.array([x_origin+distance, x_origin+distance])\n", " y_pole2 = np.array([y_origin, y_origin+height])\n", " ax.plot(x_pole2, y_pole2, \"b-\")\n", "\n", " # Draw the hanging line\n", " x = np.array([x_origin, coord_jeans[0], x_origin+distance])\n", " y = np.array([y_origin+height, coord_jeans[1], y_origin+height])\n", " ax.plot(x, y, \"ro-\")\n", "\n", "\n", "# Launch interactive visualisation\n", "interact(create_graph, m_counterweight=(0, 100, .5)); \n", "## TODO ideas : draw the forces (tension in cable, resulting tension)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Conceptual explanation\n", "\n", "TODO" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Analytic explanation\n", "\n", "### Hypotheses and simplifications:\n", "\n", "* the jeans are exactly mid-way between the poles so the tension is equal on both sides of the cable\n", "* we represent the jeasn by the point at which they are suspended\n", "* the cable is considered as rigid (not bended)\n", "* we consider the static equilibrium obtained after changing the weight, once the system is stabilized\n", "\n", "### Resolution\n", "\n", "We are looking for the expression of the mass of the counterweight as a function of the other parameters of the problem.\n", "\n", "\n", "\n", "The forces applied on the *jeans* are the following:\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 is equally distributed $\\vec T$, which combine into a vertical resulting tension $\\vec T_r = 2.\\vec T$\n", "\n", "From Newton's second law in a static equilibrium we can write: $\\sum \\vec F_j = \\vec 0$\n", "\n", "With the forces: $\\vec F_j + \\vec T_r = 0$\n", "\n", "Using the fact that the tension is equal on both sides of the jeans: $\\vec F_j + 2.\\vec T = 0$\n", "\n", "If we project on $x$ and $y$ axes, we get:\n", "\n", "$\\left\\{\\begin{matrix} F_{jx} + 2.T_x = 0 \\\\ F_{jy} + 2.T_y = 0\\end{matrix}\\right. $\n", "\n", "Since the weight does not have a component on the x axis, it simplifies into:\n", "\n", "$\\left\\{\\begin{matrix} T_x = 0 \\\\ F_{jy} + 2.T_y = 0\\end{matrix}\\right. $\n", "\n", "NB: $T_x = 0$ means that the tension on each side of the jeans cancel out.\n", "\n", "The component of the weight on the y axis is $F_{jy} = - m_j.g$, which gives us:\n", "\n", "$\\left\\{\\begin{matrix} T_x = 0 \\\\ - m_j.g + 2.T_y = 0\\end{matrix}\\right. $\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", "So we get:\n", "\n", "$\\left\\{\\begin{matrix} T_x = 0 \\\\ - m_j.g + 2.T.sin(\\alpha) = 0\\end{matrix}\\right. $\n", "\n", "From there we can get $T$:\n", "\n", "$T = \\frac{m_j.g}{2.sin(\\alpha)}$ $(1)$\n", "\n", "\n", "On the other hand, the forces applied on the *counterweight* are following:\n", "* the weight: $\\vec F_{cw} = m_{cw} \\vec g$ \n", "* the force exerted by the line: a simple pulley simply changes the direction of the tension so the tension applied on the counterweight is therefore $\\vec T$\n", "\n", "From Newton's second law in a static equilibrium we can write: $\\sum \\vec F_{cw} = \\vec 0$ \n", "\n", "With the forces: $\\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", "\n", "With the detail of the weight: $-m_{cw}.g + T = 0$\n", "\n", "Which gives us $T = m_{cw}.g$ $(2)$\n", "\n", "From equations $(1)$ and $(2)$ we get:\n", "\n", "$\\left\\{\\begin{matrix}T = \\frac{m_j.g}{2.sin(\\alpha)} \\\\ T = m_{cw}.g\\end{matrix}\\right. $\n", "\n", "Which allows us to find the mass of the counterweight as a function of the *mass of the jeans* and of the *angle that the line makes with the horizon*:\n", "\n", "$m_{cw} = \\frac{m_j}{2.sin(\\alpha)}$\n", "\n", "For the line to be taut as show on the figure, $\\alpha$ has to be really small i.e. close to zero. \n", "This means that $sin(\\alpha)$ will also be close to zero, which means in turn that $m_{cw}$ will be very big.\n", "Actually, **the more we want the line to be close to the horizon, the bigger $m_{cw}$ we will need!**\n", "In fact, it is impossible to get the line taut so that it is absolutely straight...\n", "\n", "### Application\n", "\n", "For a pair of wet jeans of $3 kg$ and an angle of $4^\\circ = \\frac{\\pi}{45}$, which is approximately like depicted on the figure, we need to put a counterweight of more than 20 kg!\n", "\n", "You can try out the manual calculation below and check that you get a similar result with the virtual lab above:" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "21.503380539305514\n" + ] + } + ], "source": [ "m_j = 3\n", "alpha = np.pi / 45\n", "\n", "m_cw = m_j / (2 * np.sin(alpha))\n", "print(m_cw)" ] } ], "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.8" + "version": "3.6.9" } }, "nbformat": 4, "nbformat_minor": 4 } diff --git a/TeachingHowTos/EmbedQuizQuestions.ipynb b/TeachingHowTos/EmbedQuizQuestions.ipynb index 33a52a5..7b08c05 100644 --- a/TeachingHowTos/EmbedQuizQuestions.ipynb +++ b/TeachingHowTos/EmbedQuizQuestions.ipynb @@ -1,232 +1,210 @@ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# How to add auto-corrected quiz questions to my notebooks?\n", "\n", "\n", "
\n", "\"Moodle\n", "\"Moodle\n", "
\n", "\n", "Interactive quiz questions are a great way to engage students with the content of the notebook and to help them check their understanding. \n", "In this notebook, we present how to **create quiz questions in moodle** (using the H5P plugin) and **embed the questions into your notebooks**. \n", "\n", "The figure on the right shows an example of what it can look like, before and after a student submits an answer.\n", "\n", "To see an example of a notebook including quiz questions, have a look at our [\"Suspended Objects\" example](../TeachingExamples/SuspendedObjects-exercise.ipynb) or at the [demo](#DemoSection) at the end of this notebook. \n", "\n", "
 
\n", "\n", "\n", "## Why use moodle?\n", "\n", "

There are other ways to integrate quiz questions into notebooks but the solution we suggest here has a very important characteristic: the data collected on students' responses is stored on the EPFL moodle server.
\n", "This is extremely important in order to be consistent with the data protection and professional confidentiality provisions of Swiss law.

\n", "\n", "In addition, using moodle to create quiz questions has **a number of advantages**:\n", "* The moodle H5P plugin for creating quiz questions offers a [wide range of question types](https://h5p.org/content-types-and-applications) with multiple options to customize them ;\n", "* You don't need to write code to correct the quiz questions, the moodle H5P plugin has multiple options that allow you to give feedback automatically to students when they answer the quiz ;\n", "* In your moodle page, you will be able to see how people answer your quiz question, which can give you useful feedback ;\n", "* The quiz questions that you create in moodle can be reused for different purposes (e.g. learning activities in moodle) and they can also be exported / imported.\n", "\n", "However, this solution (as any other) has some limitations.\n", "\n", "## Limitations \n", "\n", "You need to **have a moodle course page** for creating the quiz questions and you need to have the \"teacher\" (or \"manager\") role on this page to be able to edit it. \n", "We suggest you use the moodle page of one of your courses. In case this is not possible or not adapted for your project, don't hesitate to [contact us](mailto:noto-support@groupes.epfl.ch) to discuss other options.\n", "\n", "One important limitation of this is that **the way in which you set up registrations on your moodle course** will impact **who can see your quiz questions in your notebooks**. \n", "Please check below who will have access to your quiz questions before anything else. \n", "\n", " \n", "\n", "## Step 0: check who will have access to your quiz questions \n", "\n", "In your moodle course, go to the \"Participants\" page, check the \"Enrolment methods\" which are activated on your course.\n", "\n", "Here is who will have access to your quiz questions depending on the enrolment methods activated (these enrolment methods can be combined):\n", "1. **\"External database\"**: students who are registered on your course on IS-Academia have access to your quiz questions. \n", "This is the option recommanded so that your students can use your quiz questions.\n", "1. **\"Manual enrolment\"**: you have to add manually the persons who will have access to your quiz questions (they need to have a GASPAR account).\n", "1. **\"Self enrolment\"**: anyone with a GASPAR account can register to your course and have access to your quiz questions. \n", "This is the option recommanded so that any EPFL students and member of EPFL staff can use your quiz questions.\n", "1. **\"Guest access\"**: anyone from the general public can see your moodle page and have access to your quiz questions without being logged on. \n", "This is the option recommanded so that the general public can use your quiz questions. However, one important drawback of this method is that you will no longer be able to see how people answer your quiz (and it also means the whole content of your moodle page is public).\n", "\n", "Please note that for methods 1, 2 and 3, people have to be **logged on moodle** when they use your notebooks so that they see your quiz questions. It is recommended to add a short sentence indicating that if they don't see the quiz then they need to log on moodle.\n", "\n", "Make sure to activate the appropriate enrolment methods depending on the audience who will use your notebooks. \n", "When someone does not have access as per the enrolment methods above, here is what they see in place of the quiz question in the notebook:\n", "\n", "\"No\n", "\n", "\n", " \n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Step 1: create a quiz question in moodle\n", "\n", "\n", "You need to *turn editing on* your moodle page before proceeding to the next steps.\n", "\n", "

Add a hidden section to your moodle page

\n", "\n", "We suggest that you create an additional section (\"topic\") in your moodle course page, which will serve as a container for your quiz questions. \n", "To add a section, then go at the bottom of the moodle page and click on \"Add topics\".\n", "\n", "We also suggest that you hide this section from your moodle page so that the quiz question are visible only in the notebooks - of course, if you want your students to see the questions in your moodle page then skip this step. \n", "At the top of the section, select \"Edit\" then \"Hide topic\". A blue tage should appear just below the title of the section saying `Hidden from students`.\n", "\n", "\n", "

Create a question

\n", "\n", "To create a new quiz question, use the \"Add an activity\" dropdown menu and then choose \"Interactive content\" as shown on the figure below. \n", "Attention: do not select the \"quiz\" option in the dropdown menu (this type of quiz cannot be embedded in a notebook).\n", "\n", "\"Interactive\n", "\n", "Select the type of question that you want in the list and click on it.\n", "\n", "\"Content\n", "\n", "Fill out the form to create your question, then choose \"Save and return to course\".\n", "\n", "

Make the question available

\n", "\n", "If your question is placed in a hidden section as we have suggested, then you have to indicate to moodle that you want to make the quiz question available outside of moodle (i.e. in your notebooks). On the right side of the activity, select the \"Edit\" menu and then click on \"Make available\", as shown on the image below. \n", "NB: this step is not necessary if the question is in a visible section of the moodle page (by default it is then available).\n", "\n", "\"Make\n", "\n", "Once this is done, a blue tag saying `Available but not shown on course page` should appear right below your quiz question.\n", "\n", " " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Step 2: embed the question into a notebook\n", "\n", "

Get the URL of your question

\n", "\n", "From your moodle page, click on your new question. This will open your question and show you how it will look like for students. \n", "Click on the \"<> Embed\" link at the bottom of the question, as shown on the figure below. Copy the code which appears in the \"Embed\" popup.\n", "\n", "\"Embed\"\n", "\n", "Paste the code into your favorite text editor and find the URL of the question, which should appear between quotes after ` ') \n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Demo \n", "\n", "To be able to see the demo quiz question, you need to be logged on moodle and registered as participant on our moodle course (see the [Limitations section](#LimitationsSection)). \n", "Please open a new tab or window, **log on [moodle](https://moodle.epfl.ch/enrol/index.php?id=15917)** and **register yourself on the [Noto Community moodle page](https://moodle.epfl.ch/enrol/index.php?id=15917)**. \n", "\n", "Then execute the cell below to activate the interactive quiz. \n", "\n", "" ] }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "execution_count": 1, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "from IPython.display import IFrame\n", "IFrame('https://moodle.epfl.ch/mod/hvp/embed.php?id=1028285', 800, 600)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you see the message `Vous n'avez pas accès à ce contenu. Essayez de vous connecter.`, check that you are logged on [moodle](https://moodle.epfl.ch/) using your GASPAR account and that you are registered as participant on the [Noto Community moodle page](https://moodle.epfl.ch/enrol/index.php?id=15917)." ] } ], "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 }