Skip to content

okkomakkonen/dmath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dmath

dmath is a Python package capable of dealing with dual numbers and automatic differentiation.

Installation

Install this package by running the setup file in a terminal

$ pip install .

or by installing from git

$ pip install git+https://github.com/okkomakkonen/dmath.git

Development

Using pipenv install all of the dev dependencies

$ pipenv install --dev

The tests can be run with

$ pipenv shell
$ coverage run -m pytest tests/
$ coverage report -m --omit=*/site-packages/*

Usage

>>> from dmath import grad, sin, cos
>>> f = lambda x: 3*x**2 + 1*x + 4
>>> grad(f)(3)
19.0
>>> g = lambda x, y: sin(x) * cos(y)
>>> grad(g)(2, 3)
(0.411982245665683, -0.12832006020245673)

Todo

  • numpy support
  • C version

About

Python module for dual numbers and derivatives

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages