JLA
JLA

Reputation: 111

Why Doesn't Mathematica Evaluate This Integral?

I am using Mathematica (the online version, but not WolframAlpha) and I'm trying to estimate the integral

$\int_{-1}^1 e^{\frac{i}{1+x^2}}\dx\,.$ 

To do so, I've entered

NIntegrate[E^[I/[1 + x^2]], {x, -1, 1}]

but instead of returning a number it just returns the integral I wrote above. Meanwhile, WolframAlpha estimates this just fine, as in

I tried entering

NIntegrate[E^[I/[1 + x^2]], {x, -1, 1}] 

and was expecting a number.

Upvotes: 0

Views: 421

Answers (1)

Bill
Bill

Reputation: 3977

Looks like a misunderstanding of [] versus () in Mathematica.

Try

NIntegrate[E^(I/(1 + x^2)), {x, -1, 1}]

which instantly returns

1.3958009479756124 + 1.39620125365813*I

In Mathematica, as opposed to WolframAlpha and "ordinary math"

[] always, well almost always, surround function arguments.

() group "ordinary" operands in expressions.

It takes a little while to get used to Mathematica conventions.

Upvotes: 2

Related Questions