Documentation sections
Solve for a target
Finds the value of one calculator input that brings one of its outputs to a target (the trace width that gives 50 Ω, the gap that gives a target differential impedance) and returns it with the forward result at exactly that value. One metered call replaces the forward calls a client would otherwise spend searching by hand.
How the search runs
The search runs over solveFor's stated bounds, narrowed by range where one is given; an input with no stated bound needs range. Where grid is given, the returned value is rounded to the nearest grid multiple inside the range and unrounded carries the exact solution; without a grid, value and unrounded are the same number. Either way, result (exactly what /calculate returns for those inputs, provenance included) is the forward calculator run at exactly the returned value, so what a client displays is a real forward computation, never the solver's own estimate.
Request body
| Field | Description |
|---|---|
| slugrequiredstring | The calculator. |
| inputsrequiredobject of numbers | Every input except solveFor. A value given for solveFor is only the search's start point, used to break a tie between more than one solution. |
| solveForrequiredstring | A declared numeric input of the calculator. |
| target.outputrequiredstring | An output key the calculator returns. |
| target.valuerequirednumber | The value that output should reach. |
| gridnumber | A positive manufacturing grid; the returned value is rounded to its nearest multiple inside the range. |
| range[number, number] | Narrows solveFor's stated bounds; required when it states none. |
Response
| Field | Description |
|---|---|
| valuenumber | The solved value, rounded to grid when one was given. |
| unroundednumber | The exact solution, before grid rounding. |
| reachedboolean | Whether the target was reached; false still carries the nearest value found, not a guess. |
| evaluationsinteger | How many forward evaluations the search used. |
| warningsstring[] | The solve's own findings: another solution in the range, or a target not reached. |
| resultobject | Exactly what /calculate returns for the inputs with solveFor set to value: values, warnings, errors and provenance. |
| slug, solveFor, target, gridecho | The request's fields, as given; grid is null when none was. |
Cost and ties
Cost
/calculate after every check below, and given back if the service then fails. A target the search cannot reach still succeeds and is still charged, with reached: false and the nearest value found: the caller asked for something the service delivered.More than one solution
solveFor, else the calculator's default) and adds a warning naming the other one.Refusals
A request that cannot be solved is refused before anything is charged, and param names the field at fault:
| Status | When |
|---|---|
| 404 | The calculator slug does not exist. |
| 400 | solveFor is not one of the calculator's declared numeric inputs (param: solveFor, with allowed). |
| 400 | target.output is not one of the calculator's outputs (param: target.output, with allowed). |
| 400 | grid is given and is not a finite, positive number, or has no multiple in the range. |
| 400 | Any given value (an input, target.value or a range bound) is not finite. |
| 400 | solveFor has no stated bound and the body gives no range, or the given range lies outside the stated bounds or is empty. |
| 400 | A fixed input exceeds a limit the calculator enforces on its own running time, as for /calculate. |