[Date Index]
[Thread Index]
[Author Index]
Re: manipulating powers
*To*: mathgroup at smc.vnet.net
*Subject*: [mg57322] Re: manipulating powers
*From*: dh <dh at metrohm.ch>
*Date*: Tue, 24 May 2005 05:13:00 -0400 (EDT)
*References*: <d6rtad$44j$1@smc.vnet.net>
*Sender*: owner-wri-mathgroup at wolfram.com
Hi Marc,
You could try to teach "Power" some additional tricks. This could be
done by unprotecting Power and changeing the definition. But it is
easier and saver simpliy to make a rule. E.g.:
r=(x_ - b_*x_)^c_ -> (a + b)^c x^c
then
(x - b*x)^a /. r gives: (a + b)^a*x^a
But note that pattern are rather picky, e.g. (x_ - b_*x_)^c_ is
different from (x_ - b_ x_)^c_. What the patter matcher looks at is
FullForm[...].
Similar, your second problem:
xi^(1/2) + xi^(1/2 + a^2) /. x_^(a_ + b_)-> x^a + x^b gives:
2*Sqrt[xi] + xi^a^2
Sincerely, Daniel
Marc Hesse wrote:
> Hi,
> I have problems manipulating powers. Here are wo of my common problems.
>
> 1) Collecting terms under a power
> In[1]:=f[x_, y_] := (x - b*x)^a
> Collect[f[x, y], x]
> Out[2]=(x - b x)^a
>
> The only thing I can get to work is this
> In[9]:=PowerExpand[Collect[PowerExpand[f[x, y]^(1/a)], x]^a]
> Out[9]=(1 - b)^a x^a
>
> but that seems very convoluted, and I hope there is an easier way, because I
> need to work with large complicated expressions.
>
> 2) Splitting a sum in a power
>
> In[14]:=(xi^(1/2) + xi^(1/2 + a^2)
> where I would like to split the summ in the second exponent, and collect the
> Sqrt[x].
>
> In[15]:=Collect[%, Sqrt[xi]]
> Out[15]=xi + xi^(1\/2 + a^2)
>
>
>
> even if I substitue manulally Mathematica puts recombines the exponentials
>
> % /. {xi^(1/2 + a^2) -> Sqrt[xi]*xi^(a^2)}
> Collect[%, Sqrt[xi]]
>
> xi + xi^(1/2 + a^2)
>
> I hope there is a better way of doing these basic manipulations,
>
> any hep is appreciated
>
> Marc
>
>
Prev by Date:
** Re: Mapping Data**
Next by Date:
**Re: Printing from Mathematica 5.1**
Previous by thread:
**Re: FindFit with conditionals**
Next by thread:
**least-squares problem: B ~ X.A**
| |