0
$\begingroup$

This question already has an answer here:

Consider a function that maps a complex function z->f(z) to it's multivariable counterpart (x,y)->f(x,y)

complex2multivar[z_] := ComplexExpand[Through[{Re, Im}[z]]]

Here are some results:

As expected:

complex2multivar[2 #^2 &[x + I y]]
{2 x^2 - 2 y^2, 4 x y}

As expected:

t1[z_] := 2 z^2
complex2multivar[t1[x + I y]]
{2 x^2 - 2 y^2, 4 x y}    

NOT as expected:

t2[z_] := 2. z^2
complex2multivar[t2[x + I y]]
{(0. + 0. I) + 2. x^2 - 2. y^2, (0. + 0. I) + 4. x y}

Please explain this unexpected behavior.

How can this be fixed such that I can use pure functions like

(a # + b) / (c # + d) &

where the a,b,c,d are of type

Real + Real I

for example

a = 1.4 + .7 I
$\endgroup$

marked as duplicate by J. M. will be back soon Jul 5 '15 at 18:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    $\begingroup$ Yes, it was the inexact numbers that did it. Use Chop[]. $\endgroup$ – J. M. will be back soon Jul 5 '15 at 17:47
  • $\begingroup$ That is a new one for me. $\endgroup$ – nilo de roock Jul 5 '15 at 17:52
  • $\begingroup$ And it works too. Thank you very much. $\endgroup$ – nilo de roock Jul 5 '15 at 17:54
  • $\begingroup$ Related: (13679), (24783), (57377) (and many more...) $\endgroup$ – Mr.Wizard Jul 5 '15 at 17:57
  • $\begingroup$ @Guess Can you help me find and select a good original to mark this question as a duplicate of? $\endgroup$ – Mr.Wizard Jul 5 '15 at 17:57

Browse other questions tagged or ask your own question.