Answering my own question -- but as a cautionary tale for others.  I
mistakenly thought that if I define a power series ring with some
default precision, say 200, and create an object in it out of a vector
of 200 coefficients, then it would automatically have +O(q^200) added,
but that is not the case -- the object is treated just as if it is a
polynomial of degree 199 with no truncation.  This was causing a
problem since I was multiplying 39 such things together, and the
results ended up with "degree" almost 8000.  And the later
coefficients are enormous, which makes matters worse.

When I manually add +O(q^200) after creating the objects the running
time goes from hours to seconds, as I always thought it should.

Maybe I am just stupid, but I think that it would be good for this
behaviour to be documented more clearly!  After all, if I define
R=RealField(200) and mutiply elements of R together the results will
still only have 200 bits of precision.  (And yes, I do know the
difference between archimedean and non-archimedean valuations, but
still!)

John

On 25 March 2013 15:15, John Cremona <john.crem...@gmail.com> wrote:
> In a current project I have to compute quite a lot of monomial
> expressions of the form X^i*Y^j*Z^k where i+j+k=39 and X,Y,Z are power
> series in one variable over a cubic number field.  This takes a *very*
> long time once the coefficients of the intermediate expressions get
> large.  (I tried to optimize by first computing the first 39 powers of
> each of X,Y,Z and only then compute their products;  it was very
> noticeable that the first few powers are quick but by the 39th they
> are taking a minute or more to multiply by another X.)
>
> By contrast after cutting-and-pasting into Magma the monomial
> evaluations take seconds (to do all of them).
>
> Any idea what makes Sage so very uncompetitive here?  Is it the basic
> arithmetic in the number field, rather than anything to do with the
> power series?
>
> John
>
> PS On the other hand the linear algebra step which followed was
> instantaneous in Sage (finding the 1-d kernel of a 155x600 matrix over
> Q) and slower in Magma.  But before I restricted scalars and had a
> 155x200 matrix over the cubic field, Sage took hours.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to