# Wolfram|Alpha query doesn't compute answer

I typed

== integral (e^cosx)((cosx)^2)(sinx) from x=0 to pi


into Mathematica, but it doesn't seem to generate an answer. What did I do wrong?

I entered the query directly on the Wolfram|Alpha and there it did give an answer.

• Syntax is wrong. Check help pages about 'Integrate' and functions. Dec 29, 2020 at 21:45
• this is in the form for the wolfram alpha querie, so what is wrong with the syntax? a.e. ==integral (e^cosx)((cosx)^2) from x=0 to pi will give an answer but ==integral (e^cosx)((cosx)^2)(sinx) from x=0 to pi will not
– apri
Dec 29, 2020 at 21:55
• It works on WolframAlpha's web interface, but I agree that it doesn't work when I tried it in a notebook by invoking the Alpha interface with ==. Otherwise, in Mathematica use NIntegrate[E^Cos[x] Cos[x]^2 Sin[x], {x, 0, Pi}] which is honestly not that much more complex. You can also use Integrate instead of NIntegrate to receive a symbolic answer. Dec 29, 2020 at 21:59
• The reason why I want to use the alpha interface is for the 'step-by-step' function, if I only want an answer I could type =integral (e^cosx)((cosx)^2)(sinx) from x=0 to pi as well
– apri
Dec 29, 2020 at 22:09

For some reason this works (in ver. 12.1) and gives the "Step-By-Step Solution" option: WolframAlpha["--Integrate[E^Cos[x]*Cos[x]^2*Sin[x], {x, 0, Pi}]"]
but
WolframAlpha["Integrate[E^Cos[x]*Cos[x]^2*Sin[x], {x, 0, Pi}]"]
does not.

• This also works: WolframAlpha["1*Integrate[E^Cos[x]*Cos[x]^2*Sin[x], {x, 0, Pi}]"] Dec 29, 2020 at 23:07
• yes it works for in version 12.0 as well!
– apri
Dec 30, 2020 at 0:29
• I tried == 1*integral (e^cosx) ((cosx)^2) (sinx) from x = 0 to pi, and it works now, awesome!
– apri
Dec 30, 2020 at 0:30
• That's great! I'm still amazed it is ok not having a space between the trig functions and the x. Dec 30, 2020 at 5:15

Alternatively, use the indefinite integral

sol = WolframAlpha[
"integral (E^(cos x))((cos x)^2)(sin x) dx", {{"IndefiniteIntegral", 2},
"Content"}, PodStates -> {"IndefiniteIntegral__Step-by-step solution"}]


Subtract @@ ((-(1/2))*E^Cos[x]*
(-(4*Cos[x]) + Cos[2*x] + 5) /. {{x -> Pi}, {x -> 0}})

(* -(5/E) + E *)


Verifying,

Integrate[E^Cos[x] Cos[x]^2 Sin[x], {x, 0, Pi}]

(* -(5/E) + E *)