> ## 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.

# Solve Ordinary Differential Equation (ODE)

> Solve an initial value problem (IVP) for a system of ordinary differential equations: dy/dt = f(t, y) with y(t0) = y0. Supports built-in systems: exponential_decay (population decay, radioactive decay), harmonic (spring oscillations), lotka_volterra (predator-prey dynamics), and van_der_pol (nonlinear oscillator). Methods: euler (simple, first-order), rk4 (Runge-Kutta 4th order, classic), rk45 (adaptive Runge-Kutta with error control). Essential for modeling dynamics, term structure models, and time-dependent processes. [Tier: BASIC, Credits: 1]



## OpenAPI

````yaml api-specs/numerical.json post /quantlib/numerical/ode/solve
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/ode/solve:
    post:
      tags:
        - quantlib-numerical
      summary: Solve Ordinary Differential Equation (ODE)
      description: >-
        Solve an initial value problem (IVP) for a system of ordinary
        differential equations: dy/dt = f(t, y) with y(t0) = y0. Supports
        built-in systems: exponential_decay (population decay, radioactive
        decay), harmonic (spring oscillations), lotka_volterra (predator-prey
        dynamics), and van_der_pol (nonlinear oscillator). Methods: euler
        (simple, first-order), rk4 (Runge-Kutta 4th order, classic), rk45
        (adaptive Runge-Kutta with error control). Essential for modeling
        dynamics, term structure models, and time-dependent processes. [Tier:
        BASIC, Credits: 1]
      operationId: solve_ode
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - system
                - t_span
                - y0
              properties:
                system:
                  type: string
                  description: ODE system to solve
                  enum:
                    - exponential_decay
                    - harmonic
                    - lotka_volterra
                    - van_der_pol
                  example: harmonic
                t_span:
                  type: array
                  items:
                    type: number
                  minItems: 2
                  maxItems: 2
                  description: Time span [t0, tf] for integration
                  example:
                    - 0
                    - 10
                y0:
                  type: array
                  items:
                    type: number
                  description: >-
                    Initial conditions y(t0) - number of elements depends on
                    system (1 for exponential_decay, 2 for
                    harmonic/van_der_pol/lotka_volterra)
                  example:
                    - 1
                    - 0
                method:
                  type: string
                  description: Integration method
                  enum:
                    - euler
                    - rk4
                    - rk45
                  default: rk45
                  example: rk45
                h:
                  type: number
                  description: Step size (for euler and rk4 methods)
                  default: 0.01
                  example: 0.01
                params:
                  type: array
                  items:
                    type: number
                  description: >-
                    System-specific parameters: exponential_decay[k],
                    harmonic[omega], lotka_volterra[a,b,c,d], van_der_pol[mu]
                  example:
                    - 1
            example:
              system: harmonic
              t_span:
                - 0
                - 10
              y0:
                - 1
                - 0
              method: rk45
              h: 0.01
              params:
                - 1
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      system:
                        type: string
                        description: System that was solved
                        example: harmonic
                      method:
                        type: string
                        description: Method used
                        example: rk45
                      t:
                        type: array
                        items:
                          type: number
                        description: Time points where solution was computed
                        example:
                          - 0
                          - 0.1
                          - 0.2
                          - 0.3
                      'y':
                        type: array
                        items:
                          type: array
                          items:
                            type: number
                        description: >-
                          Solution values at each time point (each row is state
                          at time t[i])
                        example:
                          - - 1
                            - 0
                          - - 0.995
                            - -0.0998
                          - - 0.98
                            - -0.199
                          - - 0.955
                            - -0.296
                      n_steps:
                        type: integer
                        description: Number of time steps computed
                        example: 100
              example:
                success: true
                data:
                  system: harmonic
                  method: rk45
                  t:
                    - 0
                    - 0.1
                    - 0.2
                    - 0.3
                  'y':
                    - - 1
                      - 0
                    - - 0.995
                      - -0.0998
                    - - 0.98
                      - -0.199
                    - - 0.955
                      - -0.296
                  n_steps: 100
        '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

````