Options
All
  • Public
  • Public/Protected
  • All
Menu

Semantic Math Processor Client is a plugin for SemanticMathEditor and a client for MathProcessor.

Being a plugin for SemanticMathEditor it allows processing math formula created in the online math editor using MathProcessor - a REST wrapper around Sympy - open source Computer Algebra System.

As a result you have online web editor, which can do things like integration, taking derivatives, calculating limits, creating plots, comparing if two math expressions are equivalent and so on.

Links

See it in action:

https://math-editor.com/integrationsDemo.html

See it's sources

https://github.com/softaria/semantic-math-processor-client

Quick start

Install it

npm i semantic-math-processor-client

Install SemanticMathEditor

npm i semantic-math-editor

Import required classes

import {
  SympyClient,
  PreparedSympyCall,
  SympyError,
  EquivResponse,
  Equiv,
  Simpler,
  getAllVariablesFromNodes
} from "semantic-math-processor-client";

import { 
  MathVariable, 
  MathNumber, 
  MathPlus, 
  MathPower, 
  MathTrigonometricFunction, 
  MathTrigonometryType
} from "semantic-math-editor";

Create new client:

 const sympyClient = new SympyClient("https://math-processor.math-editor.com");

Feel free to use your own installation of the MathProcessor instead of oe installed at https://math-processor.math-editor.com

Simplify sum of squared sinus and squared cosinus:

 const expression = new MathPlus(
  new MathPower(new MathTrigonometricFunction(MathTrigonometryType.sin, new MathVariable("x", false)), new MathNumber("2")),
  new MathPower(new MathTrigonometricFunction(MathTrigonometryType.cos, new MathVariable("x", false)), new MathNumber("2")),
);

const preparedCall = client.prepareCompute(expression);

if (preparedCall instanceof PreparedSympyCall) {
  sympyClient.simplify(preparedCall).then(
    (simplified) => {
      console.log(JSON.stringify(simplified));
    }
  ).catch(
    (error) => {
      console.log("ERROR:" + JSON.stringify(error));
      alert("Sympy error. See log for details");
    }
  );
}
else {
  alert("Can't convert the expression to sympy");
}

Detailed documentation

Please click on the module name below.

Index

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc