• Mathematica

I had to calculate an integral, which involves real as well complex parts. As mathematica takes all variables to be complex by default I used the elements function to define that certain variables were Reals.

But it doesn't change the answer. It is still giving a long answer with the same conditions as if the variables were complex.

I am attaching a PDF file if anyone wants to have a look. Am i doing something wrong??

#### Attachments

• 86.8 KB Views: 120

Related MATLAB, Maple, Mathematica, LaTeX News on Phys.org

First off

Code:
Elements[q, q', Reals]
Isn't a valid command (unless you have defined it elsewhere), you need to use Element[q,Reals]; Element[q',Reals];

Secondly you might want to try doing the integral with the assumptions option

Code:
Integrate[f1,{k,-1,1},Assumptions->{Element[q,Reals] && Element[q',Reals] && ...}]
for each of the elements you are assuming for.

Third: your problem isn't just that they are treated as complex numbers, but that the real/imaginary part of those numbers have specific constraints as well. you may need to provide a whole list of assumptions to get a nice output.

Additionally, mathematica does NOT always treat subscripted variables as symbols unless you have specifically delcared them as symbolboxes with the Symbolize command. so it could be that some of the subscripted variables are not being treated correctly. Its still a bit of a mystery as to when mathematica decides to automatically declare a symbolbox and when it doesn't.

Finally, mathematica has terrible symbolics for things beyond very simple manipulations. It may be that you are asking too much of it here. See if you can work out any substiutions by hand to simplify the problem.