Re: minimize with complex numbers

• To: mathgroup at smc.vnet.net
• Subject: [mg91255] Re: minimize with complex numbers
• From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
• Date: Tue, 12 Aug 2008 04:45:19 -0400 (EDT)
• Organization: The Open University, Milton Keynes, UK
• References: <g7p32p\$b07\$1@smc.vnet.net>

```shama shahbaz wrote:

> when i use minimize command with real numbers i get the required answer but
>  with complex number it doesnt give me any answer or error
>
> Syntax::sntxb : Expression cannot begin with "(1+1 i) ` x[1]+(1-1 i) ` x[2]".
> Syntax::tsntxi : "(1+1 i) ` x[1]" is incomplete; more input is needed.
> Syntax::sntxi : Incomplete expression; more input is needed.
>
>
> My minimize expression is
>
> ((1+1i)*x[1] +(1-1i)*x[2] )^2 +(x[1]+x[2])^2
>
> in methamatica it becomes
>
> Minimize[{( x[1]+x[2])2
> +((1+1i)x[1]+(1-1 i)x[2])2},{x[1],x[2]}]
>
>
> i want my answer to be in complex number come somebody tell me where i am wrong

Minimize requires that all functions present in the input be
real-valued. (It does not work with complex coefficient either.)

Note that the code you posted does not contain the imaginary unit, which
is denoted in Mathematica by I (capital i). You must have some other
error(s) since, having used the correct symbol for the imaginary unit, I
did not get the same message as yours.

In[1]:= expr = ((1 + 1 i)*x[1] + (1 - 1 i)*x[2])^2 + (x[1] + x[2])^2
Minimize[expr, {x[1], x[2]}]

Out[1]= (x[1] + x[2])^2 + ((1 + i) x[1] + (1 - i) x[2])^2

Out[2]= {0, {x[1] -> Piecewise[{{-1, i == 0}}],
x[2] -> Piecewise[{{0, i > 0 || i < 0}}, 1]}}

In[3]:= expr = ((1 + 1 I)*x[1] + (1 - 1 I)*x[2])^2 + (x[1] + x[2])^2
Minimize[expr, {x[1], x[2]}]

Out[3]= (x[1] + x[2])^2 + ((1 + I) x[1] + (1 - I) x[2])^2

During evaluation of In[3]:= Minimize::objc: The objective function \
(x[1]+x[2])^2+((1+I) x[1]+(1-I) x[2])^2 contains a nonreal constant \
1+I. >>

Out[4]= Minimize[(x[1] +
x[2])^2 + ((1 + I) x[1] + (1 - I) x[2])^2, {x[1], x[2]}]

Regards,
-- Jean-Marc

```

• Prev by Date: mixed partial derivatives
• Next by Date: Importing Mathematica objects
• Previous by thread: minimize with complex numbers
• Next by thread: Re: minimize with complex numbers