I currrently run into some trouble with the implementation of p-adic
integers.

I only do ring operations (+ and *) with them. In fact, I don't see how
during the computation anything else can happen, because I work in a
domain that requires QEtaAlgebra(X) as its input parameter (see below).

During the computation all these operations will be (in parallel)
executed on elements of Polynomial BalancedPAdicInteger p (for some
prime p).

I expected that the stream inside BalancedPAdicInteger is always
explicitylyFinite. But obviously, it isn't. In some longer computation I
ended up with a value O(p^30) which is not a finite stream and should
actually be equal to zero (because I had an integer computation running
in parallel).

I don't yet exactly know where the problem starts, but there are some
places that look suspicious. For example here:

https://github.com/hemmecke/fricas/blob/master-hemmecke/src/algebra/padic.spad#L119

    x = y ==
      st : ST I := stream(x - y)
      n : I := _$streamCount$Lisp
      for i in 0..n repeat
        empty? st => return true
        frst st ~= 0 => return false
        st := rst st
      empty? st

So the computation might be influenced by what
  )set stream calculate n
is currently active.

However, all that shouldn't matter in my case. Also the function
  *: (C, %) -> %
shouldn't be a problem, because the first parameter is always coming
from an integer, i.e. integer coerced into C (=BalancedPAdicInteger p).

I don't see in padic.spad how with just + and * (and -) I would ever end
up with a non-finite p-adic number (that is actually representing 0).

Does someone else see that from the code?

BTW, why does it make sense that the representation is just Stream(I)
(instead of a pair (initial exponent, stream)? Doesn't that lead to a
big number of leading zeros if all involved numbers are multiples of p^n
for some big n. In fact, the implementation of order suggests that n
must be smaller than 1000.
Looks like an unnecessary hardcoded restriction.

Thanks
Ralf


---------------------------------------------------
QEtaAlgebra(C: CommutativeRing): Category == CoercibleTo OutputForm with
    0: %
      ++ 0 is the neutral element with respect to +.
    1: %
      ++ 1 is the neutral element with respect to *.
    zero?: % -> Boolean
      ++ zero?(x) returns true if x is the neutral element with respect
to +.
    _+: (%, %) -> %
      ++ Commutative addition.
    _-: (%, %) -> %
      ++ Inverse operation to addition.
    _*: (%, %) -> %
      ++ Commutative multiplication
    _*: (C, %) -> %
      ++ Multiplication by a coefficient.
    _^: (%, N) -> %
      ++ Exponentiation (repeated multiplication)

-- 
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 post to this group, send email to [email protected].
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