4
$\begingroup$

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 ?

$\endgroup$
5
$\begingroup$

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"}
]

enter image description here

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] *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.