       Re: problem to define a complex variable

• To: mathgroup at smc.vnet.net
• Subject: [mg116676] Re: problem to define a complex variable
• From: Daniel Lichtblau <danl at wolfram.com>
• Date: Wed, 23 Feb 2011 05:26:44 -0500 (EST)

```tarun dutta wrote:
> i want to use complex variable such as
> c[i_]=re[i]+I*im[i]
> then I get
> conj[c[i]] =re[i]-I*im[i]
> by stating
> conj[a_]:=complexexpand[conjugate[a]];
> but now i am writing
> c[i_][t_]=re[i][t]+I*im[i][t]
> but i am not getting
> conj[c[i][t]]=re[i][t]-I*im[i][t]
> by stating
> conj[a_]:=ComplexExpand[Conjugate[a[i][t]]]
>
> is there any way of writing this thing?
> any help will be very much appreciated.
> regards,
> tarun

The result below looks about right to me.

In:= c[i_][t_] := re[i][t] + I*im[i][t]
conj[a_] := ComplexExpand[Conjugate[a]]

In:= conj[c[i][t]]
Out= -I im[i][t] + re[i][t]

This was in version 8. A bug in earlier versions caused the various
entities to be regarded as "complex valued". So you would see something
like below. By the way, it would save people like myself a lot of time
if you actually show your input and output, so nobody has to guess at
the nature of teh problem.

Out= -Im[im[i][t]] + I (-Im[re[i][t]] - Re[im[i][t]]) + Re[re[i][t]]

To work around this I'd suggest postprocessing with Simplify, giving
assumptions that re[i][t] and im[i][t] are both real valued.

Daniel Lichtblau
Wolfram Research

```

• Prev by Date: how packages work
• Next by Date: Re: Scientific Number Format on Frame
• Previous by thread: problem to define a complex variable
• Next by thread: How to deal with big matrix?