# Newton MCP

> Newton provides symbolic math functions for your agent. It calculates derivatives, finds integrals, solves equations, and simplifies complex expressions using natural language prompts. You get access to advanced calculus (like finding areas under a curve with `math_area`) and deep algebra tools like `math_factor` directly through your AI client.

## Overview
- **Category:** developer-tools
- **Price:** Free
- **Tags:** mathematics, symbolic-math, calculus, algebra, scientific-computing

## Description

Look, you need math done right, not some approximation that'll get your project shut down. This Newton server hooks up symbolic math and calculus directly to your agent, so you can run deep calculations without ever leaving your client environment. You don't gotta copy-paste into Wolfram Alpha just 'cause you got a nasty integral; you just ask your AI client, and it handles it.

When you need to tackle complex functions, the server lets you find derivatives using `math_derive`. It takes an expression and spits out the simplified derivative (dy/dx). Need to figure out what function is tangent to a curve at a specific point? Use `math_tangent` for that. For integrals, you've got two shots: if you need an indefinite integral—the general anti-derivative—you use `math_integrate`, and it leaves the constant C in there so you don't forget it. But if you're calculating a precise area under a curve between two specific points, you hit up `math_area`; that’s your definite integral.

When things get messy, the server cleans 'em up for ya. If an expression is just too long and complicated, you run `math_simplify` to reduce it to its most basic form. You can also use `math_factor`, which breaks down any algebraic polynomial into its prime factors so you know exactly what's going on under the hood. To find out where a function crosses the x-axis—those roots that make an expression equal zero—you run `math_zeroes`. 

For trig, it’s straightforward. You can calculate basic values using `math_sin`, `math_cos`, and `math_tan`. If you need to go backwards from a value, like finding the angle whose sine is 0.5, then you use the inverse functions: `math_arcsin` for arcsine, `math_arccos` for arccosine, or `math_arctan` for arctangent. It's there for all your specialized trigonometry needs.

It handles logarithms too. You can compute a logarithm using `math_log`, making sure you specify the base and exponent you want to use. Plus, it gives you solid basic tools like `math_abs` to get the absolute value of an expression. And if you're dealing with exponents or general math rules, those are covered.

This isn't just a calculator; it’s a full symbolic engine. You can process complex algebra through `math_factor`, simplify huge equations using `math_simplify`, find roots with `math_zeroes`, and handle advanced calculus from differentiation (`math_derive`) all in one place. It makes sure your agent always has the right mathematical answer, period.

## Tools

### math_abs
Calculates the absolute value of a given mathematical expression.

### math_arccos
Computes the inverse cosine (arccosine) of an input value.

### math_arcsin
Calculates the inverse sine (arcsine) of an input value.

### math_arctan
Determines the inverse tangent (arctan) of a given number.

### math_area
Finds the area under a curve, executing a definite integral between two specified points.

### math_cos
Calculates the cosine value of an expression.

### math_derive
Finds the derivative (dy/dx) of a mathematical expression, providing a simplified result.

### math_factor
Decomposes an algebraic polynomial into its prime factors.

### math_integrate
Calculates the indefinite integral of a mathematical expression, including the constant C.

### math_log
Computes the logarithm of a value using a specified base and exponent.

### math_simplify
Reduces complex mathematical expressions to their most simple, reduced form.

### math_sin
Calculates the sine value of an expression.

### math_tan
Calculates the tangent value of an expression.

### math_tangent
Finds the equation for a line tangent to a function at a specific x-value.

### math_zeroes
Identifies and returns all roots (x-values) where an expression equals zero.

## Prompt Examples

**Prompt:** 
```
Simplify the expression 2^2+2(2).
```

**Response:** 
```
The simplified result for 2^2+2(2) is 8.
```

**Prompt:** 
```
Find the derivative of x^2+2x.
```

**Response:** 
```
The derivative of x^2+2x is 2x + 2.
```

**Prompt:** 
```
Calculate the area under the curve x^3 from x=2 to x=4.
```

**Response:** 
```
The area under the curve x^3 from 2 to 4 is 60.
```

## Capabilities

### Deriving functions
Finds the derivative of a mathematical expression using `math_derive`.

### Calculating integrals and areas
Computes indefinite integrals with `math_integrate`, or finds the precise area under a curve between two points using `math_area`.

### Finding polynomial roots
Determines the values where an expression equals zero using `math_zeroes`.

### Simplifying and factoring expressions
Cleans up complex math by simplifying terms with `math_simplify` or breaking them down into factors with `math_factor`.

