Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you explain this Mathematica $Assumptions behaviour?

Consider the following three lines of Mathematica code and note that input line 1 and 3 are exactly the same (This is the smallest piece of code I found to demonstrate this behaviour).

>> Integrate[Exp[-a^2] Sin[2 p] ((a^2 + b^2) + b*Cos[p] + a*Sin[p]), {p, 0, 2 \[Pi]}]
0

>> $Assumptions = {t > 0};
>> Integrate[Exp[-a^2] Sin[2 p] ((a^2 + b^2) + b*Cos[p] + a*Sin[p]), {p, 0, 2 \[Pi]}]

8/3 Sqrt[a^2+b^2] E^-a^2

Note that the integral should yield 0, like in Mathematica's first answer. The assumption I enter has apparently nothing to do with the integration. Is this a bug (I use Mathematica 8.0)?

Even stranger, if I split the integral into a sum of 2 or 3 integrals, each of them yields 0. Same thing if I take parts out of the integral which do not depend on p.

For me it looks like a bug but if there is something I'm missing, please let me know.

like image 469
shark.dp Avatar asked Dec 02 '11 08:12

shark.dp


People also ask

What do you mean by Mathematica?

Mathematica is a mathematical computation program used in many scientific, engineering, mathematical, and computing fields. Unlike other systems, Mathematica applies intelligent automation in every part of the system, from algorithm selection to plot layout and user interface design.

How do you comment on Mathematica?

You can put comments within an Input line by using the syntax (* put your comments here *). Mathematica automatically groups cells.

How do you write does not equal in Mathematica?

Details. can be entered as x∖[NotEqual]y or x != y. lhs≠rhs returns True if lhs and rhs are determined to be unequal by comparisons between numbers or other raw data, such as strings.

How do you write a suffix in Mathematica?

Type a subscript with (Insert ▶ Typesetting ▶ Subscript). Exit from typing math with : Exit from a subscript but continue typing math with (Insert ▶ Typesetting ▶ End Subexpression): Typing a subscript in text automatically enters math mode.


2 Answers

In Mathematica 7.0.1 the result is 0, while in 8.0.4 we get

8/3 Sqrt[a^2+b^2] E^-a^2

Thus it has to be a bug, even worse it is an error. Fortunately, one can easily verify the result without a computer, but in case of a more involved integral it would be a major problem.

like image 126
Artes Avatar answered Oct 02 '22 03:10

Artes


This seems to have been solved. In 9.0 version, both give results 0.

like image 43
Jinstrong Avatar answered Oct 02 '22 05:10

Jinstrong