Ask Your Question

Difficult integral?

asked 2012-03-09 10:01:34 +0100

Alejandro gravatar image

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.



edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted

answered 2012-03-09 12:41:33 +0100

achrzesz gravatar image

updated 2012-03-09 14:21:22 +0100

kcrisman gravatar image

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

edit flag offensive delete link more


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

Alejandro gravatar imageAlejandro ( 2012-03-09 14:08:49 +0100 )edit

See 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".

kcrisman gravatar imagekcrisman ( 2012-03-09 14:39:39 +0100 )edit

Also, 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.

kcrisman gravatar imagekcrisman ( 2012-03-09 14:41:28 +0100 )edit

answered 2012-03-09 11:38:37 +0100

achrzesz gravatar image

updated 2012-03-09 14:22:04 +0100

kcrisman gravatar image

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)
edit flag offensive delete link 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.

Alejandro gravatar imageAlejandro ( 2012-03-09 12:02:24 +0100 )edit

answered 2012-03-09 10:24:09 +0100

kcrisman gravatar image

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?

Is  3*c+1  zero or nonzero?

Is  c  zero or 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

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

edit flag offensive delete link more


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

Alejandro gravatar imageAlejandro ( 2012-03-09 11:53:52 +0100 )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.

kcrisman gravatar imagekcrisman ( 2012-03-09 14:33:18 +0100 )edit

answered 2012-03-09 12:08:44 +0100

Alejandro gravatar image

Thanks for your answers!

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.


edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-03-09 10:01:34 +0100

Seen: 902 times

Last updated: Mar 09 '12