Re: Problem with Expand[Expr, Trig ->True]
- To: mathgroup at smc.vnet.net
- Subject: [mg12727] Re: Problem with Expand[Expr, Trig ->True]
- From: Daniel Lichtblau <danl>
- Date: Thu, 4 Jun 1998 02:52:13 -0400
- Organization: Wolfram Research, Inc.
- References: <email@example.com>
- Sender: owner-wri-mathgroup at wolfram.com
S. Sankaranarayanan wrote:
> I was trying to use Expand[Expr, Trig ->True] for an example given in
> Mathematica book, second edition. It does not seem to work.
> n:= Expand[Sin[x]^2+Sin[2x]^2]
> 2 2
> Out= Sin[x] + Sin[2 x]
> Expand[%,Trig ->True]
> It gives likes this:
> 2 4 2 4
> Cos[x] Cos[x] Sin[x] 2 2 Sin[x]
> Out= 1 - ------- - ------- + ------- + 3 Cos[x] Sin[x] - -------
> 2 2 2 2
> But it is supposed to give
> 1 - Cos[2 x] - Cos[4 x]
> But if I use
> TrigReduce[Sin[x]^2 + Sin[2 x]^2]
> It gives the needed answer.
> 2 - Cos[2 x] - Cos[4 x]
> Out= -----------------------
> Responses will be very much appreciated.
Sounds like you are using the version 2 reference and the version 3
product. The old Expand[...,Trig->True] became TrigReduce,
Expand[...,Trig->True] is (at least almost always) equivalent to
TrigExpand, which is similar to but faster and more general than the
old Trigonometry`TrigReduce from the Algebra`Trigonometry standard
package. All quite clear, no?
Sorry for the change of names, but once you use the up-to-date
documentation I think you will find the new functionality to be alot
better in terms of speed and reliability. The old package code relied
on rule-based programming that was slow, got into deep recursion, did
not handle hyperbolics, etc. Much improved now.
Roughly speaking, TrigExpand will expand sums and rational products of
trig arguments, e.g. Cos[a+2*b]. TrigReduce will attempt to group
arguments together to reduce powers of trigs, effectively undoing
In:= ee = Cos[a+2*b];
In:= TrigExpand[ee] // InputForm
Out//InputForm= Cos[a]*Cos[b]^2 - 2*Cos[b]*Sin[a]*Sin[b] -
Out= Cos[a + 2 b]
Of course trigs do not have unique forms (all those identities), hence
you do not always return to the input you started with.
Prev by Date:
Re: Efficient way to merge lists--Programming help
Next by Date:
Re: who has written a BEM code for an airfoil?
Previous by thread:
Problem with Expand[Expr, Trig ->True]
Next by thread:
Re: How to get PostScript file in text mode.Path: monon.wolfram.com!paulh