I write a primitive version patch implementing my ideas, it works when "g x == sqrt x" in the test, and gives far more compact result when "g x == sqrt x + x^(1/3)".
I wonder if some part of this patch should be independent functions: 1. test if a kernel is a constant/algebraic number, algNumIfCan? 2. "deep" univariate, eg. "deepunivariate(x,first kernels sqrt x)" should return "?^2". Also, what's the best way to create a non-conflicting random new kernel? ---- test f := (2560*x^3 - 400*x^2 - 576*x - 84)/(320*x^4 + 80*x^3 - 12*x^2 + 24*x + 9) g x == sqrt x -- or g x == sqrt exp x h == eval(f, x = g x)*D(g x, x) integrate(h,x) draw(%,x=0..1) ---- test ends diff --git a/src/algebra/irexpand.spad b/src/algebra/irexpand.spad index 6e43ea41..cf485bfd 100644 --- a/src/algebra/irexpand.spad +++ b/src/algebra/irexpand.spad @@ -106,6 +106,16 @@ retractIfCan(a)@Union(Q, "failed") case Q => 2 * atan(-b/a) 2 * atan(a/b) + uni2(exp : F, kers : List K) : Fraction UP == + maxk := "max"/kers + mink := "min"/kers + if (#kers ~= 2 or name maxk ~= 'nthRoot or first argument maxk ~= coerce(mink)@F) + then return univariate(exp, maxk) + newker := kernel('randomkernel) + newexp := coerce(newker)@F + n := retractIfCan(second argument maxk)@Union(Integer,"failed")::Integer + univariate(subst(exp,[maxk, mink]::List K, [newexp, newexp^n]::List F), newker) + -- transforms i log((a + i b) / (a - i b)) into a sum of real -- arc-tangents using Rioboo's algorithm -- lk is a list of kernels which are parameters for the integral @@ -113,8 +123,9 @@ l := setDifference(setUnion(variables numer a, variables numer b), setUnion(lk, setUnion(variables denom a, variables denom b))) empty? l => tantrick(a, b) + l := select((k:K):Boolean+->not(is?(k,'nthRoot) and null kernels argument k), l) k := "max"/l - ilog0(a, b, numer univariate(a, k), numer univariate(b, k), k::F) + ilog0(a, b, numer uni2(a, l), numer uni2(b, l), k::F) -- transforms i log((a + i b) / (a - i b)) into a sum of real -- arc-tangents using Rioboo's algorithm -- 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.