diffcalculus
A Python package that implements Differential Calculus. It is also available on GitHub
Installation
Please Note :- Requires Python Version 3.x
If there are 2 or more versions of Python installed in your system (which mostly occurs in UNIX/Linux systems) then please run any one of the commands in the BASH/ZSH Shell :-
$ pip3 install DiffCalculus
$ python3 -m pip install DiffCalculus
If there is only Python 3.x installed in your system like in Windows systems then please run any one of commands in the Command Prompt :-
>pip install DiffCalculus
>python -m pip install DiffCalculus
Quick Guide
Please Read Till the End
-
Import the module using
import diffcalculus as dc. -
diffcalculus.functions.*contains all the differentiable functions.- For functions of roots of x, please use
diffcalculus.functions.x(<exponent>), likediffcalculus.functions.x()creates a sqrt(x) function.diffcalculus.functions.x(0.34)creates a cbrt(x) function.
- For functions of roots of x, please use
-
diffcalculus.differentiate()differentiates the given function with respect to the variable x. Please Refer to Differentiation of Functions below. -
diffcalculus.differentiateAtPoint()differentiates the given function with respect to the variable x at the given point. Please Refer to Differentiation of a Function at a particular point below. -
diffcalculus.substitutesubstitutes the given value for the variable x in the given function. Please Refer to 'substitute' Function Implementation below. -
diffcalculus.errors.*contains all the Exceptions, which may occur during calculation.
Sample Implementations
Please Note :- Differentiation of all the functions happens with respect to the variable x only.
1. Differentiation of Functions :-
1.1. Differentiation of Simple Functions
a) Differentiate sin(x)
import diffcalculus as dc
sin = dc.functions.sin()
print(dc.differentiate(sin))
b) Differentiate sin⁻¹(x)
import diffcalculus as dc
sin_inv = dc.functions.sinInv()
print(dc.differentiate(sin_inv))
c) Differentiate x² + 2x + 1
import diffcalculus as dc
poly = dc.functions.polynomial([1, 2], constant=1)
print(dc.differentiate(poly))
1.2. Differentiation of Complex Functions :-
a) Differentiate sin(sqrt(x))
import diffcalculus as dc
sqrt_x = dc.functions.x()
func = dc.functions.sin(sqrt_x)
print(dc.differentiate(func))
b) Differentiate ln(3x³ + 2x² + 5x)
import diffcalculus as dc
poly = dc.functions.polynomial([3, 2, 5])
func = dc.functions.log(poly)
print(dc.differentiate(func))
c) Differentiate sin(x) + cos(x)
import diffcalculus as dc
sin = dc.functions.sin()
cos = dc.functions.cos()
func = a+b
print(dc.differentiate(func))
3. Differentiation of a Function at a particular point :-
a) Differentiate sin(x) at x = π/2 Result Should be 0
import diffcalculus as dc
from math import pi
sin, point = dc.functions.sin(), pi/2
print(dc.differentiateAtPoint(sin, point))
b) Differentiate sqrt(x) at x = 4 Result Should be 0.25
import diffcalculus as dc
sqrt_x, point = dc.functions.x(), 4
print(dc.differentiateAtPoint(sqrt_x, point))
'substitute' Function Implementation :-
Besides Differentiation of Functions and also their Differentiation at a particular point; The Package also contains a 'substitute' Function which substitutes a value for the variable x in the given function.
a) The Value of sin(x) at x = π Result should be 0
import diffcalculus as dc
from math import pi
sin, point = dc.functions.sin(), pi
print(dc.substitute(sin, point))
Please Note :-
- For Trigonometric Functions, please pass angles in RADIANS, NOT IN DEGREES; for an accurate and precise Result.
- Inverse Trigonometric Functions returns angles in DEGREES and NOT IN RADIANS for better understandability from the Output.
a) The Value of 3x³ + 2x² + 5x + 10 at x = 2 Result should be 52
import diffcalculus as dc
from math import pi
poly, point = dc.functions.polynomial([3, 2, 5], constant=10), 2
print(dc.substitute(poly, point))
Metadata
Release files for diffcalculus 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| diffcalculus-0.1.6.tar.gz | 9.4 kB | Without provenance | Details for diffcalculus-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| diffcalculus-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for diffcalculus-0.1.6-py3-none-any.whl |
Total release size: 18.3 kB
Release files / diffcalculus-0.1.6.tar.gz
| Download URL | diffcalculus-0.1.6.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8a907dbe3715e5799ca3e6765d7cf800445f323c4b3cbc6703be507dfb5bb6c5
|
|
BLAKE2b-256 checksum How to use checksums |
9d8081b4c83145ab4ce9a3538552ae123434a87651e16585173d4157e86b91cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.3.0 pkginfo/1.7.0 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.3
|
Release files / diffcalculus-0.1.6-py3-none-any.whl
| Download URL | diffcalculus-0.1.6-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
25e852b787785ecc80cc1377032d39183ddc0eb787e1e03dbc7b45be2ab7bfdb
|
|
BLAKE2b-256 checksum How to use checksums |
af71cf8569e61a4e5b3f4dfa489339851ae367cf90d477c0b489d57c7a920789
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.3.0 pkginfo/1.7.0 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.3
|
Security for diffcalculus 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.