I have no great experience with pattern matching.

While constructing

combineRadicals := rule (_
  sqrt(-(x|integer? x and positive? integer x)) *_
  sqrt(-(y|integer? y and positive? integer y))_
    == -sqrt(x*y);_
  sqrt((x|integer? x)) *_
  sqrt((y|integer? y and positive? integer y))_
    == sqrt(x*y))

I initially hat quite some difficulties, because one cannot simply write
"x>0" instead of "positive? integer x". I basically guessed "positive?".

The FriCAS book is quite silent about what expressions can actually occur in a suchThat expression of a rule.

Can someone point me to the source code where I can find the implementation of that "positive?" (and maybe "negative?", etc.)

Maybe we should list all these possible functions in the patter matching section of the FriCAS book.

Ralf

PS: Would it make sense to include the above rule (even though it is very limited) as a function rootCombine along the functions rootSplit rootFactor and rootSimp in AlgebraicManipulation?

If yes, I will try to provide a patch.

Furthermore, the documentation of rootSplit says that it is generally not valid. Agreed, but can we at least implement it in such a way (maybe it is already) that the documentation can say that for positive integers a, b it splits sqrt(-a/b) as sqrt(-a)/sqrt(b) and maybe even as sqrt(-1)*sqrt(a)/sqrt(b). If one can rely at least on that, it would allow (on a big subset of expressions) to split the expression into a real and imaginary part. Maybe it is not only me who would find that useful.

--
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/cdaf39e6-97ca-4a13-88a9-7ac92ca72c8b%40hemmecke.org.

Reply via email to