rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

ldefint() integration seems to be not correct #1260

Open rtoy opened 3 months ago

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-04 07:50:47 Created by aleckalinin on 2010-05-25 13:55:38 Original: https://sourceforge.net/p/maxima/bugs/1997


The ldefint() integration seems to be not correct. I compared Maxima results with Maple results. I tried to integrate "Lambda^4 / (Lambda^2 + a1 * epsilon * Lambda + epsilon^2)^(5/2);" function and I got three strange results in Maxima: 1. Too many terms in sum after integration. 2. Some terms have strange "false" factor in numerator. 3. Several terms have the singularity 1/epsilon, epsilon -> 0.

The Maple integration produces less terms and no 1/epsilon singularity. Please, see attachments for details. I put the Maxima "false" strange term and singular term in double bar.

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-04 07:50:48 Created by aleckalinin on 2010-05-25 13:55:39 Original: https://sourceforge.net/p/maxima/bugs/1997/#8520


maxima-script

Attachments:

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-04 07:50:51 Created by aleckalinin on 2010-05-25 13:56:32 Original: https://sourceforge.net/p/maxima/bugs/1997/#3133


maxima-results

Attachments:

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-04 07:50:55 Created by aleckalinin on 2010-05-25 13:56:56 Original: https://sourceforge.net/p/maxima/bugs/1997/#ca6e


maple-script

Attachments:

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-04 07:50:58 Created by aleckalinin on 2010-05-25 13:57:23 Original: https://sourceforge.net/p/maxima/bugs/1997/#8df5


maple-results

Attachments:

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-04 07:51:02 Created by *anonymous on 2010-05-25 20:34:20 Original: https://sourceforge.net/p/maxima/bugs/1997/#cf9b


Hi, Thanks for the report. A few comments:

1. Rather than using expand, try ratsimp. This produces a relatively compact expression.

2. I can confirm there is a bug in Maxima's integral with v5.21.1: false appears as a term. When a1=0, this term disappears.

3. If you look at your integrand, when epsilon=0 (a1 is irrelevant), you are computing the integral of 1/x from 0 to QL, which diverges. From that, one expects that the integral will have a singularity at epsilon=0. If Maple doesn't produce such a result, this is a bug in Maple.

Please report your version of Maxima when filing a bug report. Just copy the output of the 'build_info' command into your report.

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-04 07:51:05 Created by aleckalinin on 2010-05-26 08:22:02 Original: https://sourceforge.net/p/maxima/bugs/1997/#daa0


Thanks for comments.

Version of maxima: Maxima version: 5.21.0 Maxima build date: 8:38 4/12/2010 Host type: i686-pc-mingw32 Lisp implementation type: GNU Common Lisp (GCL) Lisp implementation version: GCL 2.6.8

About the divergence. It should be log(epsilon) but not 1/epsilon. And after integration I manually separate this log(epsilon) term.

Without a1 coefficient Maxima works correct, see maxima-results2.pdf and maxima-script2.mac in attachment. In this case both Maxima and Maple produces the same results. But when the a1 term is present, Maxima produces 1/epsilon divergence. I think this is not right, because a1 term cannot change the behavior of the integral.

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-04 07:51:09 Created by aleckalinin on 2010-05-26 08:22:52 Original: https://sourceforge.net/p/maxima/bugs/1997/#d306


maxima-results2

Attachments:

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-04 07:51:12 Created by aleckalinin on 2010-05-26 08:23:22 Original: https://sourceforge.net/p/maxima/bugs/1997/#dabd


maxima-script2

Attachments:

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-04 07:51:16 Created by aleckalinin on 2010-05-26 10:42:50 Original: https://sourceforge.net/p/maxima/bugs/1997/#d72d


Some additional information. I tried to use integrate(...) instead of ldefint(...) and got the incorrect results. The coefficient a1 change the behavior of the integral:

--- Maxima script --- logexpand : all; logarc : true;

assume(epsilon > 0); assume(a1 > 0); assume(a1 - 2.0 > 0);

