From: Sam Takoy on 2 Aug 2010 07:04 Here's what I am getting Cos[theta]^2 + Sin[theta]^2 // FullSimplify Out[540]= 1 Cos[theta]^2 + Sin[theta]^2 + L^2 Cos[theta]^2 // FullSimplify Out[541]= 1/2 (2 + L^2 + L^2 Cos[2 theta]) I'm really surprised that the answer in the latter case is not 1+ L^2 Cos[theta]^2 Is there an explanation? Thanks, Sam
From: David Park on 3 Aug 2010 06:42 Two techniques that are useful for manipulating or simplifying expressions are: 1) Protect certain subexpressions against participating in simplifications by using a Hold or HoldForm. 2) Operate only on a selected subset of level parts in an expression. The following uses the first technique: Cos[theta]^2 + Sin[theta]^2 + L^2 Cos[theta]^2; MapAt[Hold, %, 2]; % // Simplify // ReleaseHold 1 + L^2 Cos[theta]^2 The second technique can be implemented using the MapLevelParts or MapLevelPatterns routines in the Presentations Manipulation subsection. Needs["Presentations`Master`"] Cos[theta]^2 + Sin[theta]^2 + L^2 Cos[theta]^2; % // MapLevelParts[Simplify, {{1, 3}}] 1 + L^2 Cos[theta]^2 Or using patterns and TrigExpand instead: Cos[theta]^2 + Sin[theta]^2 + L^2 Cos[theta]^2; % // MapLevelPatterns[TrigExpand, {{(Sin | Cos)[_]^2}}] 1 + L^2 Cos[theta]^2 David Park djmpark(a)comcast.net http://home.comcast.net/~djmpark/ From: Sam Takoy [mailto:sam.takoy(a)yahoo.com] Here's what I am getting Cos[theta]^2 + Sin[theta]^2 // FullSimplify Out[540]= 1 Cos[theta]^2 + Sin[theta]^2 + L^2 Cos[theta]^2 // FullSimplify Out[541]= 1/2 (2 + L^2 + L^2 Cos[2 theta]) I'm really surprised that the answer in the latter case is not 1+ L^2 Cos[theta]^2 Is there an explanation? Thanks, Sam
From: Andrzej Kozlowski on 3 Aug 2010 06:57 Well, it looks like Simplify (and FullSimplify) insists on applying algebraic simplifications before trigonometric ones, that is, I think that what it does is this: Simplify[Cos[theta]^2 + Sin[theta]^2 + L^2*Cos[theta]^2, Trig -> False] (L^2 + 1)*Cos[theta]^2 + Sin[theta]^2 and only after that it tries to apply trigonometric identities (of course this is only my hypothesis!). One can force it to return the desired simplified form by telling it explicitly to leave the third term alone: Simplify[Cos[theta]^2 + Sin[theta]^2 + L^2*Cos[theta]^2, ExcludedForms -> (a_)*Cos[theta]^2] L^2*Cos[theta]^2 + 1 Andrzej Kozlowski On 2 Aug 2010, at 13:04, Sam Takoy wrote: > Here's what I am getting > > Cos[theta]^2 + Sin[theta]^2 // FullSimplify > Out[540]= 1 > > Cos[theta]^2 + Sin[theta]^2 + L^2 Cos[theta]^2 // FullSimplify > Out[541]= 1/2 (2 + L^2 + L^2 Cos[2 theta]) > > I'm really surprised that the answer in the latter case is not > > 1+ L^2 Cos[theta]^2 > > Is there an explanation? > > Thanks, > > Sam >
From: Peter Pein on 4 Aug 2010 07:33 Am Mon, 2 Aug 2010 11:04:14 +0000 (UTC) schrieb Sam Takoy <sam.takoy(a)yahoo.com>: > Here's what I am getting > > Cos[theta]^2 + Sin[theta]^2 // FullSimplify > Out[540]= 1 > > Cos[theta]^2 + Sin[theta]^2 + L^2 Cos[theta]^2 // FullSimplify > Out[541]= 1/2 (2 + L^2 + L^2 Cos[2 theta]) > > I'm really surprised that the answer in the latter case is not > > 1+ L^2 Cos[theta]^2 > > Is there an explanation? > > Thanks, > > Sam > Hi Sam, how big might the surprise be when observing the following? In[1]:= expr = Cos[theta]^2 + Sin[theta]^2 + L^2 Cos[theta]^2; LeafCount[longexpr = Times @@ (expr /. L -> L /@ Range[5]) // Expand] Out[2]= 1884 longexpr holds the expanded product of five terms of the same type as expr. In[3]:= longexpr // FullSimplify Out[3]= (1 + Cos[theta]^2 L[1]^2) (1 + Cos[theta]^2 L[2]^2) (1 + Cos[theta]^2 L[3]^2) (1 + Cos[theta]^2 L[4]^2) (1 + Cos[theta]^2 L[5]^2) In this case Mathematica has got no problem simplifying each of the five terms -- strange :-\ Peter
|
Pages: 1 Prev: Disable " symbol Next: A distribution problem using Mathematica |