0
0
SciPydata~10 mins

Special functions overview (scipy.special) - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the special module from scipy.

SciPy
from scipy import [1]
Drag options to blanks, or click blank then click option'
Aoptimize
Bintegrate
Cspecial
Dstats
Attempts:
3 left
💡 Hint
Common Mistakes
Importing the wrong scipy submodule like stats or optimize.
Forgetting to import scipy.special before using its functions.
2fill in blank
medium

Complete the code to calculate the gamma function of 5 using scipy.special.

SciPy
result = special.[1](5)
Drag options to blanks, or click blank then click option'
Aerf
Bgamma
Cbeta
Dzeta
Attempts:
3 left
💡 Hint
Common Mistakes
Using beta instead of gamma.
Confusing erf (error function) with gamma.
3fill in blank
hard

Fix the error in the code to compute the error function of 1.0.

SciPy
value = special.[1](1.0)
Drag options to blanks, or click blank then click option'
Aerf
Bgamma
Cexp
Dlog
Attempts:
3 left
💡 Hint
Common Mistakes
Using gamma or exp instead of erf.
Trying to use math module functions instead of scipy.special.
4fill in blank
hard

Fill both blanks to create a dictionary of factorial values for numbers 1 to 5 using scipy.special.factorial.

SciPy
factorials = {n: special.[1](n, [2]=False) for n in range(1, 6)}
Drag options to blanks, or click blank then click option'
Afactorial
Bexact
Cgamma
Dapproximate
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'gamma' instead of 'factorial'.
Using a wrong parameter name like 'approximate'.
5fill in blank
hard

Fill all three blanks to create a dictionary of squares of the Bessel function of the first kind for orders 0 to 2 at x=1.0.

SciPy
bessel_squares = {n: special.jv([1], [2])**2 for n in range([3])}
Drag options to blanks, or click blank then click option'
An
B1.0
C3
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using a fixed order instead of 'n' in the loop.
Using wrong range length or x value.