Re: [fricas-devel] [PATCH v1] add a special case in lg2func; fix serval integrals
> As I wrote in other mail I would like to generate 'rootSum' > instead of expanding roots. In principle after such change > definite integrator would work with 'rootSum' directly > skiping Rioboo, tantrick, etc. I don't understand. Why should integrate(1/(x^8-1),x) and integrate(8*sqrt(2)/(x^8-1),x) be so different? If you want to get 'rootSum', you probably will get complex result. On the other hand, in "x^4 + r", if we know that "r" is a quartic, then no more extra roots will be introduced, I think. Just compare current result and following reuslt. (1) -> integrate(a/(x^8-1),x) (1) +-+2 +-+ +-+ - a log(x\|2 + x + 1) - a\|2 log(x + 1) + a\|2 log(x - 1) + +-+2 +-+ +-+ a log(- x\|2 + x + 1) - 2a atan(x\|2 + 1) - 2a atan(x\|2 - 1) + +-+ - 2a\|2 atan(x) / +-+ 8\|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 post to this group, send email to fricas-devel@googlegroups.com. Visit this group at https://groups.google.com/group/fricas-devel. For more options, visit https://groups.google.com/d/optout.
Re: [fricas-devel] [PATCH v1] add a special case in lg2func; fix serval integrals
oldk1331 wrote: > > Compare the result of > integrate(1/(x^8-1),x) > integrate(8*sqrt(2)/(x^8-1),x) > integrate(a/(x^8-1),x) > > The first is more complex than the second one. > Why? Because: > (1) -> factor(x^4+1) > > 4 >(1) x + 1 > Type: Factored(Polynomial(Integer)) > (2) -> factor(x^4+4) > > 22 >(2) (x - 2x + 2)(x + 2x + 2) > Type: Factored(Polynomial(Integer)) > > The factorization of "x^4+r" depends on r, or else it will > introduce extra algebraic kernels. > > In rational function integration, sum logs over roots of > "x^4+r=0" is pretty common, but "lg2func" doesn't deal > with this case. So I manually facor "x^4+r" into quadratics. > > This patch improves 1190a 1191a 1207a 1217a 1218a 1228a > of mapleok.input, making 1191a 1207a 1217a continuous. > > I have to use "rootSimp" in the patch, I'm not sure if this > will causes trouble elsewhere. That is move in wrong direction. In purely symbolic setting extra algebraic kernels cause trouble. Especially when there is no check if equivalent kernel is already present. As I wrote in other mail I would like to generate 'rootSum' instead of expanding roots. In principle after such change definite integrator would work with 'rootSum' directly skiping Rioboo, tantrick, etc. Of course definite integrator will have to do some work to avoid branch problems, but using 'rootSum' will automatically avoid some problems and for other definite integrator have more information to resolve them properly than indefinite integrator. I understand that some people would like to see results with extra roots. So it would make sense to add this as an optional behaviour. But as _default_ in FriCAS this would cause more problems than it would resolve. Namely, nontrivial parts of branch problems are due to dependent roots. I fixed several of them by avoiding introducing new roots. -- 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 post to this group, send email to fricas-devel@googlegroups.com. Visit this group at https://groups.google.com/group/fricas-devel. For more options, visit https://groups.google.com/d/optout.
[fricas-devel] [PATCH v1] add a special case in lg2func; fix serval integrals
Compare the result of integrate(1/(x^8-1),x) integrate(8*sqrt(2)/(x^8-1),x) integrate(a/(x^8-1),x) The first is more complex than the second one. Why? Because: (1) -> factor(x^4+1) 4 (1) x + 1 Type: Factored(Polynomial(Integer)) (2) -> factor(x^4+4) 22 (2) (x - 2x + 2)(x + 2x + 2) Type: Factored(Polynomial(Integer)) The factorization of "x^4+r" depends on r, or else it will introduce extra algebraic kernels. In rational function integration, sum logs over roots of "x^4+r=0" is pretty common, but "lg2func" doesn't deal with this case. So I manually facor "x^4+r" into quadratics. This patch improves 1190a 1191a 1207a 1217a 1218a 1228a of mapleok.input, making 1191a 1207a 1217a continuous. I have to use "rootSimp" in the patch, I'm not sure if this will causes trouble elsewhere. diff --git a/src/algebra/irexpand.spad b/src/algebra/irexpand.spad index eb90a9c9..eaffa9e4 100644 --- a/src/algebra/irexpand.spad +++ b/src/algebra/irexpand.spad @@ -84,6 +84,7 @@ zero?(delta := (b := coefficient(p, 1))^2 - 4 * (a := coefficient(p, 2)) * (p0 := coefficient(p, 0))) => [linear(monomial(1, 1) + (b / a)::UP, lg)] + delta := rootSimp delta e := (q := quadeval(lg, c := - b * (d := inv(2*a)), d, delta)).ans1 lgp := c * log(nrm := (e^2 - delta * (f := q.ans2)^2)) s:= (sqr := insqrt delta).sqrt @@ -152,8 +153,18 @@ -- one? d => [linear(p, lg.logand)] (d = 1) => [linear(p, lg.logand)] d = 2 => quadratic(p, lg.logand, x) - odd? d and -((r := retractIfCan(reductum p)@Union(F, "failed")) case F) => + r := retractIfCan(reductum p)@Union(F, "failed") + d = 4 and r case F => + -- In this "p := ?^4 + r" case, we manually factor p into + -- "?^2 + sqrt(r) - ?*sqrt(2*sqrt(r))" and + -- "?^2 + sqrt(r) + ?*sqrt(2*sqrt(r))". + upx := monomial(1,1)$UP + t : F := rootSimp sqrt(2 * rootSimp sqrt r) + -- quadratic will always return 1 result (instead of 2), + -- because the sign of delta is fixed. + [firstquadratic(upx^2 + sqrt(r)::UP - upx*t, lg.logand, x) ++ first quadratic(upx^2 + sqrt(r)::UP + upx*t, lg.logand, x)] + odd? d and r case F => pairsum([cmplex(alpha := rootSimp zeroOf p, lg.logand)], lg2func([lg.scalar, (p exquo (monomial(1, 1)$UP - alpha::UP))::UP, -- 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 post to this group, send email to fricas-devel@googlegroups.com. Visit this group at https://groups.google.com/group/fricas-devel. For more options, visit https://groups.google.com/d/optout.