def rabbit(t):
num = r0*(e**(rb*t))+ fox(t-1)*0.3
return num
def fox(t):
num = f0*(e**(rf*t))+ rabbit(t-1)*0.15
return num
So I am trying to graph the above 2 functions in matplotlib As you can see both functions are dependent on one another rabbit gets eaten by fox and if fox have more rabbit to eat it with grow faster
Problem is, this will throw a recursion depth error(clearly)
RecursionError: maximum recursion depth exceeded
However if I add basecase and recursive case
def rabbit(t):
if(t>0):
num = r0*(e**(rb*t))+ fox(t-1)*0.3
else:
num = r0
return num
def fox(t):
if(t>0):
num = f0*(e**(rf*t))+ rabbit(t-1)*0.15
else:
num = f0
return num
to this I get this error
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()