Some of the integration results are pages long -- because IntegrationResult often has a 'logpart', aka a rootSum form.
'lg2func' in IR2F uses 'zeroOf' which can introduce large radicals into the result. For example internalIntegrate(1/(z^4+1),z) internalIntegrate((1+z^2)^4/ (1+z^4)^4,z) Until recently I found that Rioboo's algorithm described in Manuel Bronstein's book, at the end of section 2.8, covers this situation. The core idea is that for polynomials with real coefficient, its roots come in pairs (symmetric over the real axis). So in the following computation of the rootSum of ilogs, many terms can cancel with each other. Sympy implements it, see 'log_to_real': https://github.com/sympy/sympy/blob/67e4a5c07c390d648601e8fbd6937c877c7438bb/sympy/integrals/rationaltools.py#L327C15-L327C15 Of course, this algorithm is not limited to rational function integration, it can improve other integrals as well. I have worked out a version in FriCAS, it's not a replace for 'lg2func' yet -- so my new function 'lg2func2' will try first, if it can't handle, then pass to 'lg2func'. The very rough first version only has 3 failures. I'm still working on them. Now, some questions: My code needs to use solve$TransSolvePackage. Because the resultant method mentioned in the book can't handle coefficients of EXPR. Are there alternatives? And will solve$TransSolvePackage only introduce necessary extra root kernels? TransSolvePackage is fixed to work with EXPR, not a generalized domain like the second parameter to IR2F. This doesn't work very well with integrals with parameters, because there will be branches -- is sqrt(-a) real or not? For even higher degree polynomials, I think it's wise to return rootSum instead of give results containing algebraic numbers, which causes trouble for sagemath. I'll post patch after I reviewed the test failures and do more testing. I think this will has positive effect on Nasser's CAS independent integration tests, to what extent, I don't know. - Qian This is the result with patch: (1) -> integrate(1/(z^4+1),z) (1) +-+ 2 +-+ 2 +-+ log(z\|2 + z + 1) - log(- z\|2 + z + 1) + 2 atan(z\|2 + 1) + +-+ 2 atan(z\|2 - 1) / +-+ 4 \|2 (2) -> integrate((1+z^2)^4/ (1+z^4)^4,z) (2) 12 8 4 +-+ 2 (33 z + 99 z + 99 z + 33)log(z\|2 + z + 1) + 12 8 4 +-+ 2 (- 33 z - 99 z - 99 z - 33)log(- z\|2 + z + 1) + 12 8 4 +-+ (306 z + 918 z + 918 z + 306)atan(z\|2 + 1) + 12 8 4 +-+ (306 z + 918 z + 918 z + 306)atan(z\|2 - 1) + 11 9 7 5 3 +-+ (240 z + 124 z + 672 z + 264 z + 432 z + 12 z)\|2 / 12 8 4 +-+ (384 z + 1152 z + 1152 z + 384)\|2 -- 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/7c5d4caf-ef73-4ef9-98cc-1ceaebf9a837%40gmail.com.