[BUG] bug in "pairsum" causes wrong integration result

12 views
Skip to first unread message

oldk1331

unread,
Jul 8, 2019, 9:26:33 AM7/8/19
to fricas...@googlegroups.com
Some faulty integration:

integrate(a^(1/4)/(x^8-1),x)
-- following examples are from mapleok.input
in1867a:=integrate(1/(z^2-1)*(1-(I*z)^(1/2))^(1/2), z)
in1869a:=integrate(1/(z^2-1)*(1-1/(I*z)^(1/2))^(1/2), z)
in1870a:=integrate(1/(z^2-1)/(1+(I*z)^(1/2))^(1/2), z)

They are returning 0, which is obviously incorrect.

Also
in1724a:=integrate(-z^2/(z^2-1)*(1-(I*z)^(1/2))^(1/2), z)
is wrong, although its return value is not 0.


The problem happens in "pairsum" in irexpand.spad.

This "pairsum" function tries to avoid cases like both
x^(1/n) and (-x)^(1/n) (where n is even) appears in result.

Take "integrate(a^(1/4)/(x^8-1),x)" for example, in order to
solve "?^4+a/4096" appeared in
    "split internalIntegrate(a^(1/4)/(x^8-1),x)",
"lg2func" uses "zeroOf" to introduce (-a)^(1/4) which causes
"pairsum" to return empty result.

I suggest:

1. Add a warning/error in "pairsum" when it tries to return empty.
2. We can handle cases like "?^4+a" "?^4+a*?^2+b" in "lg2func" better.

Waldek Hebisch

unread,
Jul 14, 2019, 9:26:29 AM7/14/19
to fricas...@googlegroups.com
First, 'zeroOf' should be used only when we know that polynomial
is irreducible. Unfortunatly, current "lg2func" has too little
information to do this correctly. AFIACS instead of current
"lg2func" and friends we should use a variant of 'normalize'.
And we need to extend 'normalize' so that it looks at algebraic
dependencies. Anything less is just a temporary stopgap.

Real bug above is that we can not expand terms separately.
Concerning "pairsum": it should go away. I with attached
patch I get:

(1) -> integrate(a^(1/4)/(x^8-1),x)

(1)
4+-+
--+ x\|a - 8 %E
> %E log(------------)
--+ 4+-+
4 \|a
4096 %E - a = 0
+
4+-+
--+ x\|a - 8 %F
> %F log(------------)
--+ 4+-+
4 \|a
4096 %F + a = 0
Type: Union(Expression(Integer),...)

Unfortunatly, this causes troubles for definite integrator.
Basically, we need to teach 'limit' how to handle 'rootSum'.

--
Waldek Hebisch
IR2F.diff

oldk1331

unread,
Jul 19, 2019, 6:16:12 AM7/19/19
to fricas...@googlegroups.com


On 7/14/19 9:26 PM, Waldek Hebisch wrote:
> Real bug above is that we can not expand terms separately.
> Concerning "pairsum": it should go away.  I with attached
> patch I get:
>
> (1) -> integrate(a^(1/4)/(x^8-1),x)
>
>    (1)
>                                4+-+
>            --+                x\|a  - 8 %E
>            >           %E log(------------)
>            --+                    4+-+
>             4                     \|a
>      4096 %E  - a = 0
>    +
>                                4+-+
>            --+                x\|a  - 8 %F
>            >           %F log(------------)
>            --+                    4+-+
>             4                     \|a
>      4096 %F  + a = 0
>                                          Type: Union(Expression(Integer),...)
>
> Unfortunatly, this causes troubles for definite integrator.
> Basically, we need to teach 'limit' how to handle 'rootSum'.
>

Shouldn't we try to simplify 'rootSum' with coefficients like
"%E^4 +- a = 0"?

Waldek Hebisch

unread,
Jul 19, 2019, 7:45:49 AM7/19/19
to fricas...@googlegroups.com
We should try to simplify when we can. My point is:

- 'rootSum' gives valid result when we can not simplify
- compared to 'rootSum' some transformations that we
currently do produce more complicated result, so
we should drop them
- once we have 'zeroOf' correct simplification is harder
than with 'rootSum'
- several simplifications depends on factorization. That
requires global point of view, that is we need to look
at all kernels.

Currently implementation does not look at interactions between
kernels and that is core of the problem.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages