diff --git a/doc/en/CAS/Numbers.md b/doc/en/CAS/Numbers.md index f1bbec4a889b4f69f76c919a541f675a9b0c3943..c8315f013448d8949aca5fb535c4e946e9274447 100644 --- a/doc/en/CAS/Numbers.md +++ b/doc/en/CAS/Numbers.md @@ -22,7 +22,7 @@ Optionally, depending on the question settings, you have i: %i j: %i -Sometimes you need to use \(e\), or other constants, as an abstract symbol not a number. The Maxima solution is to use the `kill()` command, but for security reasons users of STACK are not permitted to use this function. Instead use `stack_reset_vars(true)` in the question variables. This resets all the special constants defined by STACK so the symbols can be redefined in an individual STACK question. (On Maxima 5.42.1 (and possibly others) `stack_reset_vars(true)` also resets `ordergreat`, so if you need to use `stack_reset_vars(true)` it must be the first command the question variables. Since this has been fixed in Maxima 5.44.0, it was probably a bug in Maxima.) +Sometimes you need to use \(e\), or other constants, as an abstract symbol not a number. The Maxima solution is to use the `kill()` command, but for security reasons users of STACK are not permitted to use this function. Instead use `stack_reset_vars(true)` in the question variables. This resets all the special constants defined by STACK so the symbols can be redefined in an individual STACK question. (On Maxima 5.42.1 (and possibly others) `stack_reset_vars(true)` also resets `ordergreat`, so if you need to use `stack_reset_vars(true)` it must be the first command in the question variables. Since this has been fixed in Maxima 5.44.0, it was probably a bug in Maxima.) If you want to change the display of the constant \(e\) you need to refer to the `%e%` value, e.g. `texput(%e, "\mathrm{e}");`. diff --git a/doc/en/CAS/Simplification.md b/doc/en/CAS/Simplification.md index 66375ea6a7c63b81bfe460c65cd17726e0f620d9..f915a8f6d883fc5838595ff89cbb0034eca9e142 100644 --- a/doc/en/CAS/Simplification.md +++ b/doc/en/CAS/Simplification.md @@ -269,7 +269,7 @@ The first of these does not pull out a numerical denominator. The second does. ### Trig simplification ### -Maxima does have the ability to make assumptions, e.g. to assume that \(n\) is an integer and then simplify \(3\cos(n\pi/2)^2\) to \( \frac{3}{2}(1+(-1)^n)\). Assume the student's answer is `ans1` then then define the following feedback variables: +Maxima does have the ability to make assumptions, e.g. to assume that \(n\) is an integer and then simplify \(3\cos(n\pi/2)^2\) to \( \frac{3}{2}(1+(-1)^n)\). Assume the student's answer is `ans1` then define the following feedback variables: declare(n,integer); sans1:ev(trigrat(ans1),simp); diff --git a/doc/en/Developer/Security_map.md b/doc/en/Developer/Security_map.md index 696b35b3a233bbf094a430e535358dac7b3acf01..62c39ab438b57fb4460d5c6d9c4bd615a746cc3f 100644 --- a/doc/en/Developer/Security_map.md +++ b/doc/en/Developer/Security_map.md @@ -10,8 +10,8 @@ for somewhat obvious reasons! Hence, we need to restrict the availability of ce 2. Teacher. Teacher's answers cannot contain these, but they are not a security risk. Usually these have side effects within the Maxima code, e.g. setting a global variable which might cause problems later/elsewhere. 3. Student. Student's expressions can only contain these. -Since STACK 4.3 the Maxima statement parser infrastruture uses a JSON file -describing all identifiers of functions, variables, constants, and operators +Since STACK 4.3 the Maxima statement parser infrastructure uses a JSON file +describing all identifiers of functions, variables, constants and operators and features we attach to them. The catalogue is stored in stack/cas/security-map.json diff --git a/doc/en/Installation/Mathjax.md b/doc/en/Installation/Mathjax.md index ea3ca424231b7102dabd16b1795ad877b99d99b4..98b708535512eb42e054ba38c889d37377e9099b 100644 --- a/doc/en/Installation/Mathjax.md +++ b/doc/en/Installation/Mathjax.md @@ -13,7 +13,9 @@ These are notes on configuring the MathJax filter options for use with STACK. ## Accessibility ## -The accessibility features supported by MathJax are given detailed [here](http://www.mathjax.org/resources/articles-and-presentations/accessible-pages-with-mathjax/). +Among other things, MathJax allows screenreaders to read mathematics in a meaningful way which is critical for students who rely on this technology, or simply find it easier to learn with an aural option. For this to work, information must be typed up, not contained in a screenshot. + +The accessibility features supported by MathJax are given detailed in the MathJax [documentation](https://docs.mathjax.org/en/latest/basic/accessibility.html) and [YouTube](https://www.youtube.com/watch?v=6GSgTjorewQ). ## Adding MathJax to additional HTML diff --git a/stack/maxima/assessment.mac b/stack/maxima/assessment.mac index ced83ab1081c2ccedb13b7b779cb3915f81e926a..fe7b2bdf3f831c76fa8b6f5fbe876dc0b59339e1 100644 --- a/stack/maxima/assessment.mac +++ b/stack/maxima/assessment.mac @@ -743,8 +743,14 @@ decimalplacesfun(ex, n, dispdps) := block([ex2], ex2:ev(float(round(10^n*float(ex))/(10^n)), lg=logbasesimp, simp), if dispdps then ex2:displaydp(ex2, n), return(ex2) - )$ -decimalplaces(ex, n) := decimalplacesfun(ex, n, false)$ +)$ + +decimalplaces(ex, n):= block( + if n=0 then return(round(ex)), + if integerp(ex) then return(ex), + decimalplacesfun(ex, n, false) +)$ + dispdp(ex, n) := block( if not(real_numberp(ex)) then error("dispdp requires a real number argument."), if not(integerp(n)) then error("dispdp cannot create a non-integer number of decimal places."), diff --git a/tests/castext_test.php b/tests/castext_test.php index db009b1f4897380a8f10b8fdd40e7a2aa46fa040..421384cfefba912933ee035d0b699f6d15419c4a 100644 --- a/tests/castext_test.php +++ b/tests/castext_test.php @@ -816,12 +816,12 @@ class castext_test extends qtype_stack_testcase { } $cs2 = new stack_cas_session2($s2, null, 0); - $at1 = castext2_evaluatable::make_from_source('{@dispdp(a,2)@}, {@dispdp(b,3)@}, {@dispsf(b,4)@}', 'test-case'); + $at1 = castext2_evaluatable::make_from_source('{@dispdp(a,2)@}, {@dispdp(b,3)@}, {@dispsf(b,4)@}, {@decimalplaces(a,0)@}, {@decimalplaces(1,2)@}', 'test-case'); $this->assertTrue($at1->get_valid()); $cs2->add_statement($at1); $cs2->instantiate(); - $this->assertEquals('\({2.72}\), \({4.000}\), \({4.000}\)', $at1->get_rendered()); + $this->assertEquals('\({2.72}\), \({4.000}\), \({4.000}\), \({3}\), \({1}\)', $at1->get_rendered()); } /** @@ -835,12 +835,12 @@ class castext_test extends qtype_stack_testcase { } $cs2 = new stack_cas_session2($s2, null, 0); - $at1 = castext2_evaluatable::make_from_source('{@dispdp(a,0)*x^2@}, {@dispdp(b,3)@}, {@dispsf(b,4)@}', 'test-case'); + $at1 = castext2_evaluatable::make_from_source('{@dispdp(a,0)*x^2@}, {@dispdp(b,3)@}, {@dispsf(b,4)@}, {@decimalplaces(a,0)@}, {@decimalplaces(1,2)@}', 'test-case'); $this->assertTrue($at1->get_valid()); $cs2->add_statement($at1); $cs2->instantiate(); - $this->assertEquals('\({3\cdot x^2}\), \({-4.000}\), \({-4.000}\)', $at1->get_rendered()); + $this->assertEquals('\({3\cdot x^2}\), \({-4.000}\), \({-4.000}\), \({3}\), \({1}\)', $at1->get_rendered()); } /** @@ -854,7 +854,7 @@ class castext_test extends qtype_stack_testcase { } $cs2 = new stack_cas_session2($s2, null, 0); - $at1 = castext2_evaluatable::make_from_source('{@dispdp(a1,0)*x^2@}, {@dispdp(b,3)@}, {@dispsf(b,4)@}', 'test-case'); + $at1 = castext2_evaluatable::make_from_source('{@dispdp(a1,0)*x^2@}, {@dispdp(b,3)@}, {@dispsf(b,4)@}, {@decimalplaces(a,0)@}, {@decimalplaces(1,2)@}', 'test-case'); $this->assertTrue($at1->get_valid()); $cs2->add_statement($at1); $cs2->instantiate();