Skip to content

Commit a9de60e

Browse files
authored
Merge pull request #1638 from maths/iss1636
Add in support for implicit plots using Maxima's plot2d.
2 parents d3b633e + 9400054 commit a9de60e

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

doc/en/CAS/Maxima_plot.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ The following CASText gives representative examples of the plot2d features suppo
188188
{@plot(x^3,[x,-3,3], [alt,"What is this function?"])@}
189189
<h3>Multiple graphs, clips the \(y\) values</h3>
190190
{@plot([x^3,exp(x)],[x,-2,2],[y,-4,4])@}
191+
<h3>Implicit plot</h3>
192+
{@plot(2^2*x*y*(x^2-y^2)-x^2-y^2=0, [x,-4,4], [y,-4,4])@}
191193
<h3>With and without a grid</h3>
192194
{@plot([x^2/(1+x^2),2*x/(1+x^2)^2], [x, -2, 2], [y,-2.1,2.1], grid2d)@}
193195
{@plot([x^2/(1+x^2),2*x/(1+x^2)^2], [x, -2, 2], [y,-2.1,2.1])@}

doc/en/Developer/Development_track.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ We use the [github issue tracker](https://github.com/maths/moodle-qtype_stack/is
99

1010
This incremental release contains some minor, but useful, bug fixes.
1111

12-
Add in support for JSXGraph 1.12.2.
12+
* Add in support for JSXGraph 1.12.2.
13+
* Add in support for implicit plots via Maxima's `plot2d` command, wrapped in STACK as `plot`.
1314

1415
This release contains the [HELM materials](../STACK_question_admin/Library/HELM.md) as part of the STACK question library. HELM question banks are managed using [Gitsync](https://github.com/maths/moodle-qbank_gitsync).
1516

doc/en/Specialist_tools/Graphics.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ There are a number of ways to embed plots, images, diagrams etc into STACK.
1212
Notes.
1313

1414
* The `draw` package is currently not supported.
15-
* Maxima's `implicit_plot()` function does not respect the plot options, and we cannot place the resulting plot files in the correct places. Hence, STACK does not currently support implicit plots. For reference try `load("implicit_plot");implicit_plot(x^2+y^2=x^2*y^2+1,[x,-2,2],[y,-2,2]);` in Maxima.
1615
* As of version 4.0, the tags `{#...#}` provide the possibility to interact with 3rd party scripts. If you have examples of this, please contact the developers.

lang/en/qtype_stack.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,8 +683,8 @@
683683
$string['healthchecksampleinlinetex'] = '\(\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}\).';
684684
$string['healthcheckmaximalocal'] = 'Contents of the maximalocal file';
685685
$string['healthcheckplots'] = 'Graph plotting';
686-
$string['healthcheckplotsintro'] = 'There should be two different plots. If two identical plots are seen then this is an error in naming the plot files. If no errors are returned, but a plot is not displayed then one of the following may help. (i) check read permissions on the two temporary directories. (ii) change the options used by GNUPlot to create the plot. Currently there is no web interface to these options.';
687-
$string['healthchecksampleplots'] = 'Two example plots below. {@plot([x^4/(1+x^4),diff(x^4/(1+x^4),x)],[x,-3,3])@} {@plot([sin(x),x,x^2,x^3],[x,-3,3],[y,-3,3],grid2d)@} A third, smaller, plot should be displayed below with traditional axes. {@plot([x,2*x^2-1,x*(4*x^2-3),8*x^4-8*x^2+1,x*(16*x^4-20*x^2+5),(2*x^2-1)*(16*x^4-16*x^2+1)],[x,-1,1],[y,-1.2,1.2],[box, false],[yx_ratio, 1],[axes, solid],[xtics, -3, 1, 3],[ytics, -3, 1, 3],[size,250,250])@}';
686+
$string['healthcheckplotsintro'] = 'Sample plots.';
687+
$string['healthchecksampleplots'] = 'Two example plots below. {@plot([x^4/(1+x^4),diff(x^4/(1+x^4),x)],[x,-3,3])@} {@plot([sin(x),x,x^2,x^3],[x,-3,3],[y,-3,3],grid2d)@} A third, smaller, plot should be displayed below with traditional axes. {@plot([x,2*x^2-1,x*(4*x^2-3),8*x^4-8*x^2+1,x*(16*x^4-20*x^2+5),(2*x^2-1)*(16*x^4-16*x^2+1)],[x,-1,1],[y,-1.2,1.2],[box, false],[yx_ratio, 1],[axes, solid],[xtics, -3, 1, 3],[ytics, -3, 1, 3],[size,250,250])@} Fourth is an implicit plot {@plot(2^2*x*y*(x^2-y^2)-x^2-y^2=0, [x,-4,4], [y,-4,4])@}';
688688
$string['healthcheckjsxgraph'] = 'JSXGraph binding and MathJax';
689689
$string['healthcheckjsxgraphintro'] = 'There should be a graph and an input below. Interacting with the graph should affect the input and vice versa. If not, then there are issues with JavaScript libraries or execution. The graph should also have a MathJax-rendered LaTeX formula visible. If not, then you might be blocking access to certain things and may need to tune firewalls, proxys, etc.; if you are running a closed install, try adjusting the remote addresses in <code>vle_specific.php</code>. The graph (if functioning) is based on <a href="https://jsxgraph.org/share/example/differential-equations">this example</a>.';
690690
$string['healthcheckjsxgraphsample'] = '<div class="formulation" style="width:36vw;margin:auto;">

stack/maxima/stackmaxima.mac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,8 +1046,8 @@ plot(ex, [ra]) := /*stack_web_plot*/
10461046
ex:ev(ex, lg=logbasesimp),
10471047
lvs: listofvars(%_ce_rem(ex)),
10481048
lvs: sublist(lvs, lambda([ex], not(ex = discrete or ex = parametric or ex = minus or ex = plus))),
1049-
if length(lvs)>1 then
1050-
error("Plot error: Can't create a plot with more than one variable, whereas you have: \\(",string(lvs),"\\)"),
1049+
if length(lvs)>2 then
1050+
error("Plot error: Can't create a plot with more than two variables, whereas you have: \\(",string(lvs),"\\)"),
10511051
/*********************/
10521052
/* Sort out alt-text */
10531053
kill(alt),

0 commit comments

Comments
 (0)