Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/FabianeloV/Metodo-simplex/llms.txt

Use this file to discover all available pages before exploring further.

The /api/v1/bisection/solve endpoint finds the optimum of a single-variable polynomial function on a specified interval [a, b]. Rather than minimising or maximising f(x) directly, the solver applies the Bisection method to the first derivative f′(x) to locate the root where f′(x) = 0. The nature of the critical point (maximum, minimum, or inflection) is then verified with the second derivative.

Request

POST /api/v1/bisection/solve
Content-Type: application/json
coefficients
list[float]
required
Polynomial coefficients listed from highest to lowest degree. Must contain between 1 and 11 elements (degree 0 through 10). The array must not be all-zero.Examples:
  • [-1, 4, 0]-x² + 4x + 0
  • [1, -3, 2]x² - 3x + 2
  • [2, 0, -8, 0]2x³ - 8x
goal
string
required
Optimisation direction. Accepted values: "max" or "min".
a
float
required
Left endpoint of the search interval. Must be strictly less than b.
b
float
required
Right endpoint of the search interval. Must be strictly greater than a.
tolerance
float
default:"1e-6"
Convergence tolerance. The algorithm stops when the interval width falls below this value. Must be greater than 0 and at most 1.0.
max_iterations
integer
default:"100"
Maximum number of bisection steps. Accepted range: 1–500.

Response

A successful call returns a BisectionResponse object.
status
string
Always "optimal" for a completed bisection run (convergence or max_iterations reached).
optimal_x
float | null
The x-coordinate of the located critical point. null if no root of f′(x) was found in [a, b].
optimal_value
float | null
The function value f(optimal_x). null if no critical point was found.
nature
string | null
Classification of the critical point: "maximum", "minimum", or "inflection point". null if no critical point was found.
goal_satisfied
boolean
true when the nature of the found point matches the requested goal (e.g. a minimum was found when goal is "min").
iterations_count
integer
Actual number of bisection iterations performed before convergence.
iterations
list[BisectionIteration]
Step-by-step iteration table, one entry per bisection step.
function_str
string
Human-readable string representation of f(x) (e.g. "-x**2 + 4*x").
derivative_str
string
Human-readable string representation of f′(x) (e.g. "-2*x + 4").
message
string
Human-readable summary of the result.

Example

Maximize f(x) = −x² + 4x on the interval [0, 4]. Coefficients from highest to lowest degree: [-1, 4, 0] (i.e. −1·x² + 4·x + 0).
curl -X POST https://api.example.com/api/v1/bisection/solve \
  -H "Content-Type: application/json" \
  -d '{
    "coefficients": [-1, 4, 0],
    "goal": "max",
    "a": 0,
    "b": 4,
    "tolerance": 1e-6,
    "max_iterations": 100
  }'
{
  "status": "optimal",
  "optimal_x": 2.0,
  "optimal_value": 4.0,
  "nature": "maximum",
  "goal_satisfied": true,
  "iterations_count": 22,
  "iterations": [
    {
      "iteration": 1,
      "a": 0.0,
      "b": 4.0,
      "midpoint": 2.0,
      "f_mid": 4.0,
      "df_mid": 0.0,
      "interval_width": 4.0
    },
    {
      "iteration": 2,
      "a": 0.0,
      "b": 2.0,
      "midpoint": 1.0,
      "f_mid": 3.0,
      "df_mid": 2.0,
      "interval_width": 2.0
    }
  ],
  "function_str": "-x**2 + 4*x",
  "derivative_str": "-2*x + 4",
  "message": "Maximum found at x = 2.0 with f(x) = 4.0"
}
The solver applies the Bisection method to f′(x), not to f(x) itself. Make sure the target critical point lies inside [a, b] and that f′(a) and f′(b) have opposite signs so the algorithm can bracket the root.
If f′(a) and f′(b) have the same sign, the Bisection method cannot find a root in [a, b]. The endpoint returns HTTP 422 Unprocessable Entity in that case. Widen the interval or choose a different bracket.

Health Check

GET /api/v1/bisection/health Returns a liveness confirmation for the Bisection Optimization service.
curl https://api.example.com/api/v1/bisection/health
{
  "status": "ok",
  "service": "bisection-optimizer-api"
}

Build docs developers (and LLMs) love