Skip to main content
POST
/
quantlib
/
numerical
/
roots
/
find-1d
Find Root of Scalar Function
curl --request POST \
  --url https://finceptbackend.share.zrok.io/quantlib/numerical/roots/find-1d \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "func_name": "x2_minus_4",
  "a": 1,
  "b": 3,
  "method": "brent",
  "tol": 1e-12
}
'
{
  "success": true,
  "data": {
    "root": 2,
    "iterations": 8,
    "converged": true,
    "function_value": 1.3e-15
  }
}

Authorizations

X-API-Key
string
header
required

API key for authentication. Get your key at https://finceptbackend.share.zrok.io/auth/register

Body

application/json
func_name
enum<string>
required

Built-in function or 'custom_poly' for polynomial

Available options:
sin,
cos,
exp_minus_2,
x2_minus_4,
custom_poly
Example:

"x2_minus_4"

a
number
required

Lower bound of search interval

Example:

1

b
number
required

Upper bound of search interval (f(a) and f(b) should have opposite signs)

Example:

3

method
enum<string>
default:brent

Root-finding method

Available options:
bisect,
brent,
ridder,
secant
Example:

"brent"

tol
number
default:1e-12

Convergence tolerance (smaller = more accurate)

Example:

1e-12

poly_coeffs
number[]

Polynomial coefficients [a0, a1, a2, ...] for a0 + a1x + a2x^2 + ... (only for custom_poly)

Example:
[-4, 0, 1]

Response

Successful Response

success
boolean
Example:

true

data
object