```Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Problem with Symbolic Math
Date: Sat, 23 May 2009 22:26:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 22
Message-ID: <gv9t5p\$qk1\$1@fred.mathworks.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1243117561 27265 172.30.248.37 (23 May 2009 22:26:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 23 May 2009 22:26:01 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:542084

Hi Friends,
This problem is to be solved by symbolic math but the solution it gives me does not tally with what the actual solution should be:

The problem is to integrate a symbolic function of x, y, w and t with respect to x and evaluate the integrand from -pi/2 to pi/2. So the code below was written:

syms N x y w t real
A = N*cos(x-y)*cos(w*t-y);
B = int(A, x, -pi/2, pi/2);

The expected solution is:

B should equal    N*sin(x-y)*cos(w*t-y) evaluated at (x=pi/2) minus  same expression evaluated at (x=-pi/2). Naturally, the final solution should be:

B = N*(sin(pi/2-y) - sin(-pi/2-y))*cos(w*t-y) = 2*N*cos(y)*cos(w*t-y).

Symbolic toolbox gives me:

B = N*cos(-w*t+2*y)+N*cos(w*t)

I cannot see how this solution is correct.

Please I need this clarified so as to continue using this wonderful tool.
```