Package: diffcalculus
diffcalculusA Python package that implements Differential Calculus.
It is also available onGitHubInstallationPlease Note :- Requires Python Version 3.xIf 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 :-$pip3installDiffCalculus$python3-mpipinstallDiffCalculusIf 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 DiffCalculusQuick GuidePlease Read Till the EndImport the module usingimport diffcalculus as dc.diffcalculus.functions.*contains all the differentiable functions.For functions of roots of x, please usediffcalculus.functions.x(<exponent>), likediffcalculus.functions.x()creates asqrt(x)function.diffcalculus.functions.x(0.34)creates acbrt(x)function.diffcalculus.differentiate()differentiates the given function with respect to the variable x. Please Refer toDifferentiation of Functionsbelow.diffcalculus.differentiateAtPoint()differentiates the given function with respect to the variable x at the given point. Please Refer toDifferentiation of a Function at a particular pointbelow.diffcalculus.substitutesubstitutes the given value for the variable x in the given function. Please Refer to'substitute' Function Implementationbelow.diffcalculus.errors.*contains all the Exceptions, which may occur during calculation.Sample ImplementationsPlease Note :- Differentiation of all the functions happens with respect to the variable x only.1. Differentiation of Functions :-1.1. Differentiation of Simple Functionsa) Differentiate sin(x)importdiffcalculusasdcsin=dc.functions.sin()print(dc.differentiate(sin))b) Differentiate sin⁻¹(x)importdiffcalculusasdcsin_inv=dc.functions.sinInv()print(dc.differentiate(sin_inv))c) Differentiate x² + 2x + 1importdiffcalculusasdcpoly=dc.functions.polynomial([1,2],constant=1)print(dc.differentiate(poly))1.2. Differentiation of Complex Functions :-a) Differentiate sin(sqrt(x))importdiffcalculusasdcsqrt_x=dc.functions.x()func=dc.functions.sin(sqrt_x)print(dc.differentiate(func))b) Differentiate ln(3x³ + 2x² + 5x)importdiffcalculusasdcpoly=dc.functions.polynomial([3,2,5])func=dc.functions.log(poly)print(dc.differentiate(func))c) Differentiate sin(x) + cos(x)importdiffcalculusasdcsin=dc.functions.sin()cos=dc.functions.cos()func=a+bprint(dc.differentiate(func))3. Differentiation of a Function at a particular point :-a)Differentiate sin(x) at x = π/2Result Should be 0importdiffcalculusasdcfrommathimportpisin,point=dc.functions.sin(),pi/2print(dc.differentiateAtPoint(sin,point))b)Differentiate sqrt(x) at x = 4Result Should be 0.25importdiffcalculusasdcsqrt_x,point=dc.functions.x(),4print(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 0importdiffcalculusasdcfrommathimportpisin,point=dc.functions.sin(),piprint(dc.substitute(sin,point))Please Note :-For Trigonometric Functions, please pass angles inRADIANS,NOT IN DEGREES; for an accurate and precise Result.Inverse Trigonometric Functions returns angles inDEGREESandNOT IN RADIANSfor better understandability from the Output.a)The Value of 3x³ + 2x² + 5x + 10 at x = 2Result should be 52importdiffcalculusasdcfrommathimportpipoly,point=dc.functions.polynomial([3,2,5],constant=10),2print(dc.substitute(poly,point))