I am now refactoring PartialFraction. One thing I noted is that PartialFraction is underspecified. First, simplest partial fraction decomposition uses prime-power denominators. However, partial fraction decomposition makes sense also with more general denominators, just one need to ensure that denominators are coprime. Since partialFraction accepts Factored with not necessarily prime factors, it is possible to create such fractions. But then there are troubles with arithmetic because when adding to fractions denominators can have nontrivila common factors, so simple comparison of denominators is not enough.
In fact, there are possible troubles even with prime-power denominators: we can multiply prime by a unit and we again get a prime. So correct arithmetic would need to check if denominators are equivalent, which is not done in current code. Alternatively, we could assume canonicalUnitNormal, but ATM argument to PartialFraction is just an EuclideanDomain. We could also have different spec and require that all factors of denominators are pairwise coprime and chosen in canonical way. This is more powerful, but may be tricky for naive users. There is also question of nonunique representation. Namely currently we have: (1) -> p1 := 1 + partialFraction(-3, 7) 3 (1) 1 - - 7 Type: PartialFraction(Integer) (2) -> p2 := partialFraction(4, 7) 4 (2) - 7 Type: PartialFraction(Integer) (3) -> (p1 = p2)@Boolean (3) false Type: Boolean (4) -> (p1::FRAC(INT) = p2::FRAC(INT))@Boolean (4) true Type: Boolean So current '=' in PartialFraction is wrong (that is easy to fix). But there is question if we should try to make representation more unique. In general there are multiple possible remainders, so different ways to write mathematically the same partial fraction. But in case of OrderedRing we could try to find positive remainder. In case of Integer this would lead to unique representation (assuming given denominators). Actally, I noticed the problem testing different implementation of 'partialFraction'. I got: (10) -> partialFraction(1,factorial 10) 97 58 13 6 (10) - -- + -- + -- - - 8 4 2 7 2 3 5 Type: PartialFraction(Integer) which is mathematically correct, but differs from previous result which has different signs. -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/ZjkPFP-MkwjKlzKJ%40fricas.org.