diff --git a/TeachingExamples/SuspendedObjects-exercise.ipynb b/TeachingExamples/SuspendedObjects-exercise.ipynb index c885a2c..294133d 100644 --- a/TeachingExamples/SuspendedObjects-exercise.ipynb +++ b/TeachingExamples/SuspendedObjects-exercise.ipynb @@ -1,338 +1,339 @@ { "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", + "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": 11, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " " ], "text/plain": [ "" ] }, "execution_count": 11, "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": 12, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "60cb76d0d81041be8e26c7115a8888e4", "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": 12, "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": 13, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "57.30232502116567\n" ] } ], "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": 14, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "\u001b[0;31mInit signature:\u001b[0m\n", "\u001b[0mSuspendedObjectsLab\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n", "\u001b[0;34m\u001b[0m \u001b[0mm_object\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m3\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", "\u001b[0;34m\u001b[0m \u001b[0mdistance\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m5\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", "\u001b[0;34m\u001b[0m \u001b[0mheight\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", "\u001b[0;34m\u001b[0m \u001b[0mx_origin\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", "\u001b[0;34m\u001b[0m \u001b[0my_origin\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", "\u001b[0;34m\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mDocstring:\u001b[0m This class embeds all the necessary code to create a virtual lab to study the static equilibrium of an object suspended on a clothesline with a counterweight.\n", "\u001b[0;31mInit docstring:\u001b[0m\n", "Initiates and displays the virtual lab on suspended objects.\n", "\n", ":m_object: mass of the suspended object\n", ":distance: horizontal distance between the two poles\n", ":height: height of the poles (same height for both)\n", ":x_origin: x coordinate of the bottom of the left pole (origin of the coordinate system)\n", ":y_origin: y coordinate of the bottom of the left pole (origin of the coordinate system)\n", "\u001b[0;31mFile:\u001b[0m ~/git_Noto/noto-poc-notebooks/TeachingExamples/lib/suspendedobjects.py\n", "\u001b[0;31mType:\u001b[0m type\n", "\u001b[0;31mSubclasses:\u001b[0m \n" ] }, "metadata": {}, "output_type": "display_data" } ], "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" } }, "nbformat": 4, "nbformat_minor": 4 } diff --git a/TeachingHowTos/EmbedQuizQuestions.ipynb b/TeachingHowTos/EmbedQuizQuestions.ipynb index 8996e79..621aa5b 100644 --- a/TeachingHowTos/EmbedQuizQuestions.ipynb +++ b/TeachingHowTos/EmbedQuizQuestions.ipynb @@ -1,216 +1,218 @@ { "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 righ shows an example of what it can look like, before and after a student submits an answer.\n", "\n", - "
 
\n", + "To see an example of a notebook including quiz questions, have a look at our [\"Suspended Objects\" example](../TeachingExamples/SuspendedObjects-exercise.ipynb). \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](#Step-0:-check-who-will-have-access-to-your-quiz-questions) 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 and check the \"Enrolment methods\" which are activated on your course.\n", "\n", - "Here is who will have access to your quiz questions (these enrolment methods can be combined):\n", + "Here is who will have access to your quiz questions depending on the enrolment methods activated (these enrolment methods can be combined):\n", "* **\"External database\"**: students who are registered on your course on IS-Academia have access to your quiz questions - this is the option recommanded so that your students can use your quiz questions\n", "* **\"Manual enrolment\"**: you have to add manually each persons you want to have access to your quiz questions (they need to have with a GASPAR account)\n", - "* **\"Self enrolment\"**: anyone with a GASPAR account can register to your course and have access to your quiz questions - this is the option recommanded so that all EPFL students and staff can use your quiz questions\n", + "* **\"Self enrolment\"**: anyone with a GASPAR account can register to your course and have access to your quiz questions - this is the option recommanded so that any EPFL students and member of EPFL staff can use your quiz questions\n", "* **\"Guest access\"**: anyone from the general public can see your moodle page and have access to your quiz question - 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", "When someone does not have access as per the enrolment methods above, here is what they see in place of the quiz question:\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", - "You have 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", + "If your question is placed in a hidden section as we have suggested, then you 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 `src=` (just after the `iframe` tag), as shown below. Copy this URL.\n", + "Paste the code into your favorite text editor and find the URL of the question, which should appear between quotes after `\n", " " ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "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.8" } }, "nbformat": 4, "nbformat_minor": 4 }