STACK plot() function - adding a single point to an existing plot

Re: STACK plot() function - adding a single point to an existing plot

by Christopher Sangwin -
Number of replies: 1
Picture of Particularly helpful Moodlers Picture of Plugin developers

I've adapted the answer from the Maxima docs http://maxima.sourceforge.net/docs/manual/maxima_12.html to give

{@plot(discrete,[[10, 0.6], [20, 0.9], [30, 1.1], [40, 1.3], [50, 1.4], 2*%pi*sqrt(l/980)], [l,0,50],[style, points, lines], [color, red, blue],[point_type, asterisk])@}

Adapting this again for your example.

{@plot(discrete,[[30,7], -0.4*x+19],[x,0,60],[y,0,20],[style, points, lines], [color, red, blue],[point_type, asterisk])@}

Or, using question variables.

b: -0.4*x+19;
pts:30,7;

{@plot([[discrete,pts], b],[x,0,60],[y,0,20],[style, points, lines], [color, red, blue],[point_type, asterisk])@}

There was a similar example in the STACK docs, but was somewhat hard to find.

[Note, I've subtly changed your function from -0.4*x-19 to -0.4+19, otherwise your plot does not go through the point, and does not appear in your specified coordinate window.  Was that your problem?!]

Chris


In reply to Christopher Sangwin

Re: STACK plot() function - adding a single point to an existing plot

by Paul Young -

Hi Chris,

I've tried using this example in one of my plots, and I find that the point appears at the coordinate (1,7) rather than (30,7).  The coding that works is:

b: -0.4*x+19;

ptx:[30];

pty:[7];

{@plot([[discrete,ptx,pty], b],[x,0,60],[y,0,20],[style, points, lines], [color, red, blue],[point_type, asterisk])@}

Paul