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

# Calculate Thermodynamic Free Energy

> Calculates various forms of thermodynamic free energy: Gibbs free energy (G), Helmholtz free energy (F), or enthalpy (H). Free energy represents the maximum useful work extractable from a system and is fundamental in thermodynamics. In finance, free energy concepts apply to portfolio efficiency, market stability, and equilibrium analysis.

**Use Cases:**
- Assess portfolio efficiency (maximum utility extraction)
- Market equilibrium and stability analysis
- Energy-based risk models
- Thermodynamic analogies in market microstructure
- Path-dependent work extraction in trading

**Formulas:**
- Gibbs: G = U + PV - TS (constant T,P)
- Helmholtz: F = U - TS (constant T,V)
- Enthalpy: H = U + PV

**Credits:** 5 credits per request (Pro Tier) [Tier: ENTERPRISE, Credits: 10]



## OpenAPI

````yaml api-specs/physics.json post /quantlib/physics/thermodynamics/free-energy
openapi: 3.1.0
info:
  title: FinceptQuantLib API - Physics Module
  description: >-
    Physics and Information Theory module for FinceptQuantLib API. Includes
    Shannon/Renyi/Tsallis entropy, KL/JS divergence, mutual information,
    transfer entropy, Fisher information, Boltzmann distribution, Ising model,
    maximum entropy, thermodynamics (free energy, Carnot cycle, van der Waals
    equation), and Maxwell relations. **Pro Tier required. 5 credits per
    request.**
  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-physics
    description: Physics and Information Theory module for FinceptQuantLib API
    x-displayName: Physics
paths:
  /quantlib/physics/thermodynamics/free-energy:
    post:
      tags:
        - quantlib-physics
      summary: Calculate Thermodynamic Free Energy
      description: >-
        Calculates various forms of thermodynamic free energy: Gibbs free energy
        (G), Helmholtz free energy (F), or enthalpy (H). Free energy represents
        the maximum useful work extractable from a system and is fundamental in
        thermodynamics. In finance, free energy concepts apply to portfolio
        efficiency, market stability, and equilibrium analysis.


        **Use Cases:**

        - Assess portfolio efficiency (maximum utility extraction)

        - Market equilibrium and stability analysis

        - Energy-based risk models

        - Thermodynamic analogies in market microstructure

        - Path-dependent work extraction in trading


        **Formulas:**

        - Gibbs: G = U + PV - TS (constant T,P)

        - Helmholtz: F = U - TS (constant T,V)

        - Enthalpy: H = U + PV


        **Credits:** 5 credits per request (Pro Tier) [Tier: ENTERPRISE,
        Credits: 10]
      operationId: free_energy
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - internal_energy
                - temperature
                - entropy
              properties:
                internal_energy:
                  type: number
                  description: Internal energy U
                  example: 1000
                pressure:
                  type: number
                  description: Pressure P (required for Gibbs and enthalpy)
                  default: 0
                  example: 101325
                volume:
                  type: number
                  description: Volume V (required for Gibbs and enthalpy)
                  default: 0
                  example: 0.0224
                temperature:
                  type: number
                  description: Temperature T
                  example: 300
                entropy:
                  type: number
                  description: Entropy S
                  example: 2.5
                type:
                  type: string
                  enum:
                    - gibbs
                    - helmholtz
                    - enthalpy
                  description: Type of free energy to calculate
                  default: gibbs
                  example: helmholtz
            examples:
              helmholtz:
                summary: Helmholtz free energy
                value:
                  internal_energy: 1000
                  temperature: 300
                  entropy: 2.5
                  type: helmholtz
              gibbs:
                summary: Gibbs free energy
                value:
                  internal_energy: 1000
                  pressure: 101325
                  volume: 0.0224
                  temperature: 300
                  entropy: 2.5
                  type: gibbs
      responses:
        '200':
          description: Free energy calculated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      gibbs_free_energy:
                        type: number
                        description: Gibbs free energy (if type='gibbs')
                        example: 2520.68
                      helmholtz_free_energy:
                        type: number
                        description: Helmholtz free energy (if type='helmholtz')
                        example: 250
                      enthalpy:
                        type: number
                        description: Enthalpy (if type='enthalpy')
                        example: 3270.68
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '402':
          $ref: '#/components/responses/InsufficientCreditsError'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  responses:
    UnauthorizedError:
      description: Authentication information is missing or invalid
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
                example: Invalid API key
    InsufficientCreditsError:
      description: Insufficient API credits
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
                example: Insufficient credits. This endpoint requires 5 credits.
    ValidationError:
      description: Request validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: array
                items:
                  type: object
                  properties:
                    loc:
                      type: array
                      items:
                        type: string
                    msg:
                      type: string
                    type:
                      type: string
  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

````