Ask Your Question

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

asked 2011-02-11 14:16:51 +0200

Shu gravatar image

updated 2011-02-14 21:05:25 +0200

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

answered 2011-02-11 14:34:42 +0200

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')

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

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

edit flag offensive delete link more

answered 2011-02-11 14:40:44 +0200

niles gravatar image

It could equally well return -pi/2:

sage: arctan(+Infinity)
sage: arctan(-Infinity)

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)
sage: limit(arctan(tan(x)),x=pi/2,dir='+')
sage: limit(arctan(tan(x)),x=pi/2,dir='-')
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: 2011-02-11 14:16:51 +0200

Seen: 5,707 times

Last updated: Feb 14 '11