### Install STACK 2.X Question Format in Moodle Source: https://docs.stack-assessment.org/en/Installation/Migration This details the steps to install the STACK question format for importing STACK 2 questions into Moodle. It involves obtaining the `qformat_stack` code, placing it in the correct directory, and then accessing it through the Moodle interface. This will provide a different question format for the Moodle quiz importer. ```shell git clone https://github.com/maths/moodle-qformat_stack.git question/format/stack ``` -------------------------------- ### Set Input Options for Equivalence Reasoning Source: https://docs.stack-assessment.org/en/Specialist_tools/Equivalence_reasoning Configures input options for STACK's equivalence reasoning input type. Specifies the model answer, syntax hints, and extra options to guide students and validate their responses. This includes using `stackeq` and `firstline` for step-by-step evaluation. ```STACK [(x+2)^3,stackeq(?)] ``` -------------------------------- ### ATAlgEquiv Return Values Example Source: https://docs.stack-assessment.org/en/CAS/STACK-Maxima_sandbox Shows the typical return values from the `ATAlgEquiv` function when used directly. It returns a boolean indicating equivalence, followed by empty strings for feedback and notes if no specific issues arise. ```maxima [true,false,"",""] ``` -------------------------------- ### Feedback Message for Partial Credit Scenario Source: https://docs.stack-assessment.org/en/AbInitio/Authoring_quick_start_7 Provides instructional feedback when a student correctly evaluates their expression at the specified point but the original expression in part 1 is incorrect. This guides students to review both parts of the question. ```STACK You have correctly evaluated your answer to part 1 at the given point, but your answer to part 1 is wrong. Please try both parts again. ``` -------------------------------- ### Call ATInt Answer Test Directly Source: https://docs.stack-assessment.org/en/CAS/STACK-Maxima_sandbox Demonstrates calling the `ATInt` answer test function to check integration equivalence. This example compares the integral of `x^2` with `x*(x+1)` with respect to `x`. ```maxima ATInt(x^2,x*(x+1),x); ``` -------------------------------- ### ATInt Return Values Example Source: https://docs.stack-assessment.org/en/CAS/STACK-Maxima_sandbox Illustrates the return format for the `ATInt` answer test. It includes a validity flag, a boolean result, a feedback tag (e.g., 'ATInt_generic'), and specific notes possibly related to translations or function arguments. ```maxima [true,false,"ATInt_generic. ","stack_trans('ATInt_generic' , !quot![2\,x+1\]!quot! , !quot!\(x\)!quot! , !quot![2\,x\]!quot! ); "] ``` -------------------------------- ### Start STACK API Docker Container Source: https://docs.stack-assessment.org/en/Installation/API Command to start the STACK API Docker container using docker-compose. This initializes the containerized STACK API service on the local machine. ```bash docker compose -f docker-compose.yml up ``` -------------------------------- ### Download, compile, and install Maxima with SBCL support Source: https://docs.stack-assessment.org/en/Installation/Maxima_installation This process involves downloading the Maxima source code, extracting it, configuring the build to enable SBCL support, compiling Maxima, and installing it. The `--enable-sbcl` flag is crucial for Maxima to use the SBCL Lisp implementation. ```bash wget https://sourceforge.net/projects/maxima/files/Maxima-source/5.47.0-source/maxima-5.47.0.tar.gz tar -xzf maxima-5.47.0.tar.gz cd maxima-5.47.0/ ./configure --enable-sbcl make sudo make install ``` -------------------------------- ### Install PHP mbstring library on Linux Source: https://docs.stack-assessment.org/en/Installation This code snippet provides instructions on how to install the PHP `mbstring` library on a Linux system, which is a required dependency for STACK. The command is executed using `apt-get`, a package manager commonly found on Debian and Ubuntu based distributions. After installation, restarting the web server is necessary. ```bash apt-get install php-mbstring ``` -------------------------------- ### Format Examples in HTML Source: https://docs.stack-assessment.org/en/Reference/HELM This HTML snippet provides the structure for displaying examples in STACK quizzes. It includes horizontal rules, headings with the class "HELM_example", and solution sections. It utilizes specific classes for styling to match the original HELM workbooks. ```html
Use a calculator to evaluate ... .
Using the ... button on the calculator check that you obtain ... .
``` -------------------------------- ### Define Question Variables in STACK Source: https://docs.stack-assessment.org/en/AbInitio/Authoring_quick_start_2 This code snippet demonstrates how to define and use question variables in STACK. These variables are based on Maxima syntax. They are used to simplify question creation and allow for dynamic content. The example calculates an integral and references it in the question text. ```Maxima exp: 3*(x-1)^(-4); ta: int(exp,x)+c; ``` -------------------------------- ### Disable Simplification in STACK Source: https://docs.stack-assessment.org/en/AbInitio/Authoring_quick_start_8 This code demonstrates how to disable simplification in a STACK question using `simp:false`. It also shows how to preview the difference between simplified and not simplified expressions. The example defines question variables and displays the results. ```Maxima simp:true; a1: (3*%e^(%i*%pi/2))^4; simp:false; a2: (3*%e^(%i*%pi/2))^4; ``` -------------------------------- ### Configure Maxima Path for STACK Libraries Source: https://docs.stack-assessment.org/en/CAS/STACK-Maxima_sandbox This example shows how to configure Maxima's search path to include the downloaded STACK libraries. This is crucial for Maxima to find and load the necessary STACK functions. Note the use of forward slashes instead of backslashes on Microsoft operating systems. ```maxima /* Example for Microsoft OS, adjust path as needed */ file_search_paths: append(file_search_paths, ["c:/tmp/stackroot/stack/maxima/"]); /* On other systems, use appropriate path */ /* file_search_paths: append(file_search_paths, ["/path/to/stack/maxima/"]); */ ``` -------------------------------- ### Configure Maxima installation path Source: https://docs.stack-assessment.org/en/Installation/Maxima_installation Demonstrates how to change the installation directory for Maxima using the `--prefix` flag during the `./configure` step. This allows for custom installation locations instead of the default `/usr/local/bin/maxima`. ```bash ./configure --prefix=/usr/bin --enable-sbcl make sudo make install ``` -------------------------------- ### Download, compile, and install SBCL (Lisp) Source: https://docs.stack-assessment.org/en/Installation/Maxima_installation This sequence of commands downloads the SBCL source code, extracts it, configures the build, compiles it, and installs it system-wide. SBCL is a high-performance Common Lisp implementation required for compiling Maxima. ```bash wget https://sourceforge.net/projects/sbcl/files/sbcl/2.3.2/sbcl-2.3.2-source.tar.bz2 tar -xf sbcl-2.3.2-source.tar.bz2 cd sbcl-2.3.2/ ./make-config.sh ./make.sh sudo ./install.sh ``` -------------------------------- ### Install texinfo dependency Source: https://docs.stack-assessment.org/en/Installation/Maxima_installation Installs the texinfo package, a prerequisite for compiling Maxima from source. This command is executed using apt-get on Debian-based systems like Ubuntu. ```bash sudo apt-get install texinfo ``` -------------------------------- ### STACK Example: Unary Minus Sorting and Display Source: https://docs.stack-assessment.org/en/Specialist_tools/Equivalence_reasoning/Equivalence_input Provides a specific example of using `make_multsgn` and `stack_disp` with `unary_minus_sort` to manage unary minus in expressions and prepare them for display within STACK assessments. ```maxima p:-8 _a_ d-3 _b_ c+6 _a_ c+4 _b_ d; make_multsgn("space"); sh:stack_disp([unary_minus_sort(p)],""); ta:[p,ev(p,simp)]; ``` -------------------------------- ### Example expressions in STACK Source: https://docs.stack-assessment.org/en/Students/Answer_input Provides examples of how to express complex expressions with correct syntax, covering powers, trigonometric functions, and algebraic operations ```Maxima 2^(a+b) ``` ```Maxima 2*cos(3*x) ``` ```Maxima exp(a*x)*sin(b*x) ``` ```Maxima (a*x^2 + b*x + c)^(-1) ``` -------------------------------- ### Format Examples with Parts in HTML Source: https://docs.stack-assessment.org/en/Reference/HELM This HTML code snippet formats examples that include numbered parts and solutions. It uses ordered lists with the classes "HELM_parts_inline" and "HELM_parts" to represent the parts and the solutions. The HTML also uses specific classes for styling to match the original HELM workbooks. ```htmlIdentify the index and base in the following expressions.
The interpretation of a negative index will be given in sub-section 4 which starts on page 31.
Differentiate \((x-1)^3\) with respect to x.
[[input:ans1]] [[validation:ans1]]
``` -------------------------------- ### Call ATAlgEquiv Answer Test Directly Source: https://docs.stack-assessment.org/en/CAS/STACK-Maxima_sandbox Example of directly calling the `ATAlgEquiv` (Algebraic Equivalence) answer test function in Maxima. This function checks if two expressions are algebraically equivalent. ```maxima ATAlgEquiv(x^2+2,x*(x+1)); ``` -------------------------------- ### Initialize STACK Maxima Sandbox Source: https://docs.stack-assessment.org/en/CAS/STACK-Maxima_sandbox This code represents the expected output after successfully initializing the STACK Maxima sandbox. The version number may vary. If you see this, the libraries are loaded correctly. ```text [ STACK-Maxima started, library version 2022022300 ] ``` -------------------------------- ### Define STACK Question Variables with Model Answer Source: https://docs.stack-assessment.org/en/AbInitio/Authoring_quick_start_1 Sets up the question variables section with a model answer (ta) variable containing the correct solution. Replace the placeholder with the actual derivative expression using STACK syntax. ```STACK ta:3*(x-1)^2; ``` -------------------------------- ### Disable Automatic Simplification in Question Options Source: https://docs.stack-assessment.org/en/Specialist_tools/Equivalence_reasoning Disables automatic simplification in STACK question options to allow step-by-step evaluation of the student's work. This is necessary to evaluate the student's process and not just the final answer. ```STACK Auto-simplify = no ``` -------------------------------- ### Define STACK Question Variables Source: https://docs.stack-assessment.org/en/Specialist_tools/Equivalence_reasoning Defines variables within a STACK question to represent the mathematical expression, the final model answer, and a list of expected steps. These variables are used to assess student responses against the correct solution. ```STACK p:(x+2)^3; taf:ev(expand(p),simp); ta:[(x+2)^3,stackeq((x+2)*(x+2)^2),stackeq((x+2)*(x^2+4*x+4)),stackeq(x^3+4*x^2+4*x+2*x^2+8*x+8),stackeq(taf)]; ``` -------------------------------- ### Algebraic Expansion Question with Fill-in-the-Blanks Source: https://docs.stack-assessment.org/en/AbInitio/Authoring_quick_start_7 Illustrates a multipart question format where students fill in the blanks to expand a polynomial. This is represented by a text string with placeholders for input fields, indicating a need for multiple simultaneous coefficient assessments. The format is suitable for questions targeting younger students. ```Text/Placeholder (x+1)(x+2) = [?] x2 + [?] x + []. ``` -------------------------------- ### Configure Follow-through Marking for Part 2 - Node 2 Source: https://docs.stack-assessment.org/en/AbInitio/Authoring_quick_start_7 Implements the second node of the response tree to validate the correctness of the original expression from part 1. This node is reached only if the student correctly evaluated their part 1 answer, establishing whether they solved both parts correctly. ```STACK Answer test: AlgEquiv SAns: ans1 TAns: ta1 ``` -------------------------------- ### Configure a Second PRT Node Source: https://docs.stack-assessment.org/en/Specialist_tools/Equivalence_reasoning Adds a second node to the potential response tree (PRT) to check if the student has arrived at the correct final expression. It uses `EqualComAss` to determine equivalence and compares the final step to the final answer ```STACK SAns = last(ans1) TAns = last(ta) answer test = EqualComAss Auto-simplify = no ``` -------------------------------- ### Displaying Proofs with Alternatives Source: https://docs.stack-assessment.org/en/Specialist_tools/Drag_and_drop/Parsons Shows how to render proof structures, including those with multiple alternative orderings, for display to students. This utilizes functions to present proofs in paragraph format or within tables for comparison. ```STACK/Mako {@proof_display(tal[2], proof_steps)@}{@proof_display_para(tal[1], proof_steps)@} |
{@proof_display_para(tal[2], proof_steps)@} |
Find \(\int{@exp@} \mathrm{d}x\)
[[input:ans1]] [[validation:ans1]]
``` -------------------------------- ### String Handling - Basic String Support Source: https://docs.stack-assessment.org/en/Authoring/Answer_Tests/Results/AlgEquiv This section illustrates the basic support for strings within the symbolic computation environment. It demonstrates how strings are recognized and handled as input. The example shows the string "Hello" and its behavior within the system. ```AlgEquiv "Hello" ``` ```AlgEquiv "hello" ``` ```AlgEquiv "Hello" ``` -------------------------------- ### JSXGraph: Get Mouse Coordinates Source: https://docs.stack-assessment.org/en/Specialist_tools/JSXGraph/Binding This JavaScript function, adapted from a JSXGraph example, retrieves the user's mouse coordinates relative to the graph's coordinate system. It takes an event object `e` and an index `i` as input and returns an array containing the x and y coordinates. ```javascript /* The below code is adapted from an example found at https://jsxgraph.org/wiki/index.php/Browser_event_and_coordinates */ var getMouseCoords = function(e, i) { var cPos = board.getCoordsTopLeftCorner(e, i), absPos = JXG.getPosition(e, i), dx = absPos[0]-cPos[0], dy = absPos[1]-cPos[1]; var coords = new JXG.Coords(JXG.COORDS_BY_SCREEN, [dx, dy], board); return [coords.usrCoords[1], coords.usrCoords[2]] }; ``` -------------------------------- ### Proof Structure and Alternatives in STACK Source: https://docs.stack-assessment.org/en/Specialist_tools/Drag_and_drop/Parsons Demonstrates how to define and manage proof structures, including generating alternative orderings for 'if and only if' proofs using prooflib. It outlines the process of flattening proofs for comparison and assessment. ```STACK/Prooflib ta:proof_iff(proof(1,2,3,4,5),proof(6,7,8,9,10,11)); tal:proof_alternatives(ta); tas:setify(map(proof_flatten, tal)); ``` -------------------------------- ### Disable Maxima Platform for Plugin Unit Tests Source: https://docs.stack-assessment.org/en/Developer/Unit_tests This configuration allows running Moodle Stack plugin's PHP unit tests on other plugins without a full Maxima installation. By defining QTYPE_STACK_TEST_CONFIG_PLATFORM as 'none', it prevents the default failure that occurs with an incomplete Maxima setup. Refer to issue #1104 for details. ```php define('QTYPE_STACK_TEST_CONFIG_PLATFORM', 'none'); ``` -------------------------------- ### Maxima: Example Question Setup Source: https://docs.stack-assessment.org/en/Topics/Linear_algebra/Vector_geometry This code segment presents a sample question to 'Find vector parametric equation for plane given three points'. It shows how to define three points, compute a teacher's answer, and set up feedback variables for evaluating a student's response. The `stack_include_contrib` commands load necessary libraries. ```Maxima /* Can be deleted if using STACK 4.9.0 or later: */ stack_include_contrib("linearalgebra_contrib.mac"); %_stack_preamble_end; stack_include_contrib("vectorgeometry.mac") p1: transpose(rand_selection([-4,-3,-2,-1,0,1,2,3,4],3)); p2: scale_nicely(crossproduct(p1,transpose([1,0,0]))); p3: scale_nicely(crossproduct(p1,transpose([0,1,1]))); ta: un_vec_convert(p1) + t*un_vec_convert(p2 - p1) + s*un_vec_convert(p3 - p1); ``` -------------------------------- ### STACK Syntax Hint Formatting with `stack_disp` and `unary_minus_sort` Source: https://docs.stack-assessment.org/en/Specialist_tools/Equivalence_reasoning/Equivalence_input Illustrates how to format expressions for syntax hints in STACK, using `stack_disp` and `unary_minus_sort` to handle unary minus and other display adjustments. It shows how to generate LaTeX and string representations. ```maxima sh:stack_disp(unary_minus_sort(p), "") ``` ```maxima sh:sremove("*", string(unary_minus_sort(p))) ``` -------------------------------- ### Check for Factored Form in Student Answers (Maxima) Source: https://docs.stack-assessment.org/en/Specialist_tools/Equivalence_reasoning This Maxima code snippet checks if the factored form of an expression exists within the student's answers. It identifies equations where the right-hand side is zero and then attempts to find the factored form of the left-hand side. The `any_listp` function checks if the lambda function returns true for any element in the `foundfac` list. ```maxima foundfac:sublist(ans1,lambda([ex], equationp(ex) and is(rhs(ex)=0))); foundfac:ev(any_listp(lambda([ex], second(ATFacForm(lhs(ex),lhs(ex),x))), foundfac), simp); ``` -------------------------------- ### STACK Question Text for Tangent Line Problem Source: https://docs.stack-assessment.org/en/AbInitio/Authoring_quick_start_7 Provides the HTML-like text for a STACK multipart question asking for the equation of a tangent line. It includes placeholders for student input and validation, and feedback for three distinct parts of the problem. This text structures the student-facing part of the question. ```STACK/HTML Find the equation of the line tangent to {@exp@} at the point \(x={@pt@}\). 1. Differentiate {@exp@} with respect to \(x\). [[input:ans1]] [[validation:ans1]] [[feedback:prt1]] 2. Evaluate your derivative at \(x={@pt@}\). [[input:ans2]] [[validation:ans2]] [[feedback:prt2]] 3. Hence, find the equation of the tangent line. \(y=\)[[input:ans3]] [[validation:ans3]] [[feedback:prt3]] ``` -------------------------------- ### Sortable.js Animation Option Example (JSON) Source: https://docs.stack-assessment.org/en/Specialist_tools/Drag_and_drop/Question_block An example of a JSON object used to configure Sortable.js options within a [[parsons]] block. This specific example sets the animation speed. ```json { "animation": 50, } ``` -------------------------------- ### Configure Maxima Libraries Source: https://docs.stack-assessment.org/en/Installation/Testing_installation Specify optional Maxima libraries to be loaded. Not all Maxima versions support all libraries. If loading fails (e.g., due to `draw.lisp` dependency), remove optional libraries. ```text qtype_stack | maximalibraries = stats, distrib, descriptive, simplex ``` -------------------------------- ### Integration and Differentiation Example Source: https://docs.stack-assessment.org/en/Authoring/Answer_Tests/Results/Equiv A calculus example demonstrating the relationship between a function, its integral, and its derivative. It shows a function and its indefinite integral. ```calculus x^2+1,stackeq(x^3/3+x),stackeq(x^2+1),stackeq(x^3/3+x+c) ``` -------------------------------- ### Expression Factoring Problem Examples - Maxima Source: https://docs.stack-assessment.org/en/Authoring/Answer_Tests/Equivalence Shows examples of expressions where factoring can cause computational problems or timeouts, illustrating why AlgEquiv tries to minimize factoring operations. ```maxima factor(%e^(10*k)-%e^(10*x)); factor(x^105-1); ``` -------------------------------- ### Load STACK Environment via stacklocal.mac Source: https://docs.stack-assessment.org/en/CAS/STACK-Maxima_sandbox This shows how to load the STACK environment by using the `load` command with a custom Maxima initialization file (`stacklocal.mac`). This file should be placed in a user-specific Maxima directory. ```maxima /* Place stacklocal.mac in ~/.maxima/ on Linux or %USERPROFILE%/Maxima/ on Windows */ load("stacklocal"); ``` -------------------------------- ### Run Bulk Question Tests (CLI) Source: https://docs.stack-assessment.org/en/STACK_question_admin/Testing_questions_on_other_sites Execute the 'bulktestall.php' script from the command line to initiate bulk testing of all question tests across all variants. This is the initial command to start the process. ```bash php bulktestall.php ``` -------------------------------- ### Initialize PHPUnit for STACK Source: https://docs.stack-assessment.org/en/Developer/Unit_tests This command initializes the PHPUnit environment for Moodle, which is a prerequisite for running STACK's unit tests. Ensure you have Moodle's PHPUnit documentation setup first. ```bash php admin/tool/phpunit/cli/init.php ``` -------------------------------- ### Expression Expansion Problem Example - Maxima Source: https://docs.stack-assessment.org/en/Authoring/Answer_Tests/Equivalence Demonstrates why algebraic equivalence testing avoids expanding expressions by showing a computationally problematic example with large exponents that would cause significant performance issues. ```maxima expand((x-a)^100-(x-b^100)); ``` -------------------------------- ### Example Non-Exact ODE in Maxima Source: https://docs.stack-assessment.org/en/Topics/Differential_equations/Assessing_Responses This Maxima code snippet shows an example of a non-exact differential equation. It is provided to contrast with the exact equations and to illustrate cases where the standard exactness check might fail. ```maxima /* Non-exact equations */ ODE:y=x*'diff(y,x); ``` -------------------------------- ### Optimized Maxima Image Creation and Execution Source: https://docs.stack-assessment.org/en/Installation/Testing_installation Create an optimized Maxima image stored in Moodle's dataroot. The plugin updates `qtype_stack | platform` and `qtype_stack | maximacommandopt`. Ensure the PHP process has write permissions to the dataroot/stack directory. The example shows a GCL-generated image and its execution command with a timeout. ```php $CFG->dataroot = '/var/data/moodle311'; ``` ```shell timeout --kill-after=10s 10s /var/data/moodle311/stack/maxima_opt_auto -eval '(cl-user::run)' ``` -------------------------------- ### Example Exact ODEs in Maxima Source: https://docs.stack-assessment.org/en/Topics/Differential_equations/Assessing_Responses This Maxima code provides examples of ODEs that are exact or can be manipulated into exact forms. It includes expressions for setting up the ODE and applying the format function to prepare them for coefficient extraction. ```maxima /* Exact equations */ ODE:2*y*x*'diff(y,x)+y^2-2*x=0$ ODE:sin(x)*cosh(y)-'diff(y,x)*cos(x)*sinh(y)=0$ ODE:(3*x^2*cos(3*y)+2*y)*'diff(y,x)=-2*x*sin(3*y)$ ``` -------------------------------- ### Define Test Case for Model Answer Source: https://docs.stack-assessment.org/en/AbInitio/Authoring_quick_start_5 This snippet defines a test case for a student input that matches the model answer. It sets the score to 1 and penalty to 0, with a specific answer note indicating the successful completion of two evaluation steps. ```plaintext ans1 = ta score = 1 penalty = 0 answernote = prt1-2-T ``` -------------------------------- ### Example of 'keyword' security feature in JSON Source: https://docs.stack-assessment.org/en/Developer/Security_map Provides an example of the 'keyword' security feature in the security map JSON. This is used to control the usage of keywords, potentially for restricting certain control flow structures. ```json { "for": { "keyword": "s" } } ```