       Re: How to separate imaginary unit inside an arbitrary function?

• To: mathgroup at smc.vnet.net
• Subject: [mg32467] Re: How to separate imaginary unit inside an arbitrary function?
• From: bghiggins at ucdavis.edu (Brian Higgins)
• Date: Tue, 22 Jan 2002 03:19:42 -0500 (EST)
• References: <a2gi3d\$ks\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Kostya,

I assume that "I" in your expression is Sqrt[-1].  So lets start with

In:=data = f[5 I a]

Out=f[5 I a]

Then if you look at the FullForm of your  expression we see how it is
stored

In:=FullForm[data]

Out//FullForm=f[Times[Complex[0, 5], a]]

Based on the FullForm expression we can define a replacement rule as
follows

In:=
data /. f[x_Complex z_] -> Apply[Times, {f[Im[x]], f[I], f[z]}]

Out=f[I] f f[a]

Cheers,

Brian

"Kostya" <zlo at science.nus.edu> wrote in message news:<a2gi3d\$ks\$1 at smc.vnet.net>...
> Dear all
>
> Have a simple problem:
> have a function, say
> Name[5*I*a] but want to break it into multiples:
> Name[5*I*a]->Name*Name[I]*Name[a]
>
> The issue is that the standard :> rule does not work properly:
> Name[5*I*a]//.{Name_[exa_*exb_]:>(Name[exa]*Name[exb]),
> Name_[exa_*exb_*exc_]:>(Name[exa]*Name[exb]*Name[exc])}
>
> yields just:
> Name[5*I]*Name[a] instead of desired "Name*Name[I]*Name[a]"
>
>
> any suggestions?
>
> with regards
> Kostya

```

• Prev by Date: Re: Units
• Next by Date: Re: parallel and remote computing
• Previous by thread: Re: How to separate imaginary unit inside an arbitrary function?
• Next by thread: Re: How to separate imaginary unit inside an arbitrary function?