Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

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


  • 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?