A Scientific calculator
Project description
Scientific Python Calculator
Scientific Python Calculator (scipy_calculator) is a library for doing mathematics computation. It works similar to a calculator.
:raised_hands: This is my first python package. It will be improved over time. Feel free to contribute to this beautiful work of art.
Installation
:warning: scipy_calculator is only tested with python 3.
Installation via PYPI
$ pip install scipy-calculator
Installation via Github this is for the stable released version
$ pip install git+https://github.com/komus/scipy_calculator
scipy_calculator uses multipledispatch dependency and pytest for automated test
Usage
The calculator can be used for basic mathematical computation. The calculator has a memory that caches the last result until it is reset. The cached result is used in the next computation if not reset.
The reset
is used to clear the cache
Examples will be shown below
Sample Code
from calculator import Calculator
my_cal = Calculator()
Addition
>>> my_cal.add(10)
10
Subtraction
subtract
>>> my_cal.subtract(5)
5
because the memory was not reset, 5
was subtracted from previous value 10
Division
For divide
, zero division returns None
and description
>>> cal.divide(2)
2.5
>>> cal.divide(0)
number cannot be zero => float division by zero
None
>>> cal.memory_val
2.5
Multiply
>>> cal.multiply(2.5)
6.25
Modulo
>>> cal.modulo(5)
1.25
Square root
>>> cal.sqrt(16)
4
Reset
>>> cal.reset()
>>> cal.memory_val
0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file scipy_calculator-1.0.0.tar.gz
.
File metadata
- Download URL: scipy_calculator-1.0.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0aaa457589b25a588483d6f06d30feb485cb67c35a9e0dca28dd2665a3efea04 |
|
MD5 | 4f596325ebda4bd29d765cdda478cb03 |
|
BLAKE2b-256 | ec5aea17612cdb388d2872cfa0460b68c4a79bafc1e25a74e81a7fa19df6f337 |
File details
Details for the file scipy_calculator-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: scipy_calculator-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e393699e27ad356a2adf73b1ecfdb8153b9b8a18a20e7be8a1274b20b94d5f71 |
|
MD5 | 7f06a791bb68feb4cecf61f23d46c652 |
|
BLAKE2b-256 | 6798b837bf5a998ebe44d8f73e06c71a1e8733df7143eaeae3055a5c22f81caf |