Re: How to separate imaginary unit inside an arbitrary function?
- To: mathgroup at smc.vnet.net
- Subject: [mg32465] Re: [mg32449] How to separate imaginary unit inside an arbitrary function?
- From: BobHanlon at aol.com
- Date: Tue, 22 Jan 2002 03:19:37 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 1/21/02 3:13:35 AM, zlo at science.nus.edu writes:
>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]"
>
5*I//FullForm
FullForm[Complex[0, 5]]
Name[5*I*a]//.
{Name_[exa_*exb_]:>
(Name[exa]*Name[exb]),
Name_[Complex[0,exa_/;exa!=1]]:>
(Name[exa]*Name[I])}
Name[I]*Name[5]*Name[a]
Bob Hanlon
Chantilly, VA USA