MathGroup Archive 2003

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

Search the Archive

RE: Transformation Problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43504] RE: [mg43454] Transformation Problem
  • From: "David Park" <djmp at earthlink.net>
  • Date: Thu, 18 Sep 2003 05:39:35 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Geir,

Mathematica is going to make the simplification. If it is really important
to show the exact form then you will have to use a HoldForm.

f = Sin[x] + Cos[x]

HoldForm @@ {f}
% /. Sin[x] :> Cos[x + Pi/2]

Cos[x] + Cos[x + Pi/2]

The delayed rule was necessary here.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/


From: Geir Ove [mailto:geirAoves at online.no]
To: mathgroup at smc.vnet.net

Hello,

I am trying to transform an expression that involves Sin[x] and Cos[x] into
an expression that only contains Cos[x] terms. However, I do not succeed.
The very problem seems to be that the built in rules that Mathematica knows,
will always rewrite e.g. terms like -Cos[x + Pi/2] to Sin[x].

E.g. assume:

f = Sin[x] + Cos[x]

Now, for the sake of the example, I want mathematica to start represening f
as Cos[x] - Cos[x + Pi/2]. So I try:

In :     f /. Sin[x] -> -Cos[x + Pi/2]
Out:   Sin[x] + Cos[x]

It seems that mathematica does nothing, but it does: It does the
replacement, then uses its internal definitions to simplify back -Cos[x +
Pi/2] to Sin[x]. You can convince yourself about this by doing:

In :     f /. Sin[x] -> Cos[x + Pi/2]
Out:   Sin[x] - Cos[x]

Mathematica changed the sign since you gave the wring rule.

QUESTION:

How can I achieve what I want, namely the form: Cos[x] - Cos[x + Pi/2]. ???

The expression I wan to simplify is of course more complex, but the same
principle applies.

In advance, thanks for any help.

Geir Ove
Norway





  • Prev by Date: RE: Conic sections
  • Next by Date: RE: NSolve fails where Solve succeeds!
  • Previous by thread: Transformation Problem
  • Next by thread: Zeta function, product of summations