Skip to content
Snippets Groups Projects
Commit 35eea30e authored by Chris Sangwin's avatar Chris Sangwin
Browse files

Merge remote-tracking branch 'origin/master' into dev

parents 8656d83d b42507fe
Branches
No related tags found
No related merge requests found
...@@ -22,7 +22,7 @@ Optionally, depending on the question settings, you have ...@@ -22,7 +22,7 @@ Optionally, depending on the question settings, you have
i: %i i: %i
j: %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}");`. 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}");`.
......
...@@ -269,7 +269,7 @@ The first of these does not pull out a numerical denominator. The second does. ...@@ -269,7 +269,7 @@ The first of these does not pull out a numerical denominator. The second does.
### Trig simplification ### ### 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); declare(n,integer);
sans1:ev(trigrat(ans1),simp); sans1:ev(trigrat(ans1),simp);
......
...@@ -10,8 +10,8 @@ for somewhat obvious reasons! Hence, we need to restrict the availability of ce ...@@ -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. 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. 3. Student. Student's expressions can only contain these.
Since STACK 4.3 the Maxima statement parser infrastruture uses a JSON file Since STACK 4.3 the Maxima statement parser infrastructure uses a JSON file
describing all identifiers of functions, variables, constants, and operators describing all identifiers of functions, variables, constants and operators
and features we attach to them. The catalogue is stored in and features we attach to them. The catalogue is stored in
stack/cas/security-map.json stack/cas/security-map.json
......
...@@ -13,7 +13,9 @@ These are notes on configuring the MathJax filter options for use with STACK. ...@@ -13,7 +13,9 @@ These are notes on configuring the MathJax filter options for use with STACK.
## Accessibility ## ## 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 ## Adding MathJax to additional HTML
......
...@@ -744,7 +744,13 @@ decimalplacesfun(ex, n, dispdps) := block([ex2], ...@@ -744,7 +744,13 @@ decimalplacesfun(ex, n, dispdps) := block([ex2],
if dispdps then ex2:displaydp(ex2, n), if dispdps then ex2:displaydp(ex2, n),
return(ex2) 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( dispdp(ex, n) := block(
if not(real_numberp(ex)) then error("dispdp requires a real number argument."), 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."), if not(integerp(n)) then error("dispdp cannot create a non-integer number of decimal places."),
......
...@@ -816,12 +816,12 @@ class castext_test extends qtype_stack_testcase { ...@@ -816,12 +816,12 @@ class castext_test extends qtype_stack_testcase {
} }
$cs2 = new stack_cas_session2($s2, null, 0); $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()); $this->assertTrue($at1->get_valid());
$cs2->add_statement($at1); $cs2->add_statement($at1);
$cs2->instantiate(); $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 { ...@@ -835,12 +835,12 @@ class castext_test extends qtype_stack_testcase {
} }
$cs2 = new stack_cas_session2($s2, null, 0); $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()); $this->assertTrue($at1->get_valid());
$cs2->add_statement($at1); $cs2->add_statement($at1);
$cs2->instantiate(); $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 { ...@@ -854,7 +854,7 @@ class castext_test extends qtype_stack_testcase {
} }
$cs2 = new stack_cas_session2($s2, null, 0); $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()); $this->assertTrue($at1->get_valid());
$cs2->add_statement($at1); $cs2->add_statement($at1);
$cs2->instantiate(); $cs2->instantiate();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment