Numerical Partial Derivative with Respect to x Calculator
This numerical partial derivative calculator estimates how a two-variable function changes in the x direction while y remains fixed.
Run — free
Enter an expression in x and y, choose the point, and optionally set the finite-difference step. The calculator evaluates the function just to the right and left of the requested x-coordinate, then uses those values to produce a deterministic central-difference estimate. It is useful when a symbolic derivative is inconvenient, unavailable, or unnecessary for the task at hand.
Enter the function and evaluation point
Write the function as an explicit expression using the variables x and y. The accepted operators are addition, subtraction, multiplication, division, and exponentiation with the caret symbol. Parentheses control grouping. The supported named functions are sin, cos, tan, exp, log, sqrt, and abs, while pi and e are available as constants. Multiplication must be written explicitly, so use 2*x rather than 2x and x*y rather than xy. Supply finite numeric values for both coordinates. The calculator changes only x during the estimate; the value of y is held exactly at the number you provide. This detail is what makes the result a partial derivative instead of a derivative along an arbitrary path. The expression is parsed as mathematical input and is never executed as JavaScript. Unsupported names, malformed parentheses, missing coordinates, and results outside the finite numeric range are rejected as invalid input instead of producing a misleading answer. A practical first test is a function whose derivative you already know, which confirms that the expression and point mean what you intended.
Understand the central finite-difference estimate
For a requested point (x, y) and step h, the calculator evaluates the function at (x+h, y) and (x-h, y). It subtracts the backward value from the forward value and divides the difference by 2h. Because the samples are balanced on both sides of the point, this central formula usually has substantially less truncation error than a one-sided estimate using the same step size. The response includes the derivative estimate, the effective step, and both sampled function values so you can inspect the calculation rather than receiving an unexplained number. The method remains an approximation: it does not construct or simplify a symbolic derivative. It also assumes that the function is defined and reasonably smooth near both sample points. At a discontinuity, cusp, domain boundary, or singularity, a finite result may fail to exist or may vary sharply with h. In those cases, compare several permitted step sizes and interpret instability as useful evidence that the local derivative needs closer mathematical examination.
Choose a step size and interpret precision
The default step is suitable for many ordinary expressions with moderate coordinate and function-value scales, but no single h is optimal for every problem. A large step samples too far from the target and can blur local curvature into the estimate. An extremely small step makes the two sampled values nearly equal, so floating-point rounding can dominate their subtraction. Start with the default, then repeat the calculation with h multiplied or divided by ten. Stable leading digits across those runs are a stronger signal than a long decimal from one run. If x is extremely large, or the function combines very large values that nearly cancel, rescaling the variables or reformulating the expression may improve the numerical behavior. The calculator reports finite JavaScript-number arithmetic and rounds its serialized values to stable significant digits; it does not claim arbitrary precision. Use the result as a transparent numerical estimate for analysis, testing, or engineering work. API access costs $0.002 per request, while the browser implementation uses the same deterministic solver without network calls.
What you can do with it
Check a multivariable model
Estimate the local sensitivity to x while holding the model's second input fixed.
Validate an analytic derivative
Compare a hand-derived partial derivative with an independent central-difference approximation at selected points.
Explore a blackboard formula numerically
Get a local x-direction slope when deriving and simplifying a symbolic expression would add unnecessary work.
FAQ
What formula does the calculator use?
It uses [f(x+h,y)-f(x-h,y)]/(2h), with y held fixed.
What expression syntax is supported?
Use x, y, pi, e, parentheses, +, -, *, /, ^, and the functions sin, cos, tan, exp, log, sqrt, and abs.
How should I choose h?
Begin with the default and compare results using a step ten times larger and ten times smaller. Stable leading digits suggest a reliable estimate.
Is the result an exact symbolic derivative?
No. It is a floating-point numerical estimate at one point and does not return a derivative formula.
What happens outside a function's domain?
If either sampled function value or the resulting estimate is not finite, the request is rejected as invalid input.
What does an API request cost?
Each API request costs $0.002. The browser version runs the same deterministic logic locally.
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/calculus/partial-derivative-x-numeric \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"expression":"x^2*y + sin(x*y)","x":2,"y":3}'const res = await fetch("https://api.kit.forhosting.com/calculus/partial-derivative-x-numeric", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"expression": "x^2*y + sin(x*y)",
"x": 2,
"y": 3
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/calculus/partial-derivative-x-numeric",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"expression": "x^2*y + sin(x*y)",
"x": 2,
"y": 3
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/calculus/partial-derivative-x-numeric", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"expression":"x^2*y + sin(x*y)","x":2,"y":3}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"expression":"x^2*y + sin(x*y)","x":2,"y":3}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/calculus/partial-derivative-x-numeric", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"expression": "x^2*y + sin(x*y)",
"x": 2,
"y": 3
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "calculus.partial_derivative_x_numeric",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_chars | 500 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |