# Newton

> Do symbolic math in a workflow: simplify and factor expressions, find derivatives and integrals, and work out trigonometric functions, absolute values and logarithms exactly. Powered by the open-source Newton micro-service. No account or API key required.

App · 5 actions. Web page: https://docs.lodol.com/docs/integrations/newton

## Actions

### Apply a function

Work out a trigonometric function, its inverse, an absolute value or a logarithm, exactly where possible: cos(pi/3) is 1/2, arcsin(1) is 1/2 pi and log base 10 of 1000 is 3. Angles are in radians. No API key required.

**Inputs**

- Function (`function`, text, required): The function to apply. One of: `cos` (Cosine (cos)), `sin` (Sine (sin)), `tan` (Tangent (tan)), `arccos` (Inverse cosine (arccos)), `arcsin` (Inverse sine (arcsin)), `arctan` (Inverse tangent (arctan)), `abs` (Absolute value (abs)), `log` (Logarithm (log)).
- Value (`value`, text, required): What to apply it to: a number or an expression, with angles in radians, e.g. pi/3 or 0.5.
- Base (`base`, number): The base of the logarithm, e.g. 10 or 2. Only for Logarithm; leave empty for the other functions.

**Outputs**

- `base` (number): The base of the logarithm; empty for every other function.
- `function` (text): The function applied: cos, sin, tan, arccos, arcsin, arctan, abs or log.
- `numeric_value` (number): The result as a number when it is a plain number or fraction; empty when it is written with pi or left as e.g. 'sin(1)'.
- `result` (text): Newton's answer, exact where it can be (e.g. '1/2' or '1/2 pi'), otherwise a decimal.
- `summary` (text): One line with the calculation, e.g. 'cos(pi/3) = 1/2'.
- `value` (text): What it was applied to, e.g. 'pi/3' or '1000'.

**Example output**

```json
{
  "base": null,
  "function": "cos",
  "numeric_value": 0.5,
  "result": "1/2",
  "summary": "cos(pi/3) = 1/2",
  "value": "pi/3"
}
```

### Factor expression

Factor a polynomial into simpler pieces, e.g. x^2 + 2x becomes x (x + 2) and x^2-5x+6 becomes (x - 3) (x - 2). No API key required.

**Inputs**

- Expression (`expression`, text, required): The expression, in x, written the way you would type it: ^ for powers, * or a space for multiplying, / for dividing, e.g. x^2 + 2x or sin(x)*x.

**Outputs**

- `expression` (text): The expression that was sent, tidied of extra spaces.
- `numeric_value` (number): The result as a number when it is a plain number or fraction (e.g. 8 or 0.5); empty when it still has x or pi in it.
- `operation` (text): What was done: 'simplify', 'factor', 'derive' or 'integrate'.
- `result` (text): Newton's answer in its own notation, with a space for multiplication, e.g. '2 x + 2' or 'x (x + 2)'.
- `summary` (text): One line saying what was worked out, e.g. 'The derivative of x^2+2x is 2 x + 2'.

**Example output**

```json
{
  "expression": "x^2 + 2x",
  "numeric_value": null,
  "operation": "factor",
  "result": "x (x + 2)",
  "summary": "x^2 + 2x factors as x (x + 2)"
}
```

### Get derivative

Differentiate an expression with respect to x, e.g. x^2+2x gives 2 x + 2 and x*sin(x) gives sin(x) + x cos(x). No API key required.

**Inputs**

- Expression (`expression`, text, required): The expression, in x, written the way you would type it: ^ for powers, * or a space for multiplying, / for dividing, e.g. x^2 + 2x or sin(x)*x.

**Outputs**

- `expression` (text): The expression that was sent, tidied of extra spaces.
- `numeric_value` (number): The result as a number when it is a plain number or fraction (e.g. 8 or 0.5); empty when it still has x or pi in it.
- `operation` (text): What was done: 'simplify', 'factor', 'derive' or 'integrate'.
- `result` (text): Newton's answer in its own notation, with a space for multiplication, e.g. '2 x + 2' or 'x (x + 2)'.
- `summary` (text): One line saying what was worked out, e.g. 'The derivative of x^2+2x is 2 x + 2'.

**Example output**

```json
{
  "expression": "x^2+2x",
  "numeric_value": null,
  "operation": "derive",
  "result": "2 x + 2",
  "summary": "The derivative of x^2+2x is 2 x + 2"
}
```

### Get integral

Integrate an expression with respect to x (the indefinite integral), e.g. x^2+2x gives 1/3 x^3 + x^2. The result leaves out the constant of integration (+ C). No API key required.

**Inputs**

- Expression (`expression`, text, required): The expression, in x, written the way you would type it: ^ for powers, * or a space for multiplying, / for dividing, e.g. x^2 + 2x or sin(x)*x.

**Outputs**

- `expression` (text): The expression that was sent, tidied of extra spaces.
- `numeric_value` (number): The result as a number when it is a plain number or fraction (e.g. 8 or 0.5); empty when it still has x or pi in it.
- `operation` (text): What was done: 'simplify', 'factor', 'derive' or 'integrate'.
- `result` (text): Newton's answer in its own notation, with a space for multiplication, e.g. '2 x + 2' or 'x (x + 2)'.
- `summary` (text): One line saying what was worked out, e.g. 'The derivative of x^2+2x is 2 x + 2'.

**Example output**

```json
{
  "expression": "x^2+2x",
  "numeric_value": null,
  "operation": "integrate",
  "result": "1/3 x^3 + x^2",
  "summary": "The integral of x^2+2x is 1/3 x^3 + x^2 + C"
}
```

### Simplify expression

Simplify a math expression: work out the arithmetic and collect like terms, e.g. 2^2+2(2) becomes 8 and (x+1)^2 becomes x^2 + 2 x + 1. No API key required.

**Inputs**

- Expression (`expression`, text, required): The expression, in x, written the way you would type it: ^ for powers, * or a space for multiplying, / for dividing, e.g. x^2 + 2x or sin(x)*x.

**Outputs**

- `expression` (text): The expression that was sent, tidied of extra spaces.
- `numeric_value` (number): The result as a number when it is a plain number or fraction (e.g. 8 or 0.5); empty when it still has x or pi in it.
- `operation` (text): What was done: 'simplify', 'factor', 'derive' or 'integrate'.
- `result` (text): Newton's answer in its own notation, with a space for multiplication, e.g. '2 x + 2' or 'x (x + 2)'.
- `summary` (text): One line saying what was worked out, e.g. 'The derivative of x^2+2x is 2 x + 2'.

**Example output**

```json
{
  "expression": "2^2+2(2)",
  "numeric_value": 8.0,
  "operation": "simplify",
  "result": "8",
  "summary": "2^2+2(2) simplifies to 8"
}
```
