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.
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityI 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.
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.
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"}]
From the first fundamental theorem of calculus
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 *)
==
. Otherwise, in Mathematica useNIntegrate[E^Cos[x] Cos[x]^2 Sin[x], {x, 0, Pi}]
which is honestly not that much more complex. You can also useIntegrate
instead ofNIntegrate
to receive a symbolic answer. $\endgroup$