'simplify arctan(x) + arctan(1/x) in sage

In Sagemath, at some point I end up with the following expression (with b > 0): enter image description here

Which would be easy to simplify using the arctan(x) + arctan(1/x) = pi / 2 equality.

My problem is: how do I simplify using that inequality? I tried simplify_trig() and simplify_full() but none of them worked.

Should I use something like assume( arctan(1/sqrt(b-1)) + arctan(sqrt(b-1))) == pi / 2) ? That looks like a ugly hack



Solution 1:[1]

Try this:

sage: expr.subs({arctan(1/sqrt(b - 1)): pi/2 - arctan(sqrt(b - 1))})

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Samuel Lelièvre