Special Function package
- scipy.special package contains numerous functions of mathematical physics.
- SciPy special function includes Cubic Root, Exponential, Log sum Exponential, Lambert, Permutation and Combinations, Gamma, Bessel, hypergeometric, Kelvin, beta, parabolic cylinder, Relative Error Exponential, etc..
- For one line description all of these function, type in Python console:
help(scipy.special) Output : NAME scipy.special DESCRIPTION ======================================== Special functions (:mod:`scipy.special`) ======================================== .. module:: scipy.special Nearly all of the functions below are universal functions and follow broadcasting and automatic array-looping rules. Exceptions are noted.
Cubic Root Function:
Cubic Root function finds the cube root of values.
Syntax:
scipy.special.cbrt(x)
Example:
from scipy.special import cbrt #Find cubic root of 27 & 64 using cbrt() function cb = cbrt([27, 64]) #print value of cb print(cb)
Output:
array([3., 4.])
Exponential Function:
Exponential function computes the 10**x element-wise.
Example:
from scipy.special import exp10 #define exp10 function and pass value in its exp = exp10([1,10]) print(exp)
Output:
[1.e+01 1.e+10]
Permutations & Combinations:
SciPy also gives functionality to calculate Permutations and Combinations.
Combinations – scipy.special.comb(N,k)
Example:
from scipy.special import comb #find combinations of 5, 2 values using comb(N, k) com = comb(5, 2, exact = False, repetition=True) print(com)
Output:
15.0
Permutations :
scipy.special.perm(N,k)
Example:
from scipy.special import perm #find permutation of 5, 2 using perm (N, k) function per = perm(5, 2, exact = True) print(per)
Output:
20
Log Sum Exponential Function
Log Sum Exponential computes the log of sum exponential input element.
Syntax :
scipy.special.logsumexp(x)
Bessel Function
Nth integer order calculation function
Syntax :
scipy.special.jn()