Hi,

On Thu, Oct 30, 2008 at 4:35 AM, Henryk Trappmann
<[EMAIL PROTECTED]> wrote:
> Yes thats true. Currently if I need cached recursion (and I need it in
> the code),
> I do
>
> s = PS() #uninitialized powerseries
> def f(n):
>  #fibonacci example
>  if n==0 or n==1:
>    return 1
>  #do something with previous values
>  else:
>    return s[n-1] + s[n-2]
>
> and afterwards I set the coefficients:
>
> s.f = f
>
> maybe this is more comfortable with Streams, I dont know.

When I said recursively defined streams, I meant something a little
more general.  For example, if f is a power series and g is exp(f),
then g satisfies g = \int g*f'.  This translates to the following code
for the exponential of power series:

g.define( (f.derivative()*g).integral(base_ring(1)) )

The benefit of this is that it reduces the complexity of
exponentiation to that of multiplication for which there are fast
algorithms.  Generally, you want to reduce everything (composition,
division, logs, etc) to multiplication in order to get asymptotically
fast algorithms.

>> Specifically, in the constructor for your power series, you compute
>> coefficients and set the _val attribute.
>
> But thats pure luxury, its not really necessary.
>
>> I've looked over all of your code and would be willing to port over
>> all of the features not currently in Sage next Tuesday.
>
> Ok, then I agree (though thats not the lazy approach ;) )
>
> Some notes:
> 1. sexp should not belong to the powerseries package
> 2. it_matrixpower and it_mp is experimental and dont need to be ported
> 3. For each powerseries I additionally cached its powers (s**n), this
> saves a lot of computing time in composition and iteration.
>
> What about lazy Laurent series?

Are you asking how one would implement them?  What sort of features
would one require for lazy Laurent series?

> What about moving from combinat to rings?

The reason why it was in combinat/ is because I had written it for my
particular use case.  There are some things that need to be done for
it to be usable in a wider setting.  For example, certain things only
make sense when you have a power series over a field.

--Mike

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to