# Create a Step-by-step equation solver API?

**URL:** <https://community.wolfram.com/t/create-a-step-by-step-equation-solver-api/10393>\
**Category:** Challenges\
**Tags:** education, wolfram-alpha, curated-data, equation-solving, interface-construction, wolfram-cloud\
**Created:** [April 25, 2017, 11:20am UTC](https://community.wolfram.com/t/create-a-step-by-step-equation-solver-api/10393 "2017-04-25T11:20:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![arguiot](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/arguiot/32/10087_2.png) [@arguiot](https://community.wolfram.com/u/arguiot)\
**Post date:** [April 25, 2017, 11:20am UTC](https://community.wolfram.com/t/create-a-step-by-step-equation-solver-api/10393/1 "2017-04-25T11:20:34Z")

</div>

Ok, the idea seems very weird…I know. I’m a very big noob at Mathematica, I downloaded it 2 weeks ago, but I think that’s the most awesome software on earth. Anyway, I know that it’s possible to get [Step-by-step solution](https://mathematica.stackexchange.com/questions/148/get-a-step-by-step-evaluation-in-mathematica) using Wolfram Alpha like this: `WolframAlpha["x^2=x+1"]`  
And I also know that it’s possible to deploy an API using the [Cloud Deploy](https://www.wolfram.com/language/fast-introduction-for-programmers/en/cloud-deployment/) function, but I would like to create an API that when you input: `?q=x^2==x+1` returns a JSON array like this:

```
{
  "1": {
    "text": "Solve for x over the real numbers:",
    "expression": "x^2==x+1"
  },
  "2": {
    "text": "Subtract x+1 from both sides:",
    "expression": "x^2-x-1==0"
  },
  "3": {
    "text": "Add 1 to both sides:",
    "expression": "x^2-x==1"
  },
  "4": {
    "text": "Add 1/4 to both sides:",
    "expression": "x^2-x+1/4==5/4"
  },
  "5": {
    "text": "Write the left hand side as a square:",
    "expression": "(x-1/2)^2==5/4"
  },
  "6": {
    "text": "Take the square root of both sides:",
    "expression": "x-1/2==Sqrt[5]/2 or x-1/2==-(Sqrt[5]/2)"
  },
  "7": {
    "text": "Add 1/2 to both sides:",
    "expression": "x==1/2+Sqrt[5]/2 or x-1/2==-(Sqrt[5]/2)"
  },
  "8": {
    "text": "Add 1/2 to both sides:",
    "expression": "x==1/2+Sqrt[5]/2 or x==1/2-Sqrt[5]/2"
  }
}

```

Or something like this. I know that’s it’s ambitious, and I don’t expect something with tons of options, as I said, I want something simple (if it’s possible to do of course 🙂 ). Thank you for taking your time reading my question, and I hope it’s possible to do. You can see this as a challenge 😉

---

<div class="post-metadata">

**Author:** ![kapioletto](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/kapioletto/32/10262_2.png) [@kapioletto](https://community.wolfram.com/u/kapioletto)\
**Post date:** [April 25, 2017, 11:28am UTC](https://community.wolfram.com/t/create-a-step-by-step-equation-solver-api/10393/2 "2017-04-25T11:28:07Z")

</div>

Why not using Wolfram|Alpha API directly? [Wolfram|Alpha APIs: Computational Knowledge Integration](https://products.wolframalpha.com/api)

---

<div class="post-metadata">

**Author:** ![arguiot](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/arguiot/32/10087_2.png) [@arguiot](https://community.wolfram.com/u/arguiot)\
**Post date:** [April 25, 2017, 11:29am UTC](https://community.wolfram.com/t/create-a-step-by-step-equation-solver-api/10393/3 "2017-04-25T11:29:27Z")

</div>

Then, how should I proceed?

---

<div class="post-metadata">

**Author:** ![neils](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/neils/32/20595_2.png) [@neils](https://community.wolfram.com/u/neils)\
**Post date:** [April 28, 2017, 3:53am UTC](https://community.wolfram.com/t/create-a-step-by-step-equation-solver-api/10393/4 "2017-04-28T03:53:36Z")

</div>

Arthur,

This will give you the step-by-step from Alpha as a graphic:

```
jnk = WolframAlpha["x^2==x+1",IncludePods->{"Solution"},PodStates->{"Solution__Step-by-step solution"}]

```

or you can get the XML and parse it:

```
jnk = WolframAlpha["x^2==x+1","XML",IncludePods->{"Solution"},PodStates->{"Solution__Step-by-step solution"}]

```

I figured this out by doing this:

```
WolframAlpha["x^2==x+1","PodStates"]

```

Which gave me:

{Solution-\>{Solution..Approximate forms,Solution..Step-by-step solution}}

(note the two dots (..) are actually two underscores that don’t appear properly on the forum)

So I had to Include the Solution pod and ask for the step-by-step PodState

I hope this helps

---

<div class="post-metadata">

**Author:** ![neils](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/neils/32/20595_2.png) [@neils](https://community.wolfram.com/u/neils)\
**Post date:** [April 28, 2017, 3:59am UTC](https://community.wolfram.com/t/create-a-step-by-step-equation-solver-api/10393/5 "2017-04-28T03:59:18Z")

</div>

or you can get the Plaintext version:

```
jnk = WolframAlpha["x^2==x+1","PodPlaintext",IncludePods->{"Solution"},PodStates->{"Solution__Step-by-step solution"}]

```

and construct your own JSON from that
