[Date Index]
[Thread Index]
[Author Index]
Re: Mistake in applying a rule
*To*: mathgroup at smc.vnet.net
*Subject*: [mg80701] Re: Mistake in applying a rule
*From*: dimitris <dimmechan at yahoo.com>
*Date*: Wed, 29 Aug 2007 04:18:58 -0400 (EDT)
*References*: <fb0f17$f05$1@smc.vnet.net>
On 28 , 09:23, Steven Siew <sie... at bp.com> wrote:
> Hi,
>
> I'm trying to show that Integrate[Cos[x-a]] is Sin[x-a] + C
>
> I manage to get Simplify @ Integrate[Cos[x-a]] to give -Sin[a-x]
>
> This is fine because Sin[-x] is equal to -Sin[x]
>
> But when I apply the rule Times[-1,Sin[Plus[g_,Times[-1,h_]]]] ->
> Sin[h-g] it fails.
>
> Here is the complete transcript.
>
> Mathematica 5.2 for Students: Microsoft Windows Version
> Copyright 1988-2005 Wolfram Research, Inc.
>
> In[1]:=
> Out[1]= {stdout}
>
> In[2]:= (* Write your mathematica code below *)
>
> In[3]:= Simplify @ Integrate[Cos[x-a],x]
>
> Out[3]= -Sin[a - x]
>
> In[4]:= FullForm[%]
>
> Out[4]//FullForm= Times[-1, Sin[Plus[a, Times[-1, x]]]]
>
> In[5]:= % /. Times[-1,Sin[Plus[g_,Times[-1,h_]]]] -> Sin[h-g]
>
> Out[5]= -Sin[a - x]
>
> In[6]:= (* End of mathematica code *)
>
> In[7]:= Quit[];
(The following is for Mathematica 5.2.
But I think there belong to fundemental aspects
of Mathematica to have changed to the new version)
For Mathematica evaluator
In[5]:=
Sin[x - a]
Out[5]=
-Sin[a - x]
In[6]:=
-Sin[x - a]
Out[6]=
Sin[a - x]
always.
So there is not a trivial way to write -Sin[a - x]
as Sin[x-a]. I think it has to do with the ordering
of the symbols. (I think also you want to avoid any
extraordinary rules/modifications).
In[10]:=
Head /@ {x, a, y}
Out[10]=
{Symbol, Symbol, Symbol}
For Mathematica evaluator the ordering of the symbol
x follows a.
Just compare
In[12]:=
{-Sin[x - a], -Sin[a - x] /. a -> y}
Out[12]=
{Sin[a - x], Sin[x - y]}
Dimitris
Prev by Date:
**Re: Another question on lists**
Next by Date:
**Re: Manipulate menu items from FrontEnd?**
Previous by thread:
**Re: Mistake in applying a rule**
Next by thread:
**Re: Re: record intermediate steps**
| |