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)
- Organization: http://groups.google.com/
- 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 your expression In[2]:=data = f[5 I a] Out[2]=f[5 I a] Then if you look at the FullForm of your expression we see how it is stored In[4]:=FullForm[data] Out[4]//FullForm=f[Times[Complex[0, 5], a]] Based on the FullForm expression we can define a replacement rule as follows In[15]:= data /. f[x_Complex z_] -> Apply[Times, {f[Im[x]], f[I], f[z]}] Out[15]=f[I] f[5] 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[5]*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[5]*Name[I]*Name[a]" > > > any suggestions? > > with regards > Kostya