When I try to run your code:
In [51]: integrate.quad(f,0,y)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-51-3605c48e48f5> in <module>
----> 1 integrate.quad(f,0,y)
/usr/local/lib/python3.8/dist-packages/scipy/integrate/quadpack.py in quad(func, a, b, args, full_output, epsabs, epsrel, limit, points, weight, wvar, wopts, maxp1, limlst)
346
347 # check the limits of integration: \int_a^b, expect a < b
--> 348 flip, a, b = b < a, min(a, b), max(a, b)
349
350 if weight is None:
/usr/local/lib/python3.8/dist-packages/sympy/core/relational.py in __bool__(self)
396
397 def __bool__(self):
--> 398 raise TypeError("cannot determine truth value of Relational")
399
400 def _eval_as_set(self):
TypeError: cannot determine truth value of Relational
The numeric integrator is trying to verify that the integration bounds are in the right numeric order. But one bound is a symbol
:
In [52]: 0<y
Out[52]: y > 0
In [53]: bool(0<y)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-53-b72cf53c1f50> in <module>
----> 1 bool(0<y)
/usr/local/lib/python3.8/dist-packages/sympy/core/relational.py in __bool__(self)
396
397 def __bool__(self):
--> 398 raise TypeError("cannot determine truth value of Relational")
399
400 def _eval_as_set(self):
TypeError: cannot determine truth value of Relational
Note that f
evaluated at y
is symbolic. quad
is a numeric integrator!
In [54]: f(y)
Out[54]:
k₁⋅t_d
⎛ -y ⎞
⎜ ─── ⎟
⎜ t_d ⎟
⎜C₀⋅ℯ + k₂⎟
⎜────────────⎟
⎝ C₀ + k₂ ⎠
but even at a numeric value:
In [55]: f(1)
Out[55]:
k₁⋅t_d
⎛ -1 ⎞
⎜ ─── ⎟
⎜ t_d ⎟
⎜C₀⋅ℯ + k₂⎟
⎜────────────⎟
⎝ C₀ + k₂ ⎠