Difficult integral?

Hello all,

I'm trying to get the integral with respect to x of the following expression:

(a / x + b(y) * x ^ c) ^ d,

where a,c,d are positive constants, and b is a function of some variable y.

I'm not sure what I'm doing wrong. Can you help me?

I got a solution in Mathematica (some hypergeometric function), but Mathematica is a software that I'm trying not to use anymore.

Best,

Alejandro

edit retag close merge delete

Sort by » oldest newest most voted

You can make the substitution after integration:

sage: var('a b c d y')

sage: ii=integrate((a/x+b*x^c)^d,x,algorithm='mathematica_free')

sage: b=function('b',y)

sage: ii(b=b(y))

-(x^c*b(y) + a/x)^d*x*hypergeometric2f1(-(d - 1)/(c + 1), -d, -(d - 1)/(c + 1) + 1,
-x^(c + 1)*b(y)/a)/((d - 1)*(x^(c + 1)*b(y)/a + 1)^d)


but I don't think that sage understands hypergeometric2f1

more

Exactly, Sage doesn't recognize it. So, i'm completely stuck :S

( 2012-03-09 14:08:49 +0200 )edit

See http://trac.sagemath.org/sage_trac/ticket/2516. We would *really* welcome any assistance with that; as with many things in Sage, the infrastructure has been there for a long time, the hard part is "wrapping" it so that it plays well with the rest of Sage - and even here, the hard part means "the tedious part".

( 2012-03-09 14:39:39 +0200 )edit

Also, http://ask.sagemath.org/question/1168/how-can-one-use-maxima-kummer-confluent-functions has several ideas which you might find helpful. In particular, you should be able to use the templates referred to from (for instance) the beta function to create a "custom" HG function for your own use; mpmath will certainly evaluate it as well as needed, though it sounds like that is not your use case.

( 2012-03-09 14:41:28 +0200 )edit

This result is similar to that from W-alpha:

sage: integrate((a/x+b*x^c)^d,x,algorithm='mathematica_free')

-(x^c*b + a/x)^d*x*hypergeometric2f1(-(d - 1)/(c + 1), -d, -(d - 1)/(c + 1) + 1,

-b*x^(c + 1)/a)/((d - 1)*(b*x^(c + 1)/a + 1)^d)

more

Oh, I see, i didn't know the mathematica_free algorithm. If i understand correctly, Sage is taking the result from the online integrator, isn't it? The next question is if i can work further with that result. For example, evaluate it, etc.

( 2012-03-09 12:02:24 +0200 )edit

Probably Maxima just doesn't know this integral. They do get some hypergeometric functions as a result of certain integrals, but it is not as strong in HG functions as Mma. I do get some results if I assume c>1, like

sage: integrate((a/x+x^c)^3,x)
3*a^2*x^(c - 1)/(c - 1) - 1/2*a^3/x^2 + 3/2*a*x^(2*c)/c + x^(3*c + 1)/(3*c + 1)


but Maxima asks redundant and other questions on this a bunch.

(%i8) display2d:false;

(%o8) false
(%i9) integrate((a/x+b*x^c)^3,x);

Is  c-1  zero or nonzero?

nonzero;
Is  3*c+1  zero or nonzero?

nonzero;
Is  c  zero or nonzero?

nonzero;
(%o9) b^3*x^(3*c+1)/(3*c+1)+3*a*b^2*x^(2*c)/(2*c)+3*a^2*b*x^(c-1)/(c-1)-a^3
/(2
*x^2)


And once you replace the exponent with a d or some noninteger exponent, it doesn't seem to know what to do.

more

In that case, i should stick to Mathematica, I guess...

( 2012-03-09 11:53:52 +0200 )edit

Perhaps. This is really one of the only areas where Sage is at a significant disadvantage vis-a-vis the competitors in terms of functionality. Since HG functions are so ubiquitous, I'm surprised Maxima can't handle this one, but there you have it. I've asked on the Maxima list, because it *can* do them for specific positive integers d (even largish ones), but not a general such d.

( 2012-03-09 14:33:18 +0200 )edit

I tried to use the mathematica_free algorithm. There is an additional problem: the constant b is indeed a function some variable y. It is of course a constant, but it is undetermined when integrating the function.

So, Sage returns:

NotImplementedError: Mathematica online integrator can only handle single letter variables.

Alejandro

more