Re: Factorise with respect to a variable
- To: mathgroup at smc.vnet.net
- Subject: [mg79626] Re: [mg79584] Factorise with respect to a variable
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Tue, 31 Jul 2007 06:15:53 -0400 (EDT)
- Reply-to: hanlonr at cox.net
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!];
terms = Simplify[{expr/(expr /. n1 -> 1), (expr /. n1 -> 1)}]
{(E^(I*(2*chi1 - kappa)*(n1 - 1))*
Sqrt[n1 + 1]*x^(n1 - 1)*
Sqrt[(n2 - 1)!*n2!]*
SuperStar[x]^(n1 - 1))/
Sqrt[n1!*(n1 + 1)!*(n2 - 1)!*
n2!],
(E^(I*(2*chi1 + 2*chi2 -
2*kappa - 2*chi2*n2 +
kappa*n2 + I*x*SuperStar[
x] + I*y*SuperStar[y]))*
Sqrt[n2]*x*y^n2*SuperStar[x]^2*
SuperStar[y]^(n2 - 1))/
Sqrt[(n2 - 1)!*n2!]}
Simplify[expr == (Times @@ terms)]
True
The expressions can be simplified if {n1 > -1, n2 > 0}
expr = FullSimplify[expr, {n1 > -1, n2 > 0}]
(E^(I*(2*chi1*n1 - 2*chi2*
(n2 - 1) + kappa*(-n1 + n2 -
1) + I*x*SuperStar[x] +
I*y*SuperStar[y]))*x^n1*y^n2*
SuperStar[x]^(n1 + 1)*
SuperStar[y]^(n2 - 1))/
(Gamma[n1 + 1]*Gamma[n2])
Simplify[{expr/(expr /. n1 -> 1), (expr /. n1 -> 1)}]
{(E^(I*(2*chi1 - kappa)*(n1 - 1))*
x^(n1 - 1)*SuperStar[x]^
(n1 - 1))/Gamma[n1 + 1],
(E^(I*(2*chi1 + kappa*(n2 - 2) -
2*chi2*(n2 - 1) +
I*x*SuperStar[x] +
I*y*SuperStar[y]))*x*y^n2*
SuperStar[x]^2*SuperStar[y]^
(n2 - 1))/Gamma[n2]}
Bob Hanlon
---- Andrew Moylan <andrew.j.moylan at gmail.com> 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?
>
>