Re: [fricas-devel] [BUG] bug in "pairsum" causes wrong integration result

2019-07-19 Thread Waldek Hebisch
oldk1331 wrote:
> 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"?

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

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/E1hoRKa-0005C3-JQ%40hera.math.uni.wroc.pl.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] [BUG] bug in "pairsum" causes wrong integration result

2019-07-19 Thread oldk1331
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"?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/CAGBJN90BM0-ucsS-NAhPNSZEzNRHycfTK5MLyqsmbiiknrO97Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [fricas-devel] [BUG] bug in "pairsum" causes wrong integration result

2019-07-14 Thread Waldek Hebisch
oldk1331 wrote:
> 
> 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.

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

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/E1hmeWE-0003fj-LL%40hera.math.uni.wroc.pl.
For more options, visit https://groups.google.com/d/optout.
--- ../ax-build128/src/algebra/IR2F.spad2019-06-16 14:23:33.853365732 
+
+++ IR2F.spad   2019-07-14 14:20:49.497966525 +
@@ -151,16 +151,12 @@
   zero?(d := degree(p := lg.coeff)) => error "poly has degree 0"
   (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) =>
-pairsum([cmplex(alpha := rootSimp zeroOf p, lg.logand)],
-lg2func([lg.scalar,
- (p exquo (monomial(1, 1)$UP - alpha::UP))::UP,
-  lg.logand], x))
   [lg2cfunc lg]
 
 lg2cfunc lg ==
-  +/[cmplex(alpha, lg.logand) for alpha in zerosOf(lg.coeff)]
+s := new()$Symbol
+ss := s::F
+rootSum(ss*log((lg.logand)(ss)), lg.coeff, s)
 
 mkRealFunc(l, x) ==
   ans := empty()$List(F)


[fricas-devel] [BUG] bug in "pairsum" causes wrong integration result

2019-07-08 Thread oldk1331
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.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/CAGBJN93UMzAehRuyyMFbp8afRXf%3DBsbKpKF2Jbnkrd7kb9r86Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.