Skip to content

An exercise in using Python's magic dunder methods to create a simple Complex Number library.

License

Notifications You must be signed in to change notification settings

mikailmm/complex-number

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Complex Number Library

This project is an exercise of using Python's magic dunder methods to create a simple Complex Number library. Relations and operations that are implemented are:

  • Addition and subtraction
  • Multiplication
  • Exponentiation to integer
  • Reciprocal and division
  • Equality

Example

from complex_number import Complex
a = Complex(1, 2)
b = Complex(5, 3)
print(f'{a=} {b=}') # a=1+2i b=5+3i
print(f'{a+b=}') # a+b=6+5i

Further examples can be seen on notebook.ipynb

Source: https://en.wikipedia.org/wiki/Complex_number

About

An exercise in using Python's magic dunder methods to create a simple Complex Number library.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published