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: [mg32452] Re: How to separate imaginary unit inside an arbitrary function?
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Tue, 22 Jan 2002 03:19:12 -0500 (EST)
  • References: <a2gi3d$ks$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Kostya,

We have

    Name[5*I*a]//FullForm

so lets try

        Name[Times[Complex[0,5],a]]

    {Name[5*I*a], Name[0*I*a], Name[I*a]} /.
      {Name[(Complex[0, n_])*a_] -> Name[n]*Name[I]*Name[a],
       Name[0] -> yourchoice, Name[a_] ->
        Name[1]*Name[I]*Name[a]}

    {Name[I]*Name[5]*Name[a], yourchoice,  Name[I]*Name[1]*Name[a]}

The order is not what you specified , but that is due to Times being
orderless, you might want to use List instead ot Times

--
Allan

---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565


"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: Translations
  • Next by Date: Re: Simulating Correlated non-Normal Random Variables
  • Previous by thread: Re: How to separate imaginary unit inside an arbitrary function?
  • Next by thread: buttons