> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fincept.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Compute Numerical Gradient

> Calculate the gradient (vector of partial derivatives) of a multi-variable function at a given point. The gradient points in the direction of steepest ascent and is essential for optimization algorithms, sensitivity analysis, and machine learning applications. Uses finite differences to approximate each partial derivative. [Tier: BASIC, Credits: 1]



## OpenAPI

````yaml api-specs/numerical.json post /quantlib/numerical/differentiation/gradient
openapi: 3.1.0
info:
  title: FinceptQuantLib API - Numerical
  description: >-
    Numerical module endpoints for FinceptQuantLib API. The Numerical module
    (Basic Tier, 1 credit per request) provides comprehensive numerical methods
    including finite difference differentiation, Fast Fourier Transform (FFT),
    numerical integration (quadrature and Monte Carlo), interpolation methods
    (linear, cubic, spline), linear algebra operations (matrix decomposition,
    solving systems), ODE solvers, root finding algorithms, optimization
    methods, and nonlinear least squares fitting. Essential for quantitative
    analysis, scientific computing, and numerical model implementation.
  version: 3.0.0
  contact:
    name: Fincept API Support
    url: https://fincept.in
servers:
  - url: https://api.fincept.in
    description: Fincept API Production Server
security:
  - APIKeyHeader: []
tags:
  - name: quantlib-numerical
    description: >-
      Numerical methods including differentiation, FFT, integration,
      interpolation, linear algebra, ODE solvers, root finding, and optimization
    x-displayName: Numerical
paths:
  /quantlib/numerical/differentiation/gradient:
    post:
      tags:
        - quantlib-numerical
      summary: Compute Numerical Gradient
      description: >-
        Calculate the gradient (vector of partial derivatives) of a
        multi-variable function at a given point. The gradient points in the
        direction of steepest ascent and is essential for optimization
        algorithms, sensitivity analysis, and machine learning applications.
        Uses finite differences to approximate each partial derivative. [Tier:
        BASIC, Credits: 1]
      operationId: finite_diff_gradient
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - func_name
                - x
              properties:
                func_name:
                  type: string
                  description: Built-in multi-variable function name
                  enum:
                    - rosenbrock
                    - sphere
                    - rastrigin
                    - quadratic
                  example: rosenbrock
                x:
                  type: array
                  items:
                    type: number
                  description: >-
                    Point at which to evaluate the gradient (vector of
                    coordinates)
                  example:
                    - 1
                    - 1
                h:
                  type: number
                  description: Step size for finite difference
                  default: 1.e-7
                  example: 1.e-7
                method:
                  type: string
                  description: Finite difference method
                  enum:
                    - forward
                    - central
                  default: forward
                  example: forward
            example:
              func_name: rosenbrock
              x:
                - 1
                - 1
              h: 1.e-7
              method: forward
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      function:
                        type: string
                        example: rosenbrock
                      x:
                        type: array
                        items:
                          type: number
                        example:
                          - 1
                          - 1
                      gradient:
                        type: array
                        items:
                          type: number
                        description: Vector of partial derivatives
                        example:
                          - 0
                          - 0
              example:
                success: true
                data:
                  function: rosenbrock
                  x:
                    - 1
                    - 1
                  gradient:
                    - 0
                    - 0
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '402':
          $ref: '#/components/responses/InsufficientTierError'
        '422':
          description: Validation Error
      security:
        - APIKeyHeader: []
components:
  responses:
    UnauthorizedError:
      description: Authentication information is missing or invalid
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
                example: Invalid API key
    InsufficientTierError:
      description: API tier insufficient for this endpoint
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
                example: Endpoint requires Basic tier or higher
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        API key for authentication. Get your key at
        https://api.fincept.in/auth/register

````