I wold just take the real part of it:
In[7]:= f[x_] := 1 - x^2;
NMaximize[f[x], x]
g[x_] := 1 - x^2 + 3 I x;
NMaximize[Re[g[x]], x]
Out[8]= {1., {x -> 0.}}
Out[10]= {1., {x -> -7.08002*10^-9}}
Hi all,
Anybody knows how to remove the complex values (not real number)of the function when using NMaximize command?
e.g. I have a function F(x), F(x) may be a complex number for some x. so how to remove these values in order to use the command NMaximize[F(x),x]?
Thanks a lot,
Cheers,
xdu