Let's construct a series that is zero to all orders:
ser := series(exp(x),x=0)
zeroSeries := ser-ser

I would like to check if the first 10 coefficients are zero, so I truncate

trunc := truncate(zeroSeries,10)
test(trunc = 0$UnivariatePuiseuxSeries(Expression(Integer),x,0))

and the comparison with 0 is indeed true.

On the other hand
zero?(trunc) is false because of the way it checks the coefficients stream. 
I am not sure if you consider this a bug, but I wanted to have it 
mentioned, since it seems on the unexpected-behavior side for a finite 
stream, at least for me.

zero? x ==
    empty? (coefs := coefficients x) => true
    (zero? frst coefs) and (empty? rst coefs) => true
    false

Now the interesting behavior goes on:

test(truncate(zeroSeries,10) = 
0$UnivariatePuiseuxSeries(Expression(Integer),x,0))
is true

but 
test(truncate(zeroSeries,20) = 
0$UnivariatePuiseuxSeries(Expression(Integer),x,0))
is false

So there also seems to be some cutoff built in?
It seems, the safest way is to directly check the first N terms of 
coefficients(zeroSeries) and not rely on truncate and "zero?".

Best wishes,
Tobias

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/f549009c-2da7-4867-a847-30536e882667n%40googlegroups.com.

Reply via email to