Re: Can someone explain this?
- To: mathgroup at smc.vnet.net
- Subject: [mg19157] Re: Can someone explain this?
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Thu, 5 Aug 1999 23:58:59 -0400
- Organization: Universitaet Leipzig
- References: <7obcl4$3te@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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