Skip to content

[Derivatives] Missing symbolic derivative for C++17 std::comp_ellint_1 #1673

@ayush4874

Description

@ayush4874

Description

Clad currently lacks the symbolic derivative rule for the C++17 special math function std::comp_ellint_1 (Complete Elliptic Integral of the First Kind).

Current Behavior

When differentiating code that uses this function, Clad fails to find a suitable overload and falls back to numerical differentiation. This results in the following warning during compilation:

warning: falling back to numerical differentiation for 'comp_ellint_1' since no suitable overload was found

Expected Behavior

Clad should support the analytical derivative of $K(k)$ using the standard recurrence relations involving the Second Kind Integral ($E(k)$).

The formula for the derivative is:
$$\frac{d}{dk} K(k) = \frac{E(k) - (1-k^2)K(k)}{k(1-k^2)}$$

Proposed Solution

I intend to implement the forward-mode pushforward for this function in BuiltinDerivatives.h, utilizing std::comp_ellint_2 for the $E(k)$ term.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions