2
$\begingroup$

I'm trying to use the 'Show Steps' feature of Wolfram Alpha within mathematica to solve equations. I have the following code:

ShowSteps[str_] := 
 WolframAlpha[ToString@str, IncludePods -> {"Result"}]

And from here, I can click "Show Steps" to get the steps. It works fine, but I would rather have it automatically tell me the steps. I know there is a way using PodStates, but I'm not exactly sure how. I've tried:

PodStates -> {"Input__Step-by-step solution"}

But it just gives the same output. How can I make it automatically show me steps?

$\endgroup$
4
$\begingroup$

I've found the answer! Turns out the PodState has to be:

 {"[PodName]__Step-by-step solution"}

And the second argument to WolframAlpha has to be:

{{"[Podname]", 2}, "Content"}

If you have a 1 there instead of a 2, it will just show the answer and not the steps. So, all in all, the function:

ShowSteps[str_, find_: "Result", num_: 2] := 
 WolframAlpha[ToString@str, {{find, num}, "Content"}, 
  PodStates -> {find <> "__Step-by-step solution"}]

Takes the problem, the pod name you want to find (Defaults to 'result') and whether you want to show the steps or not (1 for just show answer, 2 for show steps) and will give an answer! I found this just through trial and error, I would love to hear if someone could explain why the subpodid has to be a 2 to show steps.

$\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.