Murray Eisenberg and Rohit Namjoshi, Thanks a lot for all of your comments.
Hi Ehud,
Do you mean something like this?
DynamicModule[{p = {0.5, 0.5}}, {Graphics[Locator[Dynamic[p]], PlotRange -> 2], Dynamic[Complex[Sequence @@ p]]}]
BTW, was my answer to your earlier question helpful?
That's nice!
It seems to me there ought to be a built-in function, say ToComplex, that does what Complex[Sequence @@ #]& does. This would be an inverse to the built-in function ReIm.
This just seems such a basic thing to have. Something that even beginners could make sense of, as opposed to Sequence @@ p, that is, Apply[Sequence, p], which involve two non-elementary programming constructs, Apply and Sequence.
I looked up the net and the documentation and couldn't find a built in function to this type of conversion. I would be glad to get to know a simple way for doing it.
Hi Murray,
I was being dumb, easier way
Complex @@ {0.5, 0.5} (* 0.5 + 0.5 I *) toComplex = Complex @@ # & toComplex[{0.5, 0.5}] toComplex@{0.5, 0.5}
Perhaps better to overload like this:
toComplex[xy_] := Complex @@ xy toComplex[x_, y_] := Complex[x, y]
Then one can do, for example, both the following...
toComplex[{3, 4}] toComplex[3, 4]
... and get the same result.
Ehud, Alas, the Mathematica developers, including Stephen Wolfram, have never really come to grips with complex numbers as basic objects to use in Graphics — even though Complex is not only a built-in type and even though by default many functions assume their arguments are complex rather than real.