Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #9579 > unrolled thread
| Started by | Yi Wang <tririverwangyi@gmail.com> |
|---|---|
| First post | 2012-04-12 08:41 +0000 |
| Last post | 2012-04-13 08:57 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Replace each f in f^n to different variables Yi Wang <tririverwangyi@gmail.com> - 2012-04-12 08:41 +0000
Re: Replace each f in f^n to different variables Ray Koopman <koopman@sfu.ca> - 2012-04-13 08:57 +0000
| From | Yi Wang <tririverwangyi@gmail.com> |
|---|---|
| Date | 2012-04-12 08:41 +0000 |
| Subject | Replace each f in f^n to different variables |
| Message-ID | <jm64ff$6kn$1@smc.vnet.net> |
Hi, all,
I want to replace *each* f in f^n to a different variable, say
f^n -> var1 * var2 * ... * varn
Naively, if I try
f^n /. f:>Unique[],
Mathematica simply returns (a unique variable)^n, instead of the above behaviour.
Is there a simple way to get the f's into different variables?
Thanks!
Yi
PS:
(1) I know there are ways to transform Power to a list by hand, and then do something in it. For example,
Times[((f^3)[[1]]*Table[1, {(f^3)[[2]]}]) /. f :> Unique[]]
However, eventually I will be dealing with a large expression, with all kinds of terms, instead of a single term. This method quickly becomes very complicated.
(2) I want to do such "strange" things, because a product of functions in position space f(x)^n becomes F(k1)F(k2)...F(k_{n-1})F(-k1-k2...) in momentum space.
[toc] | [next] | [standalone]
| From | Ray Koopman <koopman@sfu.ca> |
|---|---|
| Date | 2012-04-13 08:57 +0000 |
| Message-ID | <jm8pqe$j28$1@smc.vnet.net> |
| In reply to | #9579 |
On Apr 12, 1:41 am, Yi Wang <tririverwan...@gmail.com> wrote:
> Hi, all,
>
> I want to replace *each* f in f^n to a different variable, say
>
> f^n -> var1 * var2 * ... * varn
>
> Naively, if I try
>
> f^n /. f:>Unique[],
>
> Mathematica simply returns (a unique variable)^n, instead of the above behaviour.
>
> Is there a simple way to get the f's into different variables?
>
> Thanks!
> Yi
>
> PS:
>
> (1) I know there are ways to transform Power to a list by hand, and then do something in it. For example,
>
> Times[((f^3)[[1]]*Table[1, {(f^3)[[2]]}]) /. f :> Unique[]]
>
> However, eventually I will be dealing with a large expression, with all kinds of terms, instead of a single term. This method quickly becomes very complicated.
>
> (2) I want to do such "strange" things, because a product of functions in position space f(x)^n becomes F(k1)F(k2)...F(k_{n-1})F(-k1-k2...) in momentum space.
r := _^n_Integer?Positive :> Times@@Table[Unique[],{n}]
f^3 /. r
$1 $2 $3
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web