MathGroup Archive 2011

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

Search the Archive

Re: Trignometric rules

  • To: mathgroup at smc.vnet.net
  • Subject: [mg118243] Re: Trignometric rules
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Sun, 17 Apr 2011 07:55:55 -0400 (EDT)

Long story short, Mathematica's pattern matching is a lousy way to do such  
things, because there are myriad unexpected ways to represent expressions  
you or I might consider similar.

Sums and differences are so tricky (because of the Flat and Orderless  
attributes, -x represented as Times[-1,x], et cetera) that if the rule  
DOES match what you'd like it to match, it's almost an accident.

The second problem can be solved with a simpler rule, however:

2 k1 k2 u^2 \[Epsilon]1 Cos[d1 + d2 - \[Phi]b - \[Phi]r] /.
  Cos[x_] :> Sin[x + \[Phi]b]

2 k1 k2 u^2 \[Epsilon]1 Sin[d1 + d2 - \[Phi]r]

or (more carefully), with

2 k1 k2 u^2 \[Epsilon]1 Cos[d1 + d2 - \[Phi]b - \[Phi]r] /.
  Cos[x_] /; ! FreeQ[x, \[Phi]b] :> (Sin[x /. \[Phi]b -> 0])

2 k1 k2 u^2 \[Epsilon]1 Sin[d1 + d2 - \[Phi]r]

Bobby

On Sat, 16 Apr 2011 06:33:28 -0500, Alexei Boulbitch  
<alexei.boulbitch at iee.lu> wrote:

> Indeed, why this works:
>
> 2 k1^3 k2 v^2 \[Epsilon]1^3 \[Epsilon]c^2 Cos[
>     d1 + d3 + \[Phi]b + \[Phi]r] /. {A_*Cos[a_ + \[Phi]b + x_] ->
>     A*\[Phi]b*Sin[a + x]}
>
> 2 k1^3 k2 v^2 \[Epsilon]1^3 \[Epsilon]c^2 \[Phi]b Sin[
>    d1 + d3 + \[Phi]r]
>
> while this:
>
> 2 k1 k2 u^2 \[Epsilon]1 Cos[d1 + d2 - \[Phi]b - \[Phi]r] /.
>   A_*Cos[b_ - \[Phi]b + y_] ->  -A*\[Phi]b*Sin[b + y]
>
> 2 k1 k2 u^2 \[Epsilon]1 Cos[d1 + d2 - \[Phi]b - \[Phi]r]
>
> does not?
>
> Best, Alexei
>
>
> I have an expression as hsown below
>
> tt = -4 k1^2 v^2 \[Epsilon]1^2 \[Epsilon]c^2 Cos[2 d1 + d2 + d3] -
>     2 k1 k2 u^2 \[Epsilon]1 Cos[d1 + d2 - \[Phi]b - \[Phi]r] +
>     2 k1^2 v^2 \[Epsilon]1^2 \[Epsilon]c^2 Cos[
>       2 d1 + d2 + d3 - \[Phi]b - \[Phi]r] +
>     2 k1^3 k2 v^2 \[Epsilon]1^3 \[Epsilon]c^2 Cos[
>       d1 + d3 + \[Phi]b + \[Phi]r] +
>     2 k1^2 u^2 \[Epsilon]1^2 Cos[2 d1 + d2 + d3 + \[Phi]b + \[Phi]r] -
>     2 k1^2 v^2 \[Epsilon]1^2 \[Epsilon]c^2 Cos[
>       2 d1 + d2 + d3 + \[Phi]b + \[Phi]r];
>
> I'd like to replace any term containing Cos[+/- phib + x_]  with 2 Sin  
> [+/-phib] Sin[x]. How do I go about doing it.
>
> Thanks
> Chelly
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Washington DC Area Mathematica Special Interest Group
  • Next by Date: Re: ListLinePlot and Filling, or not ....
  • Previous by thread: Re: Trignometric rules
  • Next by thread: Re: Trignometric rules