kern1 : Lambda^4 / (Lambda^2 + epsilon * Lambda + epsilon^2 )^(5/2); kern2 : Lambda^4 / (Lambda^2 + a1 * epsilon * Lambda + epsilon^2)^(5/2);

phi1 : integrate(kern1, Lambda);

phi2 : integrate(kern2, Lambda); phi2 : subst(a1 = 1, phi2);

res : phi2 - phi1; ---

The res is not zero!

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-04 07:51:19 Created by crategus on 2010-07-10 14:08:51 Original: https://sourceforge.net/p/maxima/bugs/1997/#5a85


It is easier to see the problem of this bug report, when we reduce the problem to the following integrand:

x^4 * (a*x^2 + b*x + c)^(-5/2)

When we assume a>0, b>0, c>0 and b^2-4*a*c>0 and try to get the integral

integrate(x^4*(a*x^2+b*x+x)^(-5/2), x)

we get a wrong answer which includes a term 9*false. We can further simplify the example and set a=1. Then we have the integrand

x^4 * (x^2 + b*x +c)^(-5/2)

When we assume again b>0, c>0, and b^2-4*c>0 then we get a wrong answer too

(%i1) assume(b>0,c>0,b^2-4*c>0)$

(%i2) integrate(x^4*(x^2+b*x+c)^(-5/2),x); (%o2) -7*false+log(2*sqrt(x^2+b*x+c)+2*x+b) +x*(-32*b*c*x/(3*(4*c-b^2)^2*sqrt(x^2+b*x+c)) +2*b*(4*c+b^2)*x/(3*(4*c-b^2)^2*sqrt(x^2+b*x+c)) -16*b^2*c/(3*(4*c-b^2)^2*sqrt(x^2+b*x+c)) +b^2*(4*c+b^2)/(3*(4*c-b^2)^2*sqrt(x^2+b*x+c)) -x^2/(x^2+b*x+c)^(3/2)-2*b*c*x/((4*c-b^2)*(x^2+b*x+c)^(3/2)) +b^3*x/(3*(4*c-b^2)*(x^2+b*x+c)^(3/2)) -b^2*c/(3*(4*c-b^2)*(x^2+b*x+c)^(3/2)) -2*c/(3*(x^2+b*x+c)^(3/2))) -4*c*x/(3*(4*c-b^2)*sqrt(x^2+b*x+c)) +2*b^2*x/((4*c-b^2)*sqrt(x^2+b*x+c)) +10*b*c/(3*(4*c-b^2)*sqrt(x^2+b*x+c))

For this case we get an answer with a term 7*false.

The problem occurs in the routine INTIRA in the file irinte.lisp. This routine detects correctly a integration problem of the type

(1) d*p(x)*x^m*(a*x^2+b*x+x)^n

I have not analyzed the integration process in detail, but the algorithm produces a list of sub-problems which are passed again to the routine INTIRA. For our example from above, the algorithm founds 7 sub-problems. Furthermore, the algorithm assumes that all sub-problems are again of the type (1) and have a solution. But the routine INTIRA does not return a solution, the answer for this sub-problems is false. These false terms are added up.

I think the problem is, that the expression which are passed again to the routine INTIRA are of the type (1), but the routine INTIRA does not recognize it. The following expression is one of the seven sub-problems INTIRA has to solve:

b^3*x/(12*c*(x^2+b*x+c)^(3/2)-3*b^2*(x^2+b*x+c)^(3/2))

It is difficult to see in linear display, but this expression is of the type INTIRA can solve, but INTIRA does not match it, because the root

(x^2+b*x+c)^(3/2)

is distributed over two terms. To see that INTIRA in principle can solve the problem we can rewrite the expression from above the following way

b^3*(12*c-3*b^2)^-1 * x * (x^2+b*x+c)^(-3/2)

The problem is that the root is distributed over the constant term

(12*c-3*b^2)^-1

It might be difficult to solve this problem in general, but at least, the algorithm should recognize that a sub-problem was not solved. A correct answer would be a noun form for the integral for this case.

Dieter Kaiser