MathGroup Archive 2008

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

Search the Archive

Re: Cos[a x - b] displayed as Cos[b - a x]

  • To: mathgroup at
  • Subject: [mg90849] Re: Cos[a x - b] displayed as Cos[b - a x]
  • From: David Bailey <dave at>
  • Date: Sat, 26 Jul 2008 04:21:36 -0400 (EDT)
  • References: <g6c9e5$c1d$>

HO JEE HOU wrote:
> Dear all,
> I have an expression which I wish to put it in the form of Cos[a x - b].
> However when I input it to Mathematica, it automatically converted to
> Cos[b - a x]. Similarly, for Sin[a x - b] it would become -Sin[b - ax].
> I understand that both are equivalent, but I just wish to have the form
> of Cos[a x - b]. Is there any way to do this?
> Thank you very much.
> Best regards,
> Ho
Mathematica automatically performs certain simplifications on 
expressions, which includes resolving certain superficial differences 
between expressions.

The only real way to prevent these happening is to wrap the expression 
in Hold or HoldForm (or something equivalent), but that stops many 
manipulations taking place. It might help if you described exactly what 
you are trying to achieve.

In your example, Mathematica is using two pieces of mathematical 
information - the fact that sums of terms can be rearranged (which is 
very hard to suppress), and the symmetry properties of the trig 
functions. Sometimes it is helpful to use your own version of a function 
- say cos - and then switch to the normal notation when you need it:

In[3]:= test=cos[a x-b]
Out[3]= cos[-b+a x]
In[4]:= test/.cos->Cos
Out[4]= Cos[b-a x]

Mathematica 'knows' nothing about the function 'cos' so it can't assume 
symmetry about 0.

David Bailey

  • Prev by Date: Re: Export into Excel Worksheets
  • Next by Date: Re: Try it again, Mathematica! Was: Can't integrate sqrt(a+b*cos(t)+c*cos(2t))
  • Previous by thread: Re: Cos[a x - b] displayed as Cos[b - a x]
  • Next by thread: how to simplify an expression