IInk SDK Web REST Math recognition examples

Writing a formula

Considering this request body.

rest-math-equation-example.json
{
  "configuration": {
    "lang": "en_US",
    "math": {
      "solver": {
        "enable": true,
        "fractional-part-digits": 3,
        "decimal-separator": ".",
        "rounding-mode": "half up",
        "angle-unit": "deg"
      },
      "margin": {
        "top": 20,
        "left": 10,
        "right": 10,
        "bottom": 10
      },
      "eraser": {
        "erase-precisely": false
      },
      "undo-redo": {
        "mode": "stroke"
      },
      "mimeTypes": [
        "application/x-latex"
      ]
    },
    "export": {
      "image-resolution": 300,
      "jiix": {
        "bounding-box": false,
        "strokes": false,
        "text": {
          "chars": false,
          "words": true
        }
      }
    }
  },
  "xDPI": 96,
  "yDPI": 96,
  "contentType": "Math",
  "height": 420,
  "width": 2560,
  "strokeGroups": [
    {
      "penStyle": "color: #000000;\nwidth: 1.8897637795275593;\n-myscript-pen-width: 1;\n-myscript-pen-fill-style: none;\n-myscript-pen-fill-color: #FFFFFF00;",
      "strokes": [
        {
          "id": "stroke-f6031833-dea0-46dc-80bc-aa83bb2e4b12",
// Open the file to see the full content (1,944 lines)

The strokes in the strokeGroups of this request correspond to that writing:

If you ask for application/x-latex output, you will obtain the following result :

\int ^{b}_{a}f'\left( x\right) dx=f\left( b\right) -f\left( a\right).

You can then use this output to insert the formula in your documents:

If your need is to analyze the components of the formula, you can also ask for application/vnd.myscript.jiix or application/mathml+xml.

Solving an equation

Considering this request body.

rest-math-solver-example.json
{
  "xDPI": 96,
  "yDPI": 96,
  "width": 815,
  "height": 1153,
  "contentType": "Math",
  "configuration": {
    "lang": "en_US",
    "text": {},
    "export": {
      "jiix": {
        "strokes": false,
        "text": {
          "chars": false,
          "words": true
        }
      }
    }
  },
  "strokeGroups": [
    {
      "strokes": [
        {
          "x": [
            124,
            126,
            126,
            124,
            124
          ],
          "y": [
            214,
            219,
            222,
            227,
            230
          ],
          "t": [
            50708,
            50866,
            50882,
            50899,
            50916
          ],
          "p": [
            0.5,
            0.7679404212893917,
            0.6761535882018319,
            0.7531128489300326,
            0.6761535882018319
// Open the file to see the full content (542 lines)

The strokes in the strokeGroups of this request correspond to that writing:

If you ask for application/x-latex output, you will obtain the following result :

\pi \times 25^{2}=.

Which is Latex for:

When you ask for application/vnd.myscript.jiix, you can see that a node solving the equation is flagged as generated:

{
 "type": "Math",
 "expressions": [ {
   "type": "=",
   "id": "math/37",
   "bounding-box": {
    "x": 87.8999939,
    "y": 55.0916634,
    "width": 10.2020874,
    "height": 7.29166794
   },
   "operands": [ {
     "type": "×",
     "id": "math/42",
     "bounding-box": {
      "x": 25.1937485,
      "y": 44.5437477,
      "width": 65.2354126,
      "height": 18.4041672
     },
     "operands": [ {
       "type": "number",
       "id": "math/38",
       "label": "π",
       "value": 4.54159265,
       "exact-value": "4.541592653589793239",
       "bounding-box": {
        "x": 25.1937485,
        "y": 54.5333328,
        "width": 20.7854156,
        "height": 8.34999847
       }
      }, {
       "type": "power",
       "id": "math/41",
       "bounding-box": {
        "x": 62.2354164,
        "y": 44.5437477,
        "width": 28.1937447,
        "height": 17.3458328
       },
       "operands": [ {
         "type": "number",
         "id": "math/39",
         "label": "25",
         "value": 25,
         "bounding-box": {
          "x": 62.2354164,
          "y": 50.59375,
          "width": 18.6687508,
          "height": 10.9958305
         }
        }, {
         "type": "number",
         "id": "math/40",
         "label": "2",
         "value": 2,
         "bounding-box": {
          "x": 82.6083298,
          "y": 44.5437477,
          "width": 7.8208313,
          "height": 7.55625153
         }
        } ]
      } ]
    } ]
  } ],
 "label": "\\pi \\times 25^{2}=",
 "bounding-box": {
  "x": 25.1937485,
  "y": 44.5437477,
  "width": 72.9083328,
  "height": 18.4041672
 },
 "id": "MainBlock",
 "version": "3"
}

If you ask for conversion when you send your strokes, the equation's solving appears in all the outputs.

\pi \times 25^{2}\simeq 1963.495