0
$\begingroup$

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$
7
  • 1
    $\begingroup$ Yes, it was the inexact numbers that did it. Use Chop[]. $\endgroup$ Commented Jul 5, 2015 at 17:47
  • $\begingroup$ That is a new one for me. $\endgroup$ Commented Jul 5, 2015 at 17:52
  • $\begingroup$ And it works too. Thank you very much. $\endgroup$ Commented Jul 5, 2015 at 17:54
  • $\begingroup$ Related: (13679), (24783), (57377) (and many more...) $\endgroup$
    – Mr.Wizard
    Commented Jul 5, 2015 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
    Commented Jul 5, 2015 at 17:57

0

Browse other questions tagged or ask your own question.