| 1 | initial version |
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.
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.