MediaWiki API result

This is the HTML representation of the JSON format. HTML is good for debugging, but is unsuitable for application use.

Specify the format parameter to change the output format. To see the non-HTML representation of the JSON format, set format=json.

See the complete documentation, or the API help for more information.

{
    "batchcomplete": "",
    "continue": {
        "gapcontinue": "RecursivelyDefinedFunctions",
        "continue": "gapcontinue||"
    },
    "warnings": {
        "main": {
            "*": "Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."
        },
        "revisions": {
            "*": "Because \"rvslots\" was not specified, a legacy format has been used for the output. This format is deprecated, and in the future the new format will always be used."
        }
    },
    "query": {
        "pages": {
            "2565": {
                "pageid": 2565,
                "ns": 0,
                "title": "Real (MathObject Class)",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "=== Real class ===\n\nThe Real class implements real numbers with \"fuzzy\" comparison (governed by the same tolerances and settings that control student answer checking).  For example, <code>Real(1.0) == Real(1.0000001)</code> will be true, while <code>Real(1.0) &lt; Real(1.0000001)</code> will be false.  Reals can be created in any Context, but the <code>Numeric</code> Context is the most frequently used for Reals.\n\n\n=== Creation ===\n\nReals are created via the <code>Real()</code> function, or by <code>Compute()</code>.  Reals can be added, subtracted, and so on, and the results will still be MathObject Reals.  Similarly, <code>sin()</code>, <code>sqrt()</code>, <code>ln()</code>, and the other functions return Real objects if their arguments are Reals.  For example:\n\n    Context(\"Numeric\");\n    \n    $a = Real(2);\n    $b = $a + 5;     # same as Real(7);\n    $c = sqrt($a);   # same as Real(sqrt(2));\n\nThis allows you to compute with Reals just as you would with native Perl real numbers.\n\n\n=== Pre-defined Reals ===\n\nThe value <code>pi</code> can be used in your Perl code to represent the value of <math>\\pi</math>.  Note that you must use <code>-(pi)</code> for <math>-\\pi</math> in Perl expressions (but not in strings that will be parsed by MathObjects, such as student answers or arguments to <code>Compute()</code>). For instance:\n\n    $a = pi + 2;              # same as Real(\"pi + 2\");\n    $b = 2 - (pi);            # same as Real(\"2 - pi\");\n    $c = sin(pi/2);           # same as Real(1);\n    $d = Compute(\"2 - pi\");   # parens only needed in Perl expressions\n\nThe value <code>e</code>, for the base of the natural log, <math>e</math>, can be used in student answers and parsed strings.\n\n    $e = Compute(\"e\");\n    $p = Compute(\"e^2\");\n\n\n=== Answer Checker ===\n\nAs with all MathObjects, you obtain an answer checker for a Real object via the <code>cmp()</code> method:\n\n    ANS(Real(2)->cmp);\n\nThe Real class supports the [[Answer_Checker_Options_(MathObjects)| common answer-checker options]], and the following additional options:\n\n{| class=\"wikitable\"\n! Option !! Description !! style=\"padding:5px\" | Default\n|- style=\"vertical-align: top\"\n| style=\"padding: 5px; white-space: nowrap\" | <code>ignoreInfinity => 1</code> or <code>0</code>\n| style=\"padding: 5px\" | Do/don't report type mismatches if the student enters an infinity.\n| style=\"text-align:center\" | <code>1</code>\n|}\n\n\n=== Methods ===\n\nThe Real class supports the [[Common MathObject Methods]].  There are no additional methods for this class.\n\nThe command\n\n    Parser::Number::NoDecimals();\n\nwill add a check so that a number with decimal places is not allowed.  This can be used to require students to enter values in terms of `pi` or `sqrt(2)` for example.  You can also supply a Context as an argument to disallow decimals in that context:\n\n    Parser::Number::NoDecimals($context);\n\nWithout a parameter, the current context is assumed.\n\n\n=== Properties ===\n\nThe Real class supports the [[Common MathObject Properties]], and the following additional ones:\n\n{| class=\"wikitable\"\n! Property !! Description !! style=\"padding:5px\" | Default\n\n|- style=\"vertical-align: baseline\"\n| style=\"padding: 5px; white-space: nowrap\" | <code>$r->{period}</code>\n| style=\"padding: 5px\" | When set, this value indicates that the real is periodic, with period given by this value.  So angles might use <code>period</code> set to <code>2*pi</code>.\n\n'''Example:'''\n: <code>$r = Real(pi/3)->with(period => 2*pi);</code>\n: <code>$r == 7*pi/3;  # will be true</code>\n| style=\"text-align:center\" | <code>undef</code>\n\n|- style=\"vertical-align: baseline\"\n| style=\"padding: 5px; white-space: nowrap\" | <code>$r->{logPeriodic}</code>\n| style=\"padding: 5px\" | When <code>period</code> is defined, and <code>logPeriodic</code> is set to <code>1</code> this indicates that the periodicity is logarithmic (i.e., the period refers to the log of the value, not the value itself).\n\n'''Example:'''\n: <code>$r = Real(4)->with(period => 10, logPeriodic => 1);</code>\n: <code>$r == 88105;  # true since 88105 is nearly exp(10+log(4))</code>\n| style=\"text-align:center\" | <code>0</code>\n|}\n\n\n<br>\n\n[[Category:MathObject_Classes]]\n[[Category:MathObjects]]"
                    }
                ]
            },
            "1339": {
                "pageid": 1339,
                "ns": 0,
                "title": "RecursiveSequence1",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "{{historical}}\n\n<p style=\"font-size: 120%;font-weight:bold\">This problem has been replaced with [https://openwebwork.github.io/pg-docs/sample-problems/Sequences/RecursiveSequence.html a newer version of this problem]</p>\n\n<h2>Sequences and Recursively Defined Functions</h2>\n\n[[File:RecursiveSequence1.png|300px|thumb|right|Click to enlarge]]\n<p style=\"background-color:#f9f9f9;border:black solid 1px;padding:3px;\">\nThis PG code shows how to add a named function to the context and use it to ask students to come up with a recursive formula.\n</p>\n* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Sequences/RecursiveSequence1.pg FortLewis/Authoring/Templates/Sequences/RecursiveSequence1.pg]\n* PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Sequences/RecursiveSequence1_PGML.pg FortLewis/Authoring/Templates/Sequences/RecursiveSequence1_PGML.pg]\n\n<br clear=\"all\" />\n<p style=\"text-align:center;\">\n[[SubjectAreaTemplates|Templates by Subject Area]]\n</p>\n\n<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\">\n\n<tr valign=\"top\">\n<th> PG problem file </th>\n<th> Explanation </th>\n</tr>\n\n\n<!-- Problem tagging section -->\n\n<tr valign=\"top\">\n<td style=\"background-color:#eeeeee;border:black 1px dashed;\">\n[http://webwork.maa.org/wiki/Tagging_Problems Problem tagging data]\n</td>\n<td style=\"background-color:#eeeeee;padding:7px;\">\n<p>\n<b>Problem tagging:</b>\n</p>\n</td>\n</tr>\n\n\n<!-- Initialization section -->\n\n<tr valign=\"top\">\n<td style=\"background-color:#ddffdd;border:black 1px dashed;\">\n<pre>\nDOCUMENT();\n\nloadMacros(\n\"PGstandard.pl\",\n\"MathObjects.pl\",\n\"parserFunction.pl\",\n);\n\nTEXT(beginproblem());\n</pre>\n</td>\n<td style=\"background-color:#ddffdd;padding:7px;\">\n<p>\n<b>Initialization:</b>\nWe will be defining a new named function and adding it to the context, and the easiest way to do this is using <code>parserFunction.pl</code>.  There is a more basic way to add functions to the context, which is explained in example 2 at\n[http://webwork.maa.org/wiki/AddingFunctions AddingFunctions]\n</p>\n</td>\n</tr>\n\n\n<!-- Setup section -->\n\n<tr valign=\"top\">\n<td style=\"background-color:#ffffdd;border:black 1px dashed;\">\n<pre>\nContext(\"Numeric\")->variables->are(n=>\"Real\");\nparserFunction(f => \"sin(pi^n)+e\");\n\n$fn = Formula(\"3 f(n-1) + 2\");\n</pre>\n</td>\n<td style=\"background-color:#ffffcc;padding:7px;\">\n<p>\n<b>Setup:</b> \nWe define a new named function <code>f</code> as something the student is unlikely to guess.  The named function <code>f</code> is, in some sense, just a placeholder since the student will enter expressions involving <code>f(n-1)</code>, WeBWorK will interpret it internally as <code>sin(pi^(n-1))+e</code>, and the only thing the student sees is <code>f(n-1)</code>.   If the \nrecursion has an closed-form solution (e.g., the Fibonacci numbers are given by f(n) = (a^n - (1-a)^n)/sqrt(5) where a = (1+sqrt(5))/2) and you want to allows students to enter the closed-form solution, it would be good to define f using that explicit solution in case the student tries to answer the question by writing out the explicit solution (a^n - (1-a)^n)/sqrt(5) instead of using the shorthand f(n).\n</p>\n</td>\n</tr>\n\n<!-- Main text section -->\n\n<tr valign=\"top\">\n<td style=\"background-color:#ffdddd;border:black 1px dashed;\">\n<pre>\nContext()->texStrings;\nBEGIN_TEXT\nThe current value \\( f(n) \\) is three \ntimes the previous value, plus two.  Find\na recursive definition for \\( f(n) \\).  \nEnter \\( f_{n-1} \\) as \\( f(n-1) \\).\n$BR\n\\( f(n) \\) = \\{ ans_rule(20) \\} \nEND_TEXT\nContext()->normalStrings;\n</pre>\n<td style=\"background-color:#ffcccc;padding:7px;\">\n<p>\n<b>Main Text:</b>\nWe should tell students to use function notation rather than subscript notation so that they aren't confused about syntax.\n</p>\n</td>\n</tr>\n\n<!-- Answer evaluation section -->\n\n<tr valign=\"top\">\n<td style=\"background-color:#eeddff;border:black 1px dashed;\">\n<pre>\n$showPartialCorrectAnswers=1;\n\nANS( $fn->cmp() );\n</pre>\n<td style=\"background-color:#eeccff;padding:7px;\">\n<p>\n<b>Answer Evaluation:</b>\n</p>\n</td>\n</tr>\n\n<!-- Solution section -->\n\n<tr valign=\"top\">\n<td style=\"background-color:#ddddff;border:black 1px dashed;\">\n<pre>\n\nContext()->texStrings;\nBEGIN_SOLUTION\nSolution explanation goes here.\nEND_SOLUTION\nContext()->normalStrings;\n\nCOMMENT('MathObject version.');\n\nENDDOCUMENT();\n</pre>\n<td style=\"background-color:#ddddff;padding:7px;\">\n<p>\n<b>Solution:</b>\n</p>\n</td>\n</tr>\n</table>\n\n<p style=\"text-align:center;\">\n[[SubjectAreaTemplates|Templates by Subject Area]]\n</p>\n\n[[Category:Top]]\n[[Category:Sample Problems]]\n[[Category:Subject Area Templates]]"
                    }
                ]
            }
        }
    }
}