Skip to content

Adding NotImplemented blacklist mechanism for the Quaternions. Quaternions are the hyper complex number in more than 2 dimension . The blacklist mechnaism helps in addtion and several mathematical function without any issue .

Notifications You must be signed in to change notification settings

Rohanberiwal/Quaternions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Quaternion Blacklist Handling

This repository addresses the issue of handling operations between SymPy's Quaternion class and other unknown types by introducing a blacklist mechanism. This allows operations like addition, subtraction, multiplication, and division to gracefully handle cases where the operand type is not supported.This repository officially clears the patch #26355 of Sympy's issue list.

Overview

The main goal is to modify the behavior of the Quaternion class without changing its core logic. This is achieved by introducing a blacklist that checks the type of the operand before performing any operations. If the type is in the blacklist, the operation returns NotImplemented, allowing the other operand's right-hand operation (__radd__, __rsub__, etc.) to handle it.

Features

  • Blacklist Handling: Introduces a blacklist to handle unsupported operand types.
  • Seamless Integration: Modifies the existing Quaternion class with minimal changes.
  • Flexible: Allows easy addition of new types to the blacklist.

Implementation

The modifications are done through a patch file (dieter.py) that redefines the core arithmetic operations for the Quaternion class.

Files

  • dieter.py: Contains the modified arithmetic operations for the Quaternion class.
  • example_usage.py: Provides examples of how to use the modified Quaternion class with the blacklist mechanism.

Usage

Prerequisites

Ensure you have SymPy installed:

pip install sympy

About

Adding NotImplemented blacklist mechanism for the Quaternions. Quaternions are the hyper complex number in more than 2 dimension . The blacklist mechnaism helps in addtion and several mathematical function without any issue .

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages