Ralf Hemmecke wrote:
> 
> On 02/19/2016 11:53 PM, Ralf Hemmecke wrote:
> > Laurent series.
> > 
> > Multiplication is implemented like this.
> > 
> > x : % * y : % == laurent(getExpon x + getExpon y, getUTS x * getUTS y)
> 
> Since I have anyway a wrapper for Laurent series in my program, I
> changed the zero?(x) function there to destructively change x to
> (removeZeroes(x)). That works for my special case since I work with
> special Laurent series that allow algorithmic zero detection.

Hmm.  I consider calling 'zero?' on series as an error.  In fact
I tried to modify 'zero?' for series to just raise error.  This
discovered several places in algebra that depend on 'zero?' for
series.  ATM I am keeping algebra as is to avoid loss of
functionality.  However, the uses of 'zero?' I found are bugs:
we are using algorithms which were not desined to work with
series and they may produce wrong results or be very inefficient.
Unfurtunately, proper fix requires significant effort...

> Anyway, this little change led to a computation trace without any memory
> problem.
> 
> But now the question is how and whether the current implementation of
> UnivariateLaurentSeries should be changed without too much impact on
> existing code that uses that domain.
> 
> A good place to (destructively) change x when computing some function
> would be order: % -> Integer and order: (%, Integer) -> Integer.
> According to the documentation the order function looks for the first
> non-zero coefficient, so it needs to compute till the true order (or run
> into an infinite loop). I have no idea whether this place would be
> sufficient (probably not), but at least the series would behave a bit
> better.

Maybe.  But destructive modification is potentially troblesome,
so I would like to keep it confined to small number of places.

> One could additionally think of checking whether after addition (or
> multiplication in a ring with zero divisors) the leading coefficient is
> zero and thus increasing the order by at least 1.
> In fact, I think it would be a good idea to try checking the coeffients
> as long as the order is negative and stop at order=1 if all coefficients
> are 0. Furthermore, for a series x that yields n:=getExpon(x)>0 one
> would test (at most) n coefficients to get closer to the true order of
> the series.

Oh, no.  Testing for zero is potentially troblesome, so we want to
have as little zero tests as possible. And you propose new tests...
> 
> Now, though I find all this quite reasonable, it is also questionable,
> because it involves the computation of more and more coefficients and
> thus the series do not behave as lazy as they could. That could cause
> problems.

Loss of lazyness is a no go: it would break most computations
with series.

> However, according to how multiplication is currently implemented, it
> makes perfectly sense to first get (at least closer to) the true order
> since otherwise computing already the first coefficient of the result
> involves computing too many coefficients of the multiplicants.
> 
> Opinions?

Take into account that standard series domains are dense (they keep
zero terms).  We also have "sparse" series domains, you can try them.
  
-- 
                              Waldek Hebisch

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to