On Tue, Aug 23, 2022 at 05:55:29AM -0700, 'Martin R' via FriCAS - computer
algebra system wrote:
> If I understand correctly, FriCAS' result of integrate(1/(b*x^5+a), x)
> contains some algebraic numbers with placeholders like %%G0. To convert
> the result into a sage expression, these are substituted back.
> Unfortunately, these expressions may be extremely large, and this effect
> multiplies when the constants appear multiple times.
Those are not placeholders, they are roots of polynomials in
implict form. MMas call them RootOf.
> If you have any suggestions on how to improve the situation, I'd be happy
> to hear it. Leaving them out is not really an option, because one may want
> to do further computations with the integral.
Represent them faithfully as implicit roots. AFAICS Sage expands
them to explicit form and this is _much_ larger than necessary.
Worse, explicit form is problematic for later computations.
BTW: Could you try the the attached patch? The patch is not
ready to be included now, but once problems are worked out
many integrals will produce result like below. In this example
with the patch I get:
(1) -> integrate(1/(b*x^5+a), x)
--+
(1) > %E log(x + 5 %E a)
--+
4 5
3125 a b %E - 1 = 0
Type: Union(Expression(Integer),...)
(2) -> %::EXPR(INT)::InputForm
(2)
(%root_sum (* %E (log (+ x (* (* 5 %E) a)))) %E
(/ (+ (* (* (* 3125 (^ %E 5)) (^ a 4)) b) - 1) (* (* 3125 (^ a 4)) b)))
Type: InputForm
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/20220823142241.GA29641%40fricas.math.uni.wroc.pl.
--- ../fr-build57/src/algebra/IR2F.spad 2022-08-16 18:48:53.015895622 +0000
+++ IR2F.spad 2022-08-23 14:12:14.713364646 +0000
@@ -67,9 +67,21 @@
is?(k, 'nthRoot) and even?(retract(second argument k)@Z)
and (not empty? variables first argument k)]
+ log_to_sum : LOG -> F
+
+ log_to_sum(l : LOG) : F ==
+ sc := l.scalar::F
+ cc := l.coeff
+ degree(cc) = 1 => sc*linear(cc, l.logand)
+ s := new()$Symbol
+ sf := s::F
+ sc*rootSum(cmplex(sf, l.logand), cc, s)
+
+
expand(i, x) ==
j := split i
- pairsum([IR2F j], mkRealFunc(logpart(j), x))
+ res := IR2F(j) + +/[log_to_sum(lg) for lg in logpart(j)]
+ [res]
split i ==
mkAnswer(ratpart i, concat [nlogs l for l in logpart i], notelem i)