Ask Your Question

TypeError: no canonical coercion from <type 'NoneType'> to Callable function ring with argument N

asked 2016-11-14 22:04:52 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

def eqDtm(eqn, nBelow, nAbove):#eqDtm is shortened for equilibrium determiner.
                eqn = f(N)
                if f(nBelow) >0 and f(nAbove) < 0:
                    print "stable"
                elif f(nBelow) < 0 and f(nAbove) > 0:
                    print "unstable"
                elif f(nBelow) > 0 and f(nAbove) > 0:
                    print "semistable"
                elif f(nBelow) < 0 and f(nAbove) < 0:
                    print "semistable"
                    print "Not an equilibrium point"

from random import uniform
def randomGen(num,num2):
    uniform(num, num2)

r= 0.1
A= 5.
K= 100
eqn = (r*N*(1-(N/K))*((N/A)-1))
Eq = [0, 5, 100]
for value in Eq:
    if value == max(Eq):
        eqDtm(eqn, randomGen(Eq[1],Eq[2]),randomGen(Eq[2],Eq[2]+1))
        print "maximum equilibirum point"
    elif value == min(Eq):
        eqDtm(eqn, randomGen(Eq[0]-1, Eq[0]),randomGen(Eq[0],Eq[1]))
        print "minimum equilibirum point"
        eqDtm(eqn, randomGen(Eq[0],Eq[1]),randomGen(Eq[1],Eq[2]))
        print "neither"

I don't understand the error that's specified in the title. Can anyone explain this? Thank you.

edit retag flag offensive close merge delete


To display blocks of code, either indent them with 4 spaces, or select the corresponding lines and click the "code" button (the icon with '101 010').

Can you edit your question to do that?

slelievre gravatar imageslelievre ( 2016-11-15 08:04:25 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-11-15 09:58:22 -0500

ndomes gravatar image

Your function randomGen returns None (there is no return statement).

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2016-11-14 22:04:52 -0500

Seen: 31 times

Last updated: Nov 15 '16