# Integrate() does not integrate

Good Evening

var('phi r')
phi1 = 0
phi2 = 2*pi
r1 = 3
r2 = 5
fpolar = - sqrt(-2*r^2*cos(phi)^2+25)
BI = fpolar
BI= integral(BI, (phi,phi1,phi2))
BI= integral(BI, (r,r1,r2))
BI


the result is:

-integrate(integrate(sqrt(-2*r^2*cos(phi)^2 + 25), phi, 0, 2*pi), r, 3,
5)


I've found no way to make sage integrate the expresion. It repeats my input and iam not given any new information.

When i try

BI.n()


i get

ValueError: Integrand has wrong number of parameters


Same Problem with indefinite Integrals

in:

BI = fpolar
BI= integral(BI, phi)
BI


out:

-integrate(sqrt(-2*r^2*cos(phi)^2 + 25), phi)


Why? what do I need to do to get the desired output?

edit retag close merge delete

I want to do things symbolic. When i did it in maple yesterday, it gave me nonsense. If even \$ got Problems with such an equation, maybe it should be an feature request. Unfortuantly iam just a student of mechanical engineering, so i cant jugdge this situation. (Is it my fault or the CAS's, i suspect mine) I,however, can do it with my own sweat and tears. Thank you so far. UPDATE: Wolfram Mathematica semms to be unable to do it (at least when you go the simple way and just tell it to Integrate)

Sort by » oldest newest most voted

Maxima is the symbolic calculation software that Sage uses for integrals. It seems to be unable to evaluate this integral:

sage: maxima('integrate(sqrt(cos(x)^2+25), x)') 'integrate(sqrt(cos(x)^2+25),x)

On the other hand, now that we're talking about interfacing with Maxima directly, you could use Maxima's dblint function for this integral:

sage: maxima('r(x):= 0')
r(x):=0
sage: maxima('s(x):= 2*pi')
s(x):=2*pi
sage: maxima('g(x,y):= sqrt(x^2*cos(y)^2 + 25)')
g(x,y):=sqrt(25+x^2*cos(y)^2)
sage: BI = maxima('dblint(g, r, s, 3,5)')
sage: BI.n()
72.0389037585788


Unfortunately, I don't know how to access this directly from Sage.

more

sage: maxima_calculus.d[tab] doesn't even give this dblint command, for some reason. Could be useful to make it do that. Though as I point out, we shouldn't expect that this integral has a nice formula.

numerical calculation over simsons rule may be usefull in some cases, thanks. If you want to do this in SAGE you jus need to (i think) taylor-approximate the function and have an easy life with Integration. I will remeber that when i dont need symbolics.

sage: var('r phi')
(r, phi)
sage: integral(-sqrt(-2*r^2*cos(phi)^2+25), (phi,0,2*pi))
-integrate(sqrt(-2*r^2*cos(phi)^2 + 25), phi, 0, 2*pi)
sage: integral(-sqrt(-2*r^2*cos(phi)^2+25), phi)
-integrate(sqrt(-2*r^2*cos(phi)^2 + 25), phi)


So Sage/Maxima knows that the minus sign comes out. Given that Wolfram Alpha indicates that the answer is an elliptic integral of the second kind, it's not totally surprising that we don't get a symbolic answer here. Certain Maxima things will output elliptic integrals/functions, but not too many.

So what is your desired output? Keep in mind that many (most?) functions do not have antiderivatives expressible in terms of elementary functions.

more

I have the Solution (partly) The function was wrong, it came up because i wrecked it with a faulty transformation.

However I was able to do the first Step of integration with the "faulty" function.

IN:

var('a b')
ftrick = -sqrt(r^2*a + b)
BItrick = integral(ftrick, (r,r1,r2))


OUT:

Is  a  positive or negative?


IN:

view('AHA!')
assume(a<0)
assume(b>0)
BItrick = integral(ftrick, (r,r1,r2))
view(BItrick)
forget()
BItrick2 = BItrick.substitute(a == -2*cos(phi)^2)
BItrick2 = BItrick2.substitute(b == 25 )
view(BItrick2)


BItrick2 =

1/4*(6*sqrt(-18*cos(phi)^2 + 25)*cos(phi)^2 +
25*sqrt(2)*sqrt(cos(phi)^2)*arcsin(3/5*sqrt(2)*sqrt(cos(phi)^2)))/cos(ph\
i)^2 - 5/4*(2*sqrt(-50*cos(phi)^2 + 25)*cos(phi)^2 +
5*sqrt(2)*sqrt(cos(phi)^2)*arcsin(sqrt(2)*sqrt(cos(phi)^2)))/cos(phi)^2


When I try to go on sage says it doent know wheather cos(phi) ist positive or negative. So i divided the integral.

forget()
assume(cos(phi) >0)
erg1 = integral(BItrick2, (phi,phi1,0.5*pi))
forget()
assume(cos(phi) <0)
erg2 = integral(BItrick2, (phi,0.5*pi,1.5*pi))
forget()
assume(cos(phi) >0)
erg3 = integral(BItrick2, (phi,1.5*pi,2*pi))
erg = erg1+erg2+erg3


Sage does calculate for 2 minutes and then it gives me the input. The system is unable to integrate.

If you have problems with Integrations try using assume() and forget()

more