rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

Parametric ploting with the variable s as symbolic does not work #783

Closed rtoy closed 2 months ago

rtoy commented 2 months ago

Imported from SourceForge on 2024-07-03 10:36:10 Created by diegotorquemada on 2014-11-04 22:33:57 Original: https://sourceforge.net/p/maxima/bugs/2835


Hello all.

I am using Maxima 5.32.1 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.10 (a.k.a. GCL) In Linux Mint Qiana 17 (Linux kernel 3.13.0-24-generic)

Parametric ploting with the variable s as symbolic does not work. For example with:

r: (exp(cos(s))-2*cos(4*s)-sin(s/12)^5)$
plot2d([parametric, r*sin(s), r*cos(s), [s, -8*%pi, 8*%pi]])$

I get the error:

plot-options-parser: unknown plot option: 
 [s,-25.13274122871834,25.13274122871834]
 -- an error. To debug this try: debugmode(true);

with another variable (e.g. t) it does work:

r: (exp(cos(t))-2*cos(4*t)-sin(t/12)^5)$
plot2d([parametric, r*sin(t), r*cos(t), [t, -8*%pi, 8*%pi]])$

and I get the corresponging gnuplot graphic.

In previous versions of MAXIMA I did not have that problem.

Kind regards,

Diego

rtoy commented 2 months ago

Imported from SourceForge on 2024-07-03 10:36:11 Created by villate on 2014-11-05 11:14:56 Original: https://sourceforge.net/p/maxima/bugs/2835/#739b


Diff:


--- old
+++ new
@@ -7,22 +7,25 @@

 Parametric ploting with the variable s as symbolic does not work. For example with:

+~~~~
 r: (exp(cos(s))-2*cos(4*s)-sin(s/12)^5)$
 plot2d([parametric, r*sin(s), r*cos(s), [s, -8*%pi, 8*%pi]])$
-
+~~~~

 I get the error:

+~~~~
 plot-options-parser: unknown plot option: 
  [s,-25.13274122871834,25.13274122871834]
  -- an error. To debug this try: debugmode(true);
-
+~~~~

 with another variable (e.g. t) it does work:

+~~~~
 r: (exp(cos(t))-2*cos(4*t)-sin(t/12)^5)$
 plot2d([parametric, r*sin(t), r*cos(t), [t, -8*%pi, 8*%pi]])$
-
+~~~~

 and I get the corresponging gnuplot graphic.
rtoy commented 2 months ago

Imported from SourceForge on 2024-07-03 10:36:15 Created by villate on 2014-11-05 11:16:55 Original: https://sourceforge.net/p/maxima/bugs/2835/#555a


rtoy commented 2 months ago

Imported from SourceForge on 2024-07-03 10:36:18 Created by tjh1000 on 2016-09-22 15:16:39 Original: https://sourceforge.net/p/maxima/bugs/2835/#79a5


We have just encountered this, upgrading a system from Maxima 5.23.1 (yes, I know. Hangs head in shame) to 5.38.1. This is breaking some of our Maxima code.

Therefore, I have been googling and it seems the problem was present in at least 5.32.1 (E.g. http://def.fe.up.pt/pipermail/maxima-discuss/2015/051474.html), 5.36.1 and 5.38.1 (presmabaly all other in between to, but those are the numbers I have seen quoted, or tested myself.)

The error seems to be coming from here: https://sourceforge.net/p/maxima/code/ci/master/tree/src/plot.lisp#l1563. This suggests to me (and I know almost nothing about Maxima internals, or Lisp) that the plotting is not fundamentally broken. It is just that plot-options-parser is flagging a false positive that is breaking things. One might hope that should not be so hard to fix.

Trawling through git history, this might be the moment it broke: https://github.com/andrejv/maxima/commit/3066cbd7e2c1cafc3b53cdb29e134c8e35cd899c#diff-19757b969f6ed22eed27e7ea653d7d77R1382/ (That changes was in 5.32.0, but not any previous tags, which ties up with the reports online.)

The old code just above https://github.com/andrejv/maxima/commit/3066cbd7e2c1cafc3b53cdb29e134c8e35cd899c#diff-19757b969f6ed22eed27e7ea653d7d77L1395 did not look for the range of a variable called t as a plot option, and did not flag an option if the plot option was not recognised: https://github.com/andrejv/maxima/commit/3066cbd7e2c1cafc3b53cdb29e134c8e35cd899c#diff-19757b969f6ed22eed27e7ea653d7d77L1425.

The new code does look for the range of a variable called t, and throws an error for unrecognised plot options, which includes the range of any other parametric variable.

Note that, to this day, the documentation does not say 'you must call your parametric variable t' (presumably because we want to fix this bug), but neither does it link to this bug with a warning. (I am lookin at http://maxima.sourceforge.net/docs/manual/maxima_12.html#SEC62, search for '[param, min, max]' in the page to find the relevant bit.

It would be really, really nice if this could be fixed. Otherwise, I have l lot of code to fix manually, and it is not a place where one can do a simple search/replace on the parametric variable name. Thanks.

rtoy commented 2 months ago

Imported from SourceForge on 2024-07-03 10:36:22 Created by villate on 2017-11-21 09:31:47 Original: https://sourceforge.net/p/maxima/bugs/2835/#0307


rtoy commented 2 months ago

Imported from SourceForge on 2024-07-03 10:36:25 Created by villate on 2017-11-21 09:31:47 Original: https://sourceforge.net/p/maxima/bugs/2835/#a657


I have finally fixed this bug with commit [5b0169]. I appologize for not having fixed it several years ago!

rtoy commented 2 months ago

Imported from SourceForge on 2024-07-03 10:36:29 Created by tjh1000 on 2017-11-21 10:25:26 Original: https://sourceforge.net/p/maxima/bugs/2835/#013b


:-) Thank you very much.