[Date Index]
[Thread Index]
[Author Index]
Re: Common factors in a list
*To*: mathgroup at smc.vnet.net
*Subject*: [mg58348] Re: [mg58327] Common factors in a list
*From*: Andrzej Kozlowski <akozlowski at gmail.com>
*Date*: Tue, 28 Jun 2005 21:56:46 -0400 (EDT)
*References*: <200506280913.FAA05152@smc.vnet.net>
*Sender*: owner-wri-mathgroup at wolfram.com
On 28 Jun 2005, at 18:13, John Reed wrote:
> I'm working with a list (vector) that's composed of functions such as
> complex exponentials and Bessel functions. Some of the functions
> are common
> to each element of the list. I'm trying to find a way to do the
> following:
>
> {a x, a y, a z}-> a *{x, y, z}
>
> In this expression, a, x, y, z are polynomials, exponentials and/or
> Bessel
> functions.
>
> So far I haven't had any luck with this. Does anyone have a simple
> solution?
>
> John Reed
>
What you are asking for is impossible in Mathematica because
Mathematica automatically evaluates
a *{x, y, z}
{a x,a y,a z}
So you need to factor {a x, a y, a z} in some other form, for example
as {a,{x,y,z}}. This can be done as follows:
f[l_List] := With[{a = PolynomialGCD @@ l}, {a, Cancel[l/a]}]
for example
f[{x*BesselI[n, x]*BesselK[m, x], x*BesselI[n, x]*Exp[x]}]
{x*BesselI[n, x], {BesselK[m, x], E^x}}
Andrzej Kozlowski
Chiba, Japan
Prev by Date:
**Re: exact integer from Log[ ]**
Next by Date:
**Re: False image plot**
Previous by thread:
**Common factors in a list**
Next by thread:
**Re: Common factors in a list**
| |