If you prefer the log
format, use .rewrite(log)
, like
In [4]: asin(2).rewrite(log)
Out[4]:
⎛ ___ ⎞
-ⅈ⋅log⎝╲╱ 3 ⋅ⅈ + 2⋅ⅈ⎠
Combining this with Games's answer, you can get:
In [3]: sols = solve(sin(z) - 2, z)
In [4]: sols
Out[4]: [π - asin(2), asin(2)]
In [5]: [i.rewrite(log) for i in sols]
Out[5]:
⎡ ⎛ ___ ⎞ ⎛ ___ ⎞⎤
⎣π + ⅈ⋅log⎝╲╱ 3 ⋅ⅈ + 2⋅ⅈ⎠, -ⅈ⋅log⎝╲╱ 3 ⋅ⅈ + 2⋅ⅈ⎠⎦
And by the way, there are really infinitely many solutions, because sin
is 2*pi
periodic. SymPy currently doesn't support giving all of them directly, but it's easy enough to get them by using sin(z + 2*pi*n)
instead of sin(z)
:
In [8]: n = Symbol('n', integer=True)
In [9]: sols = solve(sin(z + 2*pi*n) - 2, z)
In [10]: sols
Out[10]: [-2⋅π⋅n + asin(2), -2⋅π⋅n + π - asin(2)]
In [11]: [i.rewrite(log) for i in sols]
Out[11]:
⎡ ⎛ ___ ⎞ ⎛ ___ ⎞⎤
⎣-2⋅π⋅n - ⅈ⋅log⎝╲╱ 3 ⋅ⅈ + 2⋅ⅈ⎠, -2⋅π⋅n + π + ⅈ⋅log⎝╲╱ 3 ⋅ⅈ + 2⋅ⅈ⎠⎦
Here n
is any integer.