MathGroup Archive 2007

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

Search the Archive

Re: Factorise with respect to a variable

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79614] Re: [mg79584] Factorise with respect to a variable
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Tue, 31 Jul 2007 06:09:36 -0400 (EDT)
  • References: <200707301043.GAA01238@smc.vnet.net>

Its not perfect, but (I think) close enough:


FF[expr_, x_] :=
  Module[{ls = FactorList[expr], s},
   s = DeleteCases[ls, _?(FreeQ[#, x] &), {1}]; {Times @@ (Power[##]  
& @@@ s),
    Times @@ (Power[##] & @@@ Complement[ls, s])}]

Then

  FF[1/(2*x*y^2), x]
  {1/x, 1/(2*y^2)}

FF[1/(2*x*y^2), y]
{1/y^2, 1/(2*x)}

and


expr = (E^(I*(2*chi2 - kappa + 2*chi1*n1 - kappa*n1 - 2*chi2*n2 +  
kappa*n2 +
           I*x*SuperStar[x] + I*y*SuperStar[y]))*Sqrt[1 + n1]*Sqrt[n2] 
*x^n1*
      y^n2*SuperStar[x]^(1 + n1)*SuperStar[y]^(-1 + n2))/
    Sqrt[n1!*(1 + n1)!*(-1 + n2)!*n2!];

FF[expr, n1]
{(E^(2*I*chi1*n1 - I*kappa*n1)*Sqrt[n1 + 1]*x^n1*
     SuperStar[x]^n1)/Sqrt[n1!*(n1 + 1)!*(n2 - 1)!*
      n2!], E^(-2*I*n2*chi2 + 2*I*chi2 - I*kappa +
      I*kappa*n2 - x*SuperStar[x] - y*SuperStar[y])*
    Sqrt[n2]*y^n2*SuperStar[x]*SuperStar[y]^(n2 - 1)}


Andrzej Kozlowski

On 30 Jul 2007, at 12:43, Andrew Moylan wrote:

> Here's an arbitrary expression that depends (non-polynominally) on  
> n1 and
> some other variables:
>
> expr = (E^(I*(2*chi2 - kappa + 2*chi1*n1 - kappa*n1 - 2*chi2*n2 +
>                 kappa*n2 + I*x*SuperStar[x] + I*y*SuperStar[y]))*
>     Sqrt[1 + n1]*
>         Sqrt[n2]*x^n1*y^n2*SuperStar[x]^(1 + n1)*
>     SuperStar[y]^(-1 + n2))/
>      Sqrt[n1!*(1 + n1)!*(-1 + n2)!*n2!]
>
> Is it possible to use Mathematica to factor out the dependence of  
> expr on
> n1? That is, I would like to factorise expr into {expr1,expr2},  
> such that
> (i) expr1 depends on n1, (ii) expr2 does not depend on n1, and such  
> that
> (given (i) and (ii)) expr1 is as simple as possible.
>
> Here's a simpler example: When I factorise 1/(2*x*y^2) "with  
> respect to" x,
> I want the result to be {1/x, 1/(2*y^2)}.
>
> Do you think it's possible to easily get Mathematica to do  
> something like
> this?
>
>



  • Prev by Date: Setting and Unsetting values, memory usage problems.
  • Next by Date: Re: html conversion problem first graphic cell has a "blank bar" at the bottom
  • Previous by thread: Factorise with respect to a variable
  • Next by thread: Re: Factorise with respect to a variable