diff --git a/docs/en_us/course_authors/source/Images/NumericalInput_Complex.png b/docs/en_us/course_authors/source/Images/NumericalInput_Complex.png new file mode 100644 index 0000000000..134f14bba4 Binary files /dev/null and b/docs/en_us/course_authors/source/Images/NumericalInput_Complex.png differ diff --git a/docs/en_us/course_authors/source/advanced_problems.rst b/docs/en_us/course_authors/source/advanced_problems.rst index 837be86632..8c5d76c33e 100644 --- a/docs/en_us/course_authors/source/advanced_problems.rst +++ b/docs/en_us/course_authors/source/advanced_problems.rst @@ -16,9 +16,7 @@ templates for these problems, but the problems open directly in the - :ref:`Custom JavaScript Display and Grading` With custom JavaScript display and grading problems, you can incorporate problem types that you've created in HTML into Studio via an IFrame. -- :ref:`Write Your Own Grader` Write-your-own-grader problems - evaluate students' responses using an embedded Python script that you - create. These problems can be any type. +- :ref:`Custom Python Evaluated Input` Custom Python-evaluated input (also called "write-your-own-grader" problems evaluate students' responses using an embedded Python script that you create. These problems can be any type. - :ref:`Drag and Drop` Drag and drop problems require students to drag text or objects to a specific location on an image. - :ref:`Image Mapped Input` Image mapped input problems require students to @@ -157,6 +155,64 @@ Create a Circuit Schematic Builder Problem #. In the component editor, replace the example code with your own code. #. Click **Save**. +**Problem Code**: + +.. code-block:: xml + + + +

Make a voltage divider that splits the provided voltage evenly.

+ +
+ +
+ + dc_value = "dc analysis not found" + for response in submission[0]: + if response[0] == 'dc': + for node in response[1:]: + dc_value = node['output'] + if dc_value == .5: + correct = ['correct'] + else: + correct = ['incorrect'] + +
+ +

Make a high pass filter.

+
+ +
+ + ac_values = None + for response in submission[0]: + if response[0] == 'ac': + for node in response[1:]: + ac_values = node['NodeA'] + print "the ac analysis value:", ac_values + if ac_values == None: + correct = ['incorrect'] + elif ac_values[0][1] < ac_values[1][1]: + correct = ['correct'] + else: + correct = ['incorrect'] + +
+ +
+

Explanation

+

A voltage divider that evenly divides the input voltage can be formed with two identically valued resistors, with the sampled voltage taken in between the two.

+

+

A simple high-pass filter without any further constaints can be formed by simply putting a resister in series with a capacitor. The actual values of the components do not really matter in order to meet the constraints of the problem.

+

+
+
+
+ .. _Custom JavaScript Display and Grading: Custom JavaScript Display and Grading @@ -474,7 +530,32 @@ To create a image mapped input problem: #. In the component editor, replace the example code with your own code. #. Click **Save**. +**Problem Code**: +.. code-block:: xml + + +

Example Problem

+ +

In the image below, click the triangle.

+ + + + +
+ +**Problem Template** + +.. code-block:: xml + + + +

In the image below, click the triangle.

+ + + + +
.. _Math Expression Input: @@ -492,6 +573,16 @@ Unlike numerical input problems, which only allow integers and a few select cons When you create a math expression input problem in Studio, you'll use `MathJax `_ to change your plain text into "beautiful math." For more information about how to use MathJax in Studio, see :ref:`MathJax in Studio`. +**Notes for Students** + +When you answer a math expression input problem, follow these guidelines. + +* Use standard arithmetic operation symbols. +* Indicate multiplication explicitly by using an asterisk (*). +* Use a caret (^) to raise to a power. +* Use an underscore (_) to indicate a subscript. +* Use parentheses to specify the order of operations. + The LMS automatically converts the following Greek letter names into the corresponding Greek characters when a student types them in the answer field: .. list-table:: @@ -541,10 +632,79 @@ To create a math expression input problem: #. In the component editor, replace the example code with your own code. #. Click **Save**. +.. list-table:: + :widths: 20 80 + :header-rows: 1 + + * - ```` + - + * - ```` + - This tag includes the ``size`` and ``label`` attributes. + * - `` + +

Let x be a variable, and let n be an arbitrary constant. What is the derivative of xn?

+ + + + + + + +
+

Explanation or Solution Header

+

Explanation or solution text

+
+
+ + +**Template XML** + +.. code-block:: xml + + +

Problem text

+ + + + + + + + +
+

Explanation or Solution Header

+

Explanation or solution text

+
+
+
+ + + For more information, see `Symbolic Response `_. - .. _Problem with Adaptive Hint: Problem with Adaptive Hint diff --git a/docs/en_us/course_authors/source/appendices/e.rst b/docs/en_us/course_authors/source/appendices/e.rst index 8443e213d3..50a6d2d673 100644 --- a/docs/en_us/course_authors/source/appendices/e.rst +++ b/docs/en_us/course_authors/source/appendices/e.rst @@ -619,8 +619,8 @@ Although you can create multiple choice problems by using the Simple Editor in S .. _Numerical Response: -Numerical Response ------------------- +Numerical Response (Numerical Input Problems) +--------------------------------------------- The Numerical Response input type accepts a line of text input from the student and evaluates the input for correctness based on its numerical value. The input diff --git a/docs/en_us/course_authors/source/common_problems.rst b/docs/en_us/course_authors/source/common_problems.rst index 0d32327f8f..1c4134cec4 100644 --- a/docs/en_us/course_authors/source/common_problems.rst +++ b/docs/en_us/course_authors/source/common_problems.rst @@ -279,8 +279,64 @@ following. Dropdown Problem XML ========================== +**Problem Code:** +.. code-block:: xml + +

+ This exercise first appeared in HarvardX's PH207x Health in Numbers: Quantitative Methods in Clinical & Public Health Research course, fall 2012. +

+

What type of data are the following?

+

Age:

+ + + +

Age, rounded to the nearest year:

+ + + +

Life stage - infant, child, and adult:

+ + + +
+ +**Template** + +.. code-block:: xml + + +

+ Problem text

+ + + + +
+

Explanation or Solution Header

+

Explanation or solution text

+
+
+
+ +.. code-block:: xml + + +

Problem text

+ + options="('A','B')" + correct="A"/> + label="label text" + + + +
+

Explanation or Solution Header

+

Explanation or solution text

+
+
+
.. _Multiple Choice: @@ -353,6 +409,52 @@ following. investigating lateral inhibition using horseshoe crabs. [Explanation] +**Problem Code:** + +.. code-block:: xml + + +

Lateral inhibition, as was first discovered in the horsehoe crab...

+ + + is a property of touch sensation, referring to the ability of crabs to detect nearby predators. + is a property of hearing, referring to the ability of crabs to detect low frequency noises. + is a property of vision, referring to the ability of crabs eyes to enhance contrasts. + has to do with the ability of crabs to use sonar to detect fellow horseshoe crabs nearby. + has to do with a weighting system in the crabs skeleton that allows it to balance in turbulent water. + + + +
+

Explanation

+

Horseshoe crabs were essential to the discovery of lateral inhibition, a property of vision present in horseshoe crabs as well as humans, that enables enhancement of contrast at edges of objects as was demonstrated in class. In 1967, Haldan Hartline received the Nobel prize for his research on vision and in particular his research investigating lateral inhibition using horseshoe crabs.

+
+
+
+ + +**Template** + +.. code-block:: xml + + +

Question text

+ + + Incorrect choice + Correct choice + + + + +
+

Explanation or solution header

+

Explanation or solution text

+
+
+
+ + .. _Numerical Input: ******************* @@ -363,7 +465,7 @@ In numerical input problems, students enter numbers or specific and relatively simple mathematical expressions to answer a question. .. image:: Images/NumericalInputExample.gif - :alt: Image of a numerical input problem + :alt: Image of a simple numerical input problem Note that students' responses don't have to be exact for these problems. You can specify a margin of error, or tolerance. For more information, see the instructions below. @@ -378,11 +480,108 @@ example shows the way Studio renders students' text responses in numerical input problems. To see more examples, scroll down to **Examples**. .. image:: Images/Math5.gif - :alt: Image of Studio's rendering of numerical input responses + :alt: Image of a numerical input probem rendered by Studio -================================== -Create a Numerical Input Problem -================================== +================== +Student Answers +================== + +.. _Math Expression Syntax: + +Math Expression Syntax +---------------------- + +In numerical input problems, the student's input may be more complicated than a +simple number. Expressions like ``sqrt(3)`` and even ``1+e^(sin(pi/2)+2*i)`` +are valid, and evaluate to 1.73 and -0.13 + 2.47i, respectively. + +A summary of the syntax follows: + +Numbers +~~~~~~~ + +Accepted number types: + +- Integers: '2520' +- Normal floats: '3.14' +- With no integer part: '.98' +- Scientific notation: '1.2e-2' (=0.012) +- More s.n.: '-4.4e+5' = '-4.4e5' (=-440,000) +- Appending SI suffixes: '2.25k' (=2,250). The full list: + + ====== ========== =============== + Suffix Stands for One of these is + ====== ========== =============== + % percent 0.01 = 1e-2 + k kilo 1000 = 1e3 + M mega 1e6 + G giga 1e9 + T tera 1e12 + c centi 0.01 = 1e-2 + m milli 0.001 = 1e-3 + u micro 1e-6 + n nano 1e-9 + p pico 1e-12 + ====== ========== =============== + +The largest possible number handled currently is exactly the largest float +possible (in the Python language). This number is 1.7977e+308. Any expression +containing larger values will not evaluate correctly, so it's best to avoid +this situation. + +Default Constants +~~~~~~~~~~~~~~~~~ + +Simple and commonly used mathematical/scientific constants are included by +default. These include: + +- ``i`` and ``j`` as ``sqrt(-1)`` +- ``e`` as Euler's number (2.718...) +- ``pi`` +- ``k``: the Boltzmann constant (~1.38e-23 in Joules/Kelvin) +- ``c``: the speed of light in m/s (2.998e8) +- ``T``: the positive difference between 0K and 0°C (285.15) +- ``q``: the fundamental charge (~1.602e-19 Coloumbs) + +Operators and Functions +~~~~~~~~~~~~~~~~~~~~~~~ + +As expected, the normal operators apply (with normal order of operations): +``+ - * / ^``. Also provided is a special "parallel resistors" operator given +by ``||``. For example, an input of ``1 || 2`` would represent the resistance +of a pair of parallel resistors (of resistance 1 and 2 ohms), evaluating to 2/3 +(ohms). + +At the time of writing, factorials written in the form '3!' are invalid, but +there is a workaround. Students can specify ``fact(3)`` or ``factorial(3)`` to +access the factorial function. + +The default included functions are the following: + +- Trig functions: sin, cos, tan, sec, csc, cot +- Their inverses: arcsin, arccos, arctan, arcsec, arccsc, arccot +- Other common functions: sqrt, log10, log2, ln, exp, abs +- Factorial: ``fact(3)`` or ``factorial(3)`` are valid. However, you must take + care to only input integers. For example, ``fact(1.5)`` would fail. +- Hyperbolic trig functions and their inverses: sinh, cosh, tanh, sech, csch, + coth, arcsinh, arccosh, arctanh, arcsech, arccsch, arccoth + + +================================= +Create a Numerical Input Problem +================================= + +You can create numerical problems in the Simple Editor and in the Advanced Editor regardless of the answer to the problem. If the text of your problem doesn't include any italics, bold formatting, or special characters, you can create the problem in the Simple Editor. If the text of your problem contains special formatting or characters, or if your problem contains a Python script, you'll use the Advanced Editor. + +For example, the following example problems require the Advanced Editor. + +.. image:: Images/NumericalInput_Complex.png + :alt: Image of a more complex numerical input problem + +For more information about including a Python script in your problem, see :ref:`Custom Python Evaluated Input`. + +Create a Numerical Input Problem in the Simple Editor +------------------------------------------------------- #. Under **Add New Component**, click **Problem**. #. In the **Select Problem Component Type** screen, click **Numerical @@ -414,7 +613,7 @@ Create a Numerical Input Problem #. On the **Settings** tab, specify the settings that you want. #. Click **Save**. -For the example problem above, the text in the Problem component is the +For the first example problem above, the text in the Problem component is the following. :: @@ -427,6 +626,11 @@ following. As of edX's first birthday, in May 2013, edX students live in 193 different countries. [explanation] + +Create a Numerical Input Problem in the Advanced Editor +------------------------------------------------------- + + **Examples** The following are a few more examples of the way that Studio renders numerical input @@ -440,9 +644,136 @@ text that students enter. :alt: Image of a numerical input probem rendered by Studio .. image:: Images/Math4.gif :alt: Image of a numerical input probem rendered by Studio +.. image:: Images/Math5.gif + :alt: Image of a numerical input probem rendered by Studio + + +**Problem Code**: + +.. code-block:: xml + + +

Example Problem

+ +

What base is the decimal numeral system in? + + + +

+ +

What is the value of the standard gravity constant g, measured in m/s2? Give your answer to at least two decimal places. + + + + +

+ + + + +

What is the distance in the plane between the points (pi, 0) and (0, e)? You can type math. + + + + +

+ +
+

Explanation

+

The decimal numerical system is base ten.

+

The standard gravity constant is defined to be precisely 9.80665 m/s2. + This is 9.80 to two decimal places. Entering 9.8 also works.

+

By the distance formula, the distance between two points in the plane is + the square root of the sum of the squares of the differences of each coordinate. + Even though an exact numerical value is checked in this case, the + easiest way to enter this answer is to type + sqrt(pi^2+e^2) into the editor. + Other answers like sqrt((pi-0)^2+(0-e)^2) also work. +

+
+
+
+ +**Templates** + +Exact values + +.. code-block:: xml + + + + + + + + +
+ +
+
+
+ +Answers with decimal precision + +.. code-block:: xml + + + + + + + + + +
+ +
+
+
+ +Answers with percentage precision + +.. code-block:: xml + + + + + + + + + +
+ +
+
+
+ +Answers with scripts + +.. code-block:: xml + + + + + + + + + + + + +
+ +
+
+
-For more information, see `Formula Equation Input -`_. .. _Text input: @@ -578,4 +909,106 @@ To change the response field length, change the value of the **size** attribute: Hints and Regular Expressions in Text Input Problems ==================================================== -You can provide hints for common incorrect answers in text input problems. You can also set a text input problem to allow a regular expression as an answer. To do this, you'll have to modify the problem's XML in the Advanced Editor. For more information, see :ref:`String Response`. \ No newline at end of file +You can provide hints for common incorrect answers in text input problems. You can also set a text input problem to allow a regular expression as an answer. To do this, you'll have to modify the problem's XML in the Advanced Editor. For more information, see :ref:`String Response`. + +Although you can create text input problems by using the Simple Editor in Studio, you may want to see or change the problem's underlying XML. For example, you can add hints that appear when students enter common incorrect answers, or modify the problem's XML so that students can submit regular expressions as answers. + +The regular expression that the student enters must contain the part of the answer that the instructor specifies. For example, if an instructor has specified ````, correct answers include ``example answered``, ``two example answers``, or even ``==example answer==``, but not ``examples`` or ``example anser``. + +You can add ``regexp`` to the value of the ``type`` attribute, for example: ``type="ci regexp"`` or ``type="regexp"`` or ``type="regexp cs"``. In this case, any answer or hint will be treated as regular expressions. + +**Sample Problem** + +.. image:: ../Images/TextInputExample.gif + :alt: Image of a string response problem + +**XML Tags** + +.. list-table:: + :widths: 20 80 + + * - ```` + - Indicates that the problem is a text input problem. + * - ```` + - Child of ````. Lists the answer options and contains the ``label`` attribute. + * - ```` (optional) + - Specifies an additional correct answer for the problem. A problem can contain an unlimited number of additional answers. + * - ```` (optional) + - Indicates that the instructor has provided hints for certain common incorrect answers. + * - ```` (optional) + - Child of ````. Specifies the text of the incorrect answer to provide the hint for. Contains answer, type, name. + * - ```` + - Contains the name from ````. Associates the incorrect answer with the hint text for that incorrect answer. + * - ```` + - Indicates the beginning of the text of the hint. + * - ```` + - Indicates the end of the text of the hint. + +**Sample Problem Code** + +.. code-block:: xml + + +

+ This problem is adapted from an exercise that first appeared in MITx's 14.73x The Challenges of Global Poverty course, spring 2013. +

+

What is the technical term that refers to the fact that, when enough people sleep under a bednet, the disease may altogether disappear?

+ + community immunity + population immunity + + + + + + In contact immunity, a vaccinated individual passes along his immunity to another person through contact with feces or bodily fluids. The answer to the question above refers to the form of immunity that occurs when so many members of a population are protected, an infectious disease is unlikely to spread to the unprotected population. + + + + + + Although a firewall provides protection for a population, the term "firewall" is used more in computing and technology than in epidemiology. + + + + + +
+

Explanation

+

The correct answer is herd immunity. As more and more people use bednets, the risk of malaria begins to fall for everyone – users and non-users alike. This can fall to such a low probability that malaria is effectively eradicated from the group (even when the group does not have 100% bednet coverage).

+
+
+
+ +**Template** + +.. code-block:: xml + + +

Problem text

+ + Correct answer 2 + Correct answer 3 + + + + + Text of hint for incorrect answer A + + + + Text of hint for incorrect answer B + + + + Text of hint for incorrect answer C + + + + +
+

Explanation or Solution Header

+

Explanation or solution text

+
+
+
\ No newline at end of file