Dual Number

This module adds support for Dual Numbers and Forward Mode Auto Differentiation.

class einsteinpy.utils.dual.DualNumber(val, deriv)[source]

Bases: object

Numbers of the form, \(a + b\epsilon\), where \(\epsilon^2 = 0\) and \(\epsilon \ne 0\). Their addition and multiplication properties make them suitable for Automatic Differentiation (AD). EinsteinPy uses AD for solving Geodesics in arbitrary spacetimes. This module is based on [1].



  • val (float) – Value

  • deriv (float) – Directional Derivative