by hpcjoe · 2y ago · 0 comments
joe@zap:~ $ julia
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.10.5 (2024-08-27)
_/ |\__'_|_|_|\__'_| |
|__/ |
julia> z=1+2*im
1 + 2im
julia> z*conj(z)
5 + 0im
julia> sqrt(z*conj(z))
2.23606797749979 + 0.0im
julia> abs(z)
2.23606797749979 >>> (1+1j)**(1+1j)
(0.2739572538301211+0.5837007587586147j)
Ironically, the `math` library doesn't handle that: >>> math.pow(1+1j, 1+1j)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: must be real number, not complex julia> (1+im)^(1+im)
0.2739572538301211 + 0.5837007587586147im