### Handling trigonometric identities
Calculates specific trig functions (sine, cosine, tangent) and their inverses using tools like `math_sin` and `math_arccos`.

## Use Cases

### Debugging a physics model equation
A mechanical engineer hits a snag in their stress equation. Instead of manually taking partial derivatives, they prompt their agent: 'Find the derivative of my current equation.' The agent runs `math_derive` and returns the exact required term, letting them fix the code immediately.

### Validating a financial formula
A quant analyst is building a new risk model. They need to verify if their core function has any critical zero points. The agent uses `math_zeroes` on the equation, returning a precise list of roots that define the failure boundaries for the model.

### Academic homework verification
A student is stuck on an advanced calculus problem involving area. They prompt: 'Calculate the definite integral of x^3 from 2 to 4.' The agent invokes `math_area`, providing the exact answer (60) and confirming their understanding.

### Refining code for optimization
A developer needs to optimize a function by simplifying a complex mathematical dependency. They prompt: 'Simplify this expression.' The agent uses `math_simplify` on the raw math string, providing a clean, reduced version that they can plug back into their codebase.

## Benefits

- You get immediate symbolic results. Instead of copy-pasting into a separate math program, your agent runs `math_derive` or `math_integrate`, returning the final answer directly in your chat or IDE.
- It handles advanced algebra natively. If you need to factor complex polynomials or simplify large expressions, simply use `math_factor` or `math_simplify`—no manual rearrangement required.
- Calculus operations are precise. Need the area under a curve? Use `math_area`. The result is definitive, based on accurate definite integration rules.
- You stay in context. Whether you’re debugging code or working on documentation, running math with Newton means zero context switching between editors and calculators.
- It covers all bases. You can calculate everything from simple trigonometry (`math_sin`) to finding the zeroes of a cubic function using `math_zeroes`.

## How It Works

The bottom line is that your AI client runs complex symbolic math functions instantly, giving you a clean numerical or algebraic answer in one step.

1. Subscribe to the Newton server and provide your API endpoint or access key.
2. Tell your AI client (your agent) exactly what math problem you need solved, specifying which operation is needed (e.g., 'Find the integral of x^2').
3. Your agent invokes the correct tool (like `math_integrate`) and returns the calculated result.

## Frequently Asked Questions

**How do I find the area under a curve using math_area?**
You provide three pieces of information: the function expression, the starting x-value, and the ending x-value. The tool executes the definite integral between those two points.

**Can I simplify an expression with math_simplify?**
Yes. It reduces complex algebraic strings to their simplest form. For example, if you input a fraction, it returns the most reduced numerator and denominator.

**Which tool should I use for finding roots: math_zeroes or math_factor?**
Use `math_zeroes` when you just need the list of numbers (roots) that make the expression zero. Use `math_factor` if you want to break the polynomial down into its constituent, smaller factors.

**How is math_derive different from other tools?**
The `math_derive` tool specifically calculates the derivative (the rate of change) of an expression. It's a specialized operation distinct from simple simplification or finding roots.

**Does using `math_derive` require special authentication or setup beyond providing an API key?**
Yes, you must provide a valid endpoint and access key. The connection process is straightforward: supply your Newton API credentials to the MCP client. This verifies your agent's ability to run symbolic math operations.

**When does `math_integrate` fail, and what error messages should I expect for impossible integrals?**
The server returns structured errors when an integral is undefined or computationally infeasible. Always check the returned payload for specific domain exceptions (like non-convergent limits) rather than assuming failure.

**For `math_simplify`, how should I format complex fractions, like 2 over 4?**
You must use the keyword (over) to separate the numerator and denominator. The tool expects syntax formatted as 'numerator(over)denominator' when simplifying a fractional expression.

**Can `math_log` handle logarithms with custom bases, or only base e?**
You can calculate logs using any specified base. This tool requires you to provide both the specific numerical base and the value in separate parameters for calculation.

**How do I handle fractions when simplifying expressions?**
When using the `math_simplify` tool, use the keyword '(over)' to separate the numerator and denominator. For example, to simplify 2/4, use '2(over)4'.

**Can I find the area under a specific curve between two points?**
Yes! Use the `math_area` tool by providing the `start_x`, `end_x`, and the function `expression`. It will calculate the definite integral for that range.

**How do I calculate a logarithm with a base other than 10 or e?**
Use the `math_log` tool. It requires two parameters: the `base` (e.g., 2) and the `value` (e.g., 8) you want to calculate the logarithm for.