Question about temporary variables



>> Short answer is that ?g1234 etc are so-called gensyms,
>> that is, generated Lisp symbols.
>>
>> Looks like ?g1811 is a dummy variable in the Laplace transform.
>> On the face of it, it looks correct, but desolve could
>> pick a less confusing name.
>>

Thanks, that helps greatly.  I figured it was the case, but had never
seen this before.  We can try to catch those in our Maxima 'parser' (I
use quotes because it's just some very basic string stuff).

On Mon, Mar 14, 2011 at 6:10 PM, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
> This is a bug: Maxima output should never include bare Lisp symbols (unless
> of course the user entered them), and should never include Lisp gensyms
> (which cannot be input by the user). ?Apparently desolve uses Lisp gensyms
> in the expectation that ilt/laplace will eliminate them

Ah, but in this case apparently could not, since the function was
symbolic. Is that correct?

> Of course, if Sage allowed initial "?" in symbol names, this particular

Sorry, that's a limitation of Python, as far as I know.  See
http://www.python.org/dev/peps/pep-3131/, in particular "ID_Start is
defined as all characters having one of the general categories
uppercase letters (Lu), lowercase letters (Ll), titlecase letters
(Lt), modifier letters (Lm), other letters (Lo), letter numbers (Nl),
the underscore, and characters carrying the Other_ID_Start property.
XID_Start then closes this set under normalization, by removing all
characters whose NFKC normalization is not of the form ID_Start
ID_Continue* anymore."

> problem would go away. ?(Though it does seem weird that Sage is using the
> stringout form of expressions rather than the s-expressions to communicate
> with Maxima.)

I don't know what s-expressions are, but the original Sage interface
was done lightning fast a number of years ago simply to provide
calculus functionality from the Sage command line, hence passing
strings back and forth via "pexpect".

Things have developed a lot since then, but moving from strings to
Lisp expressions or trees is non-trivial.  There has been a lot of
movement on this as of late - see
http://trac.sagemath.org/sage_trac/ticket/7377 - with the hope of
using ECL expressions for most the communicating in the future.

> ?? ? ? ? ? ? -s
> PS It would help if the actual call to Maxima were included in reports like
> this, rather than the Sage form. ?In particular, I don't quite get the

Oh, I was only asking what the ?g symbols were; I wasn't reporting a
bug in Maxima by any means.  I'm sorry if that wasn't clear.  Because
of the string business, getting at the Maxima command involved would
have taken me more time than I had.

> x1=function('x1',t) construction. I reproduced the problem with

This is how Sage constructs a symbolic dummy function.

> ?? de1: diff(x1(t),t)=-3*(x2(t)^2-1);
> ?? de2: diff(x2(t),t)=1;
> ?? desolve([de1,de2],[x1(t),x2(t)]);
> A simpler example:
> ??desolve([diff(f(x),x)=f(x^2)],[f(x)]);

Thanks, that is very helpful.

Barton's comment suggests that maybe new_variable could fix this?

Thank you all for the clarifications.