Nils,

Something *is* fishy here. Annotated but unedited transcript :

charpent@asus16-ec:~$ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 7.5.rc1, Release Date: 2016-12-28                 │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: var("j,p",domain="integer")
(j, p)
sage: sum(j,j,1,p)
1/2*p^2 + 1/2*p

This is what one expects from sage...

sage: maxima("sum(j,j,1,p)").sage()
sum(j, j, 1, p)

This is what is expected from Maxima, as long as simpsum is not true 
(default)

sage: maxima.sum(j,j,1,p).sage()
j*p

This is sheer, chemically pure (analytical quality) madness.

sage: maxima_calculus(sum(j,j,1,p)).sage()
1/2*p^2 + 1/2*p

This is mathematically correct, and show that the maxima_calculus interface 
somehow does (temporarily) sets simpsum.
Note the syntax I employed : the call is the argument of maxima_calculus, 
not a method...

sage: %%maxima
....: sum(j,j,1,p);
....: 
'sum(j,j,1,p)

As expected from Maxima.

sage: %%maxima
....: sum(j,j,1,p),simpsum;
....: 
(p^2+p)/2

Again, as expected.

sage: maxima_calculus.sum(j,j,1,p).sage()
j*p

Madness again. This time, this is a method call...

Compare :

sage: 
maxima_calculus.sumcontract(maxima_calculus.intosum(sum(X(j),j,1,p+1)-sum(
....: X(j),j,1,p))).sage()
X(p + 1)
sage: 
maxima.sumcontract(maxima.intosum(sum(X(j),j,1,p+1)-sum(X(j),j,1,p))).sage
....: ()
X(p + 1)

Same difference... However, this tends to show that the madness is on *our* 
side...


Le vendredi 30 décembre 2016 19:05:19 UTC+1, Nils Bruin a écrit :
>
> On Friday, December 30, 2016 at 3:43:34 AM UTC-8, Emmanuel Charpentier 
> wrote:
>>
>> I also note that our use of Maxima's product() is wrong, wrong, wrong :
>>
>> sage: maxima.product(X(j),j,1,p).sage()
>> X(j)^p
>>
>> Maxima left to its own resources does something acceptable (if not really 
helpful) :

sage: maxima("product(X(j),j,1,p);")
'product(X(j),j,1,p)

 

>
> maxima.sum is equally wrong:
>
>  sage: maxima_calculus.sum(j,j,1,p)
> _SAGE_VAR_j*_SAGE_VAR_p
>

No. That's Sage interpretation of what Maxima does with what Sage sends it. 
Typed directly (on command line, in a %%maxima cell or in a maxima("...") 
call), Maxima returns what's expected. My conclusion is that Sage either 
sends cat food to Maxima or does dog food with what Maxima sends bacl
k. In both cases, that's a bit unappetizing... 

>
> Note that the call procedure here is the one employed for expect 
> interfaces, so it amounts to something like the maxima script:
>
> sage1 :  j
> sage2 :  j
> sage3 : 1
> sage4 : p
> sum(sage1,sage2,sage3,sage4)
>
> which indeed results in "j*p"
>

Huh ? How do you reach this conclusion ? 

>
> It looks like sum and product simplify before they evaluate their 
> variables. This is a bug in maxima, not in the sage interface, I would say.
>

I'm afraid I can't agree (see above). Unless I'm missing your point 
entirely, which is, of course, possible... 

HTH,

--
Emmanuel Charpentier

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to