tan(pi/2) unevaluated?

2 views
Skip to first unread message

Gary

unread,
Nov 7, 2008, 11:52:55 PM11/7/08
to sage-support
Hello all :-)

I'm new to sage and to this group.

I teach at a two-year college and have been exploring the
possibilities of incorporating sage into some of my classes. On my
laptop I also have Mathematica and Matlab installed and have used
Maple in the past as well.

I started experimenting with sage because it would provide a free
(yay!) alternative to the programs mentioned above; this is a big plus
for my students already burdened with the high cost of their
textbooks. With the small amount of exposure to sage I've had so far,
I can say that I find it useful and powerful. It is also, to me,
confusing at time but to be fair so too are Mathematica and Maple.

Now to the problem at hand.

I've been trying to evaluate a symbolic double integral but am
perplexed by the unevaluated tan(pi/2) expressions in the result since
tan(pi/2) is undefined. What am I missing here and what do I need to
do to get this to evaluate to the correct value of
(4*pi - 3*sqrt(3))*a^2/6?

Thanks much,
Gary

sage input:
***************************************************************
var('a r theta')
assume(a > 0)
integral(integral(r, r, a*csc(theta), 2*a), theta, pi/6, pi/2)
***************************************************************

sage output:
*********************************************************************
(2*pi*tan(pi/2) + 1)*a^2/(2*tan(pi/2)) - (2*pi + 3*sqrt(3))*a^2/6
*********************************************************************


William Stein

unread,
Nov 8, 2008, 6:52:28 PM11/8/08
to sage-s...@googlegroups.com, Robert Dodier

Maxima actually does all the symbolic integration
in Sage, currently, so I've forwarded your email
to Robert Dodier -- lead developer of Maxima.

William

>
>
> >
>

--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

Robert Dodier

unread,
Nov 8, 2008, 8:12:12 PM11/8/08
to sage-support, max...@math.utexas.edu
Gary wrote:

> I've been trying to evaluate a symbolic double integral but am
> perplexed by the unevaluated tan(pi/2) expressions in the result since
> tan(pi/2) is undefined. What am I missing here and what do I need to
> do to get this to evaluate to the correct value of
> (4*pi - 3*sqrt(3))*a^2/6?

> sage input:
> ***************************************************************
> var('a r theta')
> assume(a > 0)
> integral(integral(r, r, a*csc(theta), 2*a), theta, pi/6, pi/2)
> ***************************************************************
>
> sage output:
> *********************************************************************
> (2*pi*tan(pi/2) + 1)*a^2/(2*tan(pi/2)) - (2*pi + 3*sqrt(3))*a^2/6
> *********************************************************************

Sage punts to Maxima to do symbolic integrals.
In this case, Maxima computed an antiderivative and plugged
in the limits of integration. You can coax Maxima into doing
the right thing by computing a limit:

assume (a > 0, bb > 0, bb > %pi/6);
integrate (integrate (r, r, a*csc(theta), 2*a), theta, %pi/6, bb);
=> (4*a^2*bb*tan(bb)+a^2)/(2*tan(bb))-(2*%pi+3*sqrt(3))*a^2/6
limit (%, bb, %pi/2, minus);
=> (4*%pi-3*sqrt(3))*a^2/6

I guess Maxima could apply the limit automatically -- that
shouldn't change the result for most integrals, but gets the
correct result in cases like this. Opinions from the Maxima
crowd are welcome.

best

Robert Dodier
Reply all
Reply to author
Forward
0 new messages