[Date Index]
[Thread Index]
[Author Index]
Re: Interesting failure of Collect
*To*: mathgroup at smc.vnet.net
*Subject*: [mg61346] Re: [mg61307] Interesting failure of Collect
*From*: Bob Hanlon <hanlonr at cox.net>
*Date*: Sun, 16 Oct 2005 00:18:00 -0400 (EDT)
*Reply-to*: hanlonr at cox.net
*Sender*: owner-wri-mathgroup at wolfram.com
(expr=Sin[p]/(4 Pi a)+Sin[p]/(4 Pi b))//FullForm
Plus[Times[Rational[1,4],Power[a,-1],Power[Pi,-1],Sin[p]],Times[Rational[
1,4],Power[b,-1],Power[Pi,-1],Sin[p]]]
(expr2=Sin[p]/(4 Pi a)-Sin[p]/(4 Pi b))//FullForm
Plus[Times[Rational[1,4],Power[a,-1],Power[Pi,-1],
Sin[p]],Times[Rational[-1,4],Power[b,-1],Power[Pi,-1],Sin[p]]]
Sin[p]/(4 Pi)//FullForm
Times[Rational[1,4],Power[Pi,-1],Sin[p]]
Unlike in expr, the pattern of the subexpression does not repeat in expr2.
However, since to use Collect you must know the form of the subexpression,
you can use that knowledge
Collect[expr2/.Sin[p]:>4*Pi*q,q]/.q:>Sin[p]/(4*Pi)
((1/a - 1/b)*Sin[p])/(4*Pi)
Although it provides a slightly different form, it would be simpler to use
Factor rather than Collect.
Bob Hanlon
>
> From: "Blimbaum, Jerry CIV NSWC PC" <jerry.blimbaum at navy.mil>
To: mathgroup at smc.vnet.net
> Date: 2005/10/14 Fri PM 10:22:38 EDT
> Subject: [mg61346] [mg61307] Interesting failure of Collect
>
>
> Given the expr = Sin[p]/(4 Pi a) + Sin[p]/(4 Pi b)
>
> and then applying the command
>
>
> Collect[expr, Sin[p]/(4 Pi)] works as it should, however,
>
> expr2 = Sin[p]/(4 Pi a) - Sin[p]/(4 Pi b)
>
> leaves the expression untouched. (I realize I could use Simplify but
> this problem occurred on a much longer expression and this is intended
> just to convey the basic idea)....for longer expressions the Collect
> process works for all quantities with a + sign but the one with a minus
> sign will not be collected.....strikes me as a "bug".....
>
>
> thanks....jerry blimbaum
>
>
>
Prev by Date:
**Re: Interesting failure of Collect**
Next by Date:
**Re: Interesting failure of Collect**
Previous by thread:
**Re: Interesting failure of Collect**
Next by thread:
**Re: Interesting failure of Collect**
| |