Magnitude of a complex number

27 views
Skip to first unread message

Oscar Benjamin

unread,
May 19, 2015, 5:00:30 PM5/19/15
to sympy
Am I misunderstanding something here (using master):

$ isympy
Couldn't locate IPython. Having IPython installed is greatly recommended.
...
>>> z = (4+3*I)/(3-4*I)
>>> z
4 + 3⋅ⅈ
───────
3 - 4⋅ⅈ
>>> abs(z)
│ 1 │
5⋅│───────│
│3 - 4⋅ⅈ│
>>> simplify(abs(z))
│ 1 │
5⋅│───────│
│3 - 4⋅ⅈ│
>>> abs(z).evalf()
1.00000000000000
>>> abs(z) ** 2
2
│ 1 │
25⋅│───────│
│3 - 4⋅ⅈ│
>>> z * z.conjugate()
(4 - 3⋅ⅈ)⋅(4 + 3⋅ⅈ)
───────────────────
(3 - 4⋅ⅈ)⋅(3 + 4⋅ⅈ)
>>> simplify(z * z.conjugate())
1

Why doesn't abs(z) simplify (or should I open an issue)?


--
Oscar

Aaron Meurer

unread,
May 20, 2015, 4:46:27 PM5/20/15
to sy...@googlegroups.com
I guess simplify() just doesn't know about abs. You can open an issue.

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAHVvXxS6DNZR8dPJ5AZ96V7MKtZQrvug_Pjs2%3DLejVOP6e73aw%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages