MathGroup Archive 1999

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

Search the Archive

Re: Can someone explain this?


Benjamin Lotto wrote:
> 
> Using Mathematica 3.0.1.1x on a PowerMac 9600/233 under system 8.5.1, I get the
> following.  No matter what variation I try, I can't get Mathematica to replace
> Tan[x] with Sin[x]/Cos[x].  (Ultimately I'd like to do this with more
> complicated expressions.)

Hi Benjamin,

look at the trace of the last replacement

{{HoldForm[Tan[z_] :> Sin[z]/Cos[z]], HoldForm[Tan[z_] :>
Sin[z]/Cos[z]]}, 
  HoldForm[Tan[x] /. Tan[z_] :> Sin[z]/Cos[z]], HoldForm[Sin[x]/Cos[x]], 
  {HoldForm[Cos[x]^(-1)], HoldForm[Sec[x]]},HoldForm[Sin[x]*Sec[x]],
HoldForm[Sec[x]*Sin[x]], 
  HoldForm[Tan[x]]}

You see whats going on ?
The replacement is done (as expected) but the future evaluation gives
Tan[x] again because Mathematica don't like Sin[x]/Cos[x] for Tan[]
at all.

Th only way to prevent the evaluation here is to wrap a Hold[] around
your expression 

Hold[Tan[x]]/.Tan[z_]:>Sin[z]/Cos[z]

the next ReleaseHold[] will cause the simplification to Tan[] again.

Hope that helps
  Jens


  • Prev by Date: Re: function arguments as subscripts
  • Next by Date: Re: Animated give out of animated Mathematica?
  • Previous by thread: Re: Can someone explain this?
  • Next by thread: Re: Can someone explain this?