Ask Your Question
1

arctan(tan(pi/2)) =pi/2 ?

asked 2011-02-11 07:16:51 -0500

Shu gravatar image

updated 2011-02-14 14:05:25 -0500

kcrisman gravatar image

Sage evaluates tan(pi/2) to unsigned infinity which is true, but I want the above expression to work. Any way?

When I apply arctan(tan(pi/2)) it gives error. Shouldn't it return pi/2.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
3

answered 2011-02-11 07:34:42 -0500

benjaminfjones gravatar image

This is a basic calculus question, really. It would not make sense for arctan(tan(pi/2)) to return pi/2 because tan(pi/2) is not defined. Sage returns Infinity because the limit of tan(x) as x -> pi/2 from the left is +Infinity and from the right is -Infinity. However, the limit of arctan(y) as y -> +Infinity is pi/2 but as y -> -Infinity is -pi/2. So you have to ask Sage for a limit:

sage: x = var('x')
sage: assume(x > 0 and x < pi/2)
sage: f = arctan(tan(x))
sage: f.limit(x=pi/2, dir='left')
1/2*pi

sage: forget()
sage: assume( pi/2 < x and x < pi )
sage: f.limit(x=pi/2, dir='right')
-1/2*pi

See the documentation for limit for more info and a lot of good examples.

edit flag offensive delete link more
2

answered 2011-02-11 07:40:44 -0500

niles gravatar image

It could equally well return -pi/2:

sage: arctan(+Infinity)
1/2*pi
sage: arctan(-Infinity)
-1/2*pi

The limit as x -> pi/2 is undefined, because the limits from above and below are not equal:

sage: limit(arctan(tan(x)),x=pi/2)
und
sage: limit(arctan(tan(x)),x=pi/2,dir='+')
-1/2*pi
sage: limit(arctan(tan(x)),x=pi/2,dir='-')
1/2*pi
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

Stats

Asked: 2011-02-11 07:16:51 -0500

Seen: 3,978 times

Last updated: Feb 14 '11