MathGroup Archive 2000

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

Search the Archive

Re: FULLSIMPLIFY and Subscripted Variables

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25812] Re: [mg25799] FULLSIMPLIFY and Subscripted Variables
  • From: "Arturas Acus" <acus at itpa.lt>
  • Date: Sat, 28 Oct 2000 01:41:05 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Dear Group,   
Few weeks ago I noted that subscribted vars can affect simplification 
(indirectly, throught LeafCount function). Because recently there was some interest in the example
I repeat it here in  more readible form.

In[1]:=
inputSubscribted = FullForm[(1 - 2*Subscript[x, 0]^2 + 2*(-1 + 
Subscript[x, 0]^2)*Cos[2*F])*
    (-I*Cos[F] + Subscript[x, 0]*Sin[F])^2]
Out[1]//FullForm=
FullForm[(Complex[0, -1]*Cos[F] + Sin[F]*Subscript[x, 0])^2*(1 - 
2*Subscript[x, 0]^2 + 2*Cos[2*F]*(-1 + Subscript[x, 0]^2))]

In[2]:=
inputSubscribtedSimplified = FullSimplify[(1 - 2*Subscript[x, 0]^2 + 
2*(-1 + Subscript[x, 0]^2)*Cos[2*F])*
    (-I*Cos[F] + Subscript[x, 0]*Sin[F])^2]
Out[2]=
(Cos[F] + I*Sin[F]*Subscript[x, 0])^2*(-1 + 2*Cos[2*F] + 
4*Sin[F]^2*Subscript[x, 0]^2)

In[3]:=
inputOrdinary = FullForm[(1 - 2*Subscript[x, 0]^2 + 2*(-1 + 
Subscript[x, 0]^2)*Cos[2*F])*
     (-I*Cos[F] + Subscript[x, 0]*Sin[F])^2 /. {Subscript[x, -1] -> 
xm1, Subscript[x, 1] -> xp1, Subscript[x, 0] -> x0}]
Out[3]//FullForm=
FullForm[(1 - 2*x0^2 + 2*(-1 + x0^2)*Cos[2*F])*(Complex[0, -1]*Cos[F] 
+ x0*Sin[F])^2]

In[4]:=
inputOrdinarySimplified = FullSimplify[(1 - 2*Subscript[x, 0]^2 + 
2*(-1 + Subscript[x, 0]^2)*Cos[2*F])*
     (-I*Cos[F] + Subscript[x, 0]*Sin[F])^2 /. {Subscript[x, -1] -> 
xm1, Subscript[x, 1] -> xp1, Subscript[x, 0] -> x0}]
Out[4]=
(1 - 2*x0^2 + 2*(-1 + x0^2)*Cos[2*F])*(-I*Cos[F] + x0*Sin[F])^2

Input is ok:

In[5]:=
Expand[TrigToExp[inputSubscribted /. {Subscript[x, -1] -> xm1, 
Subscript[x, 1] -> xp1, Subscript[x, 0] -> x0}]] === 
  Expand[TrigToExp[inputOrdinary]]
Out[5]=
True

When expanded  simplified rezult  is the same again. 

In[6]:=
Expand[TrigToExp[inputSubscribtedSimplified /. {Subscript[x, -1] -> 
xm1, Subscript[x, 1] -> xp1, Subscript[x, 0] -> x0}]] === 
  Expand[TrigToExp[inputOrdinarySimplified]]
Out[6]=
True

In[7]:=
{LeafCount[inputSubscribtedSimplified /. {Subscript[x, -1] -> xm1, 
Subscript[x, 1] -> xp1, Subscript[x, 0] -> x0}], 
  LeafCount[inputSubscribtedSimplified], 
LeafCount[inputOrdinarySimplified]}
Out[7]=
{30, 34, 32}

So, no errors and after
substituting subscribted variables FullSimplify indeed  find 
nicer solution. I suspect that manipulating with subscribted variables one can think examples, when  FullSimplify 
 would like one type of expressions and hate others, much like using 
ComplexityFunction, but much faster.



> Date:          Wed, 25 Oct 2000 03:53:53 -0400 (EDT)
> From:          Blimbaum Jerry DLPC <BlimbaumJE at ncsc.navy.mil>
To: mathgroup at smc.vnet.net
> To:            mathgroup at smc.vnet.net
> Subject: [mg25812]       [mg25799] FULLSIMPLIFY and Subscripted Variables

> 	Within  the past few weeks an example was shown for using
> FullSimplify on an equation using the variable x_subscript0.  If I've done
> the work correctly, I just want to show that Mathematica produced an
> 'incorrect' result using x_subscript that is fixed if the Utilities Notation
> is used first.  Here is the example:
> 
> 
>      expr=	(-I*Cos[F] + Sin[F]*Subscript[x, 0])^2*(1 - 2*Subscript[x,
> 0]^2 + 2*Cos[2*F]*(-1 + Subscript[x, 0]^2))
> 
> 	The example submitted to Mathgroup performed a FullSimplify on this
> expression using the subscripted x and just x to show that Mathematica got a
> so called 'nicer' form of the simplified expression when using a subscripted
> variable.  I tested this out in the following way to verify it:
> 
> 	expr1=expr//Expand
> 
> 	expr1//FullSimplify
> 	expr2=%//Expand
> 
> 	expr1==expr2
> 
> 	The results using x only returned True for expr1==expr2, however it
> didnt when using x_subscript0, i.e. the FullSimplify was wrong for the
> subscripted x.  Then I repeated the above steps but first loaded the
> UtilitiesNotation and then Symbolize[x_] and then the above steps returned
> True for expr1==expr2...
> 
> 	Jerry Blimbaum  NSWC  Panama  City, Fl
> 
> 	
> 
> 
> 
                                     
Dr. Arturas Acus
Institute of Theoretical
Physics and Astronomy
Gostauto 12, 2600,Vilnius
Lithuania 


E-mail: acus at itpa.lt
   Fax: 370-2-225361
   Tel: 370-2-612906


  • Prev by Date: Question concerning Mathematica packages
  • Previous by thread: FULLSIMPLIFY and Subscripted Variables
  • Next by thread: some Limits