# Creating a function to simplify WolframAlpha query

When I can't remember an integral I usually just query wolfram and have it show steps.

This was my naive attempt at trying to make a simpler function.

 wolfram[query_] =
WolframAlpha[ToString[query], IncludePods -> "Input",
AppearanceElements -> {"Pods"}, PodStates -> {"Input__Show steps"}]


It doesn't work. I'm completely clueless :) More generally I'm asking: How would I create a permanent function to simplify something this... verbose ?

-

For indefinite integrals where "Show Steps" is available, the pod state is "IndefiniteIntegral__Step-by-step solution". The following works for cases where W|A can show the steps.

showSteps[query_] := WolframAlpha[
"integrate " <> ToString[query],
{{"IndefiniteIntegral", 2}, "Content"},
PodStates -> {"IndefiniteIntegral__Step-by-step solution"}
]


The 2 in the second argument refers to the hidden steps. Using 1 instead will give you the formatted result.

To get a computable result (formatting free) from W|A, you can use the following:

integrate[query_] := WolframAlpha[
"integrate " <> ToString[query],
{{"IndefiniteIntegral", 1}, "ComputableData"},
PodStates -> {"IndefiniteIntegral__Step-by-step solution"}
]

integrate["sin(x)^2"] // InputForm
(* Hold[Integrate[Sin[x]^2, x] == (x - Cos[x]*Sin[x])/2] *)

-