Skip to main content

Specular differentiation in normed vector spaces and its applications

Project description

Specular Differentiation

PyPI version Python 3.10 License

This repository contains the Python package specular which implements Specular differentiation, a generalization of classical differentiation.

A specular derivative can be understood as the average of the inclination angles of the right and left derivatives. In contrast, a symmetric derivative is the average of the right and left derivatives. Their difference is illustrated as in the following figure.

specular-derivative-animation

Also, specular includes the following applications:

The package specular mainly follows the definitions, notations, and results presented in [1] and [2].

Installation

Dependencies

specular-differentiation requires:

  • Python 3.10 or later
  • NumPy 2.2.5 or later

User installation

You can install the released version directly from PyPI:

pip install specular-differentiation

Quick start

The following simple example calculates the specular derivative of the ReLU function $f(x) = max(0, x)$ at the origin.

>>> import specular
>>> 
>>> ReLU = lambda x: max(x, 0)
>>> specular.derivative(ReLU, x=0)
0.41421356237309515

Tutorial

Detailed usage examples can be found in the tutorial document.

Applications

Specular differentiation is defined in normed vector spaces, allowing for applications in higher-dimensional Euclidean spaces. Two applications are provided in this repository.

Nonsmooth convex optimization

In [2], the specular gradient method is introduced for optimizing nonsmooth convex objective functions.

Initial value problems for ordinary differential equations

In [1], the specular Euler scheme of Type 5 is introduced for solving ODEs numerically, yielding more accurate numerical solutions than classical schemes: the explicit and implicit Euler schemes and the Crank-Nicolson scheme.

ODE-numerical-example

LaTeX notation

To use the symbol for specular differentiation in your LaTeX document, please refer to the following instructions.

Setup

Add the following code to your LaTeX preamble (before \begin{document}):

% Required packages
\usepackage{graphicx}
\usepackage{bm}

% Definition of Specular Differentiation symbol
\newcommand\sd[1][.5]{\mathbin{\vcenter{\hbox{\scalebox{#1}{\,$\bm{\wedge}$}}}}}

Usage examples

Use the symbol in your document (after \begin{document}):

% A specular derivative in the one-dimensional Euclidean space
$f^{\sd}(x)$

% A specular directional derivative in normed vector spaces
$\partial^{\sd}_v f(x)$

References

[1] K. Jung. Nonlinear numerical schemes using specular differentiation for initial value problems of first-order ordinary differential equations. arXiv preprint arXiv:??, 2025.

[2] K. Jung. Specular differentiation in normed vector spaces and its applications to nonsmooth convex optimization. arXiv preprint arXiv:??, 2025.

[3] K. Jung and J. Oh. The specular derivative. arXiv preprint arXiv:2210.06062, 2022.

[4] K. Jung and J. Oh. The wave equation with specular derivatives. arXiv preprint arXiv:2210.06933, 2022.

[5] K. Jung and J. Oh. Nonsmooth convex optimization using the specular gradient method with root-linear convergence. arXiv preprint arXiv:2210.06933, 2024.

Project details


Release history Release notifications | RSS feed

This version

0.6.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

specular_differentiation-0.6.0.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

specular_differentiation-0.6.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file specular_differentiation-0.6.0.tar.gz.

File metadata

File hashes

Hashes for specular_differentiation-0.6.0.tar.gz
Algorithm Hash digest
SHA256 0a0d2609d996821db365aac72df81db2664665c2dbf3eb862b34960c64f90959
MD5 1231c8bccc8c42c15c2a38cb1549ce02
BLAKE2b-256 2354637f661d6882ecee1225052719324f6fa9edca458668f7db469b7a8c84d1

See more details on using hashes here.

File details

Details for the file specular_differentiation-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for specular_differentiation-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ef27f353122de4b38def4ebc0c371af50171e343c93b9bc22c5c9f045f89ff1
MD5 810122409cc041a8d8f9b5d81bc36156
BLAKE2b-256 9b99236ce53a59c96667c3648ff627d91281b88cd01c4379a025931ecb28d9e0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page