votes up 1

alpha must be > -1

Package:
scipy
github stars 8546
Exception Class:
ValueError

Raise code

""" 

    See Also
    --------
    laguerre : Laguerre polynomial.

    """
    if alpha <= -1:
        raise ValueError("alpha must be > -1")
    if n < 0:
        raise ValueError("n must be nonnegative.")

    if n == 0:
        n1 = n + 1
    else:
        n1 = n
😲 Agile task management is now easier than calling a taxi. #Tracklify
🙏 Scream for help to Ukraine
Today, 2nd July 2022, Russia continues bombing and firing Ukraine. Don't trust Russia, they are bombing us and brazenly lying in same time they are not doing this 😠, civilians and children are dying too! We are screaming and asking exactly you to help us, we want to survive, our families, children, older ones.
Please spread the information, and ask your governemnt to stop Russia by any means. We promise to work extrahard after survival to make the world safer place for all.

Ways to fix

votes up 2 votes down

As the error message clearly says it, the parameter alpha should be greater than -1.

How to reproduce it:

  • Install scipy then run the sample code given below.
$ pipenv install scipy

$ pipenv shell

from scipy import spacial
a1 = special.genlaguerre(11,-1)
print(a1)

---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-2-27b772b67165> in <module>()  1 from scipy import special ----> 2 a1 = special.genlaguerre(11,-1)  3 print(a1) 
/usr/local/lib/python3.7/dist-packages/scipy/special/orthogonal.py in genlaguerre(n, alpha, monic)  558 """  559 if alpha <= -1: --> 560 raise ValueError("alpha must be > -1")  561 if n < 0:  562 raise ValueError("n must be nonnegative.") 
ValueError: alpha must be > -1

Fixed:

from scipy import special
a1 = special.genlaguerre(11,1)
print(a1)
Sep 19, 2021 kellemnegasi answer
kellemnegasi 30.0k

Add a possible fix

Please authorize to post fix