Skip to content

Bug: Maxima's grind function fails when used in mcall #33

@odysseus9672

Description

@odysseus9672

When I try to use the grind function in mcall I get a warning. Using string on the same example works fine:

julia> mcall( m"string(x+5*h)" )
 
                                     x+5*h

julia> mcall( m"grind(x+5*h)" )
WARNING: Invalid Maxima expression
 
incorrect syntax: Missing )
'(x+5*h$
      ^

Here's the corresponding i/o from a Maxima session:

(%i1) string(x + 5*h);
(%o1)                                x+5*h
(%i2) grind(x + 5*h);

x+5*h$
(%o2)                                done

The reason for using grind is that it, basically, does the same thing as string, but it breaks the output up into individual lines. Here, for example, is the output of grind for a longer expression:

(-(4*m^2*r0^9)/h^5)-(6*m^2*r0^8)/h^4-(9*m^2*r0^7)/h^3-(36*r0^7)/h^5
                   -(15*m^2*r0^6)/(2*h^2)-(54*r0^6)/h^4-(9*m^2*r0^5)/(5*h)
                   -(72*r0^5)/h^3+(m^2*r0^4)/4-(45*r0^4)/h^2-(12*r0^3)/h
                   -(11*h^4*m^2)/840-(3*h^2)/14$

while for string it's:

(-(4*m^2*r0^9)/h^5)-(6*m^2*r0^8)/h^4-(9*m^2*r0^7)/h^3-(36*r0^7)/h^5-(15*m^2*r0^6)/(2*h^2)-(54*r0^6)/h^4-(9*m^2*r0^5)/(5*h)-(72*r0^5)/h^3+(m^2*r0^4)/4-(45*r0^4)/h^2-(12*r0^3)/h-(11*h^4*m^2)/840-(3*h^2)/14

(possibly with quote marks that Maxima isn't displaying).

I'm not sure if the difference is that grind attempts to print the line to Maxima's output stream, while string just returns a string. As such, maybe this belongs in "won't fix", since fixing it may involve a major restructuring of how Maxima.jl interfaces with Maxima (i.e. giving the user some way to access Maxima's stdout).

For my use case, setting the flag grind : True will actually suffice.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions