Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9584

Re: Replace each f in f^n to different variables

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Replace each f in f^n to different variables
Date 2012-04-13 08:46 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jm8p5d$inm$1@smc.vnet.net> (permalink)
References <201204120633.CAA05368@smc.vnet.net>

Show all headers | View raw


Provided n has a specific value

g = a + b*f + c*f^2 + d*f^3;

g /. f^(n_Integer: 1) :> Times @@ Table[Unique[f], {n}]

a + b f$721 + c f$722 f$723 + d f$724 f$725 f$726

g /. f^(n_Integer: 1) :> Product[Unique[f], {i, n}]

a + b f$727 + c f$728 f$729 + d f$730 f$731 f$732


Bob Hanlon


On Thu, Apr 12, 2012 at 2:33 AM, Yi Wang <tririverwangyi@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.
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Replace each f in f^n to different variables Bob Hanlon <hanlonr357@gmail.com> - 2012-04-13 08:46 +0000

csiph-web