Skip to main content

A package for dual number-based automatic differentiation

Project description

rsr45-dual-autodiff-x

rsr45-dual-autodiff-x is a Python package that provides an efficient and user-friendly implementation of dual numbers for automatic differentiation. This package is optimized using Cython for improved performance.


Features

  • Dual Number Arithmetic: Supports basic operations like addition, subtraction, multiplication, and division.
  • Mathematical Functions: Includes trigonometric, exponential, logarithmic, and other common mathematical functions.
  • Automatic Differentiation: Computes derivatives automatically as a natural part of the computation.
  • Cython Optimization: Improved performance for computationally intensive tasks.

Installation

Using pip

Install the package directly from PyPI:

pip install rsr45-dual-autodiff-x

Using github

  1. Clone the repository
git clone https://gitlab.developers.cam.ac.uk/phy/data-intensive-science-mphil/assessments/c1_coursework1/rsr45.git
  1. Navigate to dual_autodiff_x
cd dual_autodiff_x
  1. Install the package
pip install e .

Usage

Importing the Package

import dual_autodiff_x as df_x
from dual_autodiff_x.dual import Dual as DualOptimized
from dual_autodiff_x.functions import sin as sin_optimized, cos as cos_optimized, log as log_optimized

Using dual_autodiff_x (Optimized Version)

x_optimized = DualOptimized(2, 1)  # Represents the dual number 2 + 1ε

Performing Operations

Using dual_autodiff_x (Optimized Version)

# Example: f(x) = log(sin(x)) + x^2 * cos(x)
f_x_optimized = log_optimized(sin_optimized(x_optimized)) + x_optimized**2 * cos_optimized(x_optimized)
print(f_x_optimized)  # Output the result and its derivative

Why Use dual_autodiff_x?

The rsr-dual-autodiff-x package is an optimized version of dual_autodiff, built with Cython for better performance. Use it when speed is a priority, especially for computationally intensive tasks.


Licence

This project is licensed under the MIT License.

Project details


Download files

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

Source Distribution

rsr45_dual_autodiff_x-0.1.15.tar.gz (80.2 kB view details)

Uploaded Source

Built Distribution

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

rsr45_dual_autodiff_x-0.1.15-cp312-cp312-macosx_10_15_x86_64.whl (151.0 kB view details)

Uploaded CPython 3.12macOS 10.15+ x86-64

File details

Details for the file rsr45_dual_autodiff_x-0.1.15.tar.gz.

File metadata

  • Download URL: rsr45_dual_autodiff_x-0.1.15.tar.gz
  • Upload date:
  • Size: 80.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for rsr45_dual_autodiff_x-0.1.15.tar.gz
Algorithm Hash digest
SHA256 f385358b7b59af761ff5e5c4e15363c8c2f793e0b05dc1520674925be8ca043c
MD5 e8129e2ce7aa29a435351655c29d4db6
BLAKE2b-256 35f4adbf97b2bb27aa1d2c4c5b0410a5e35842c3615dcb91d13f08eb3cf38904

See more details on using hashes here.

File details

Details for the file rsr45_dual_autodiff_x-0.1.15-cp312-cp312-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for rsr45_dual_autodiff_x-0.1.15-cp312-cp312-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 4a08446d9fff3454b21954c3f5c6a2ff02dcb150352ada2b03ba7f8ecc10c8f5
MD5 31a276631ba7ecc9ce11b140bb414c5d
BLAKE2b-256 12f9ba314dec6a8464af335566831615eaafa3486e20026772471f6e3bb42318

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