I have in my code a function, let's say:
def test_func(x):
return(3*x**2)
I want my code to calculate the derivative der_test_func
of test_func
, so that der_test_func
is a function, too. Means, I should be able to do
>>> print(der_test_func(5))
>>> 30
Or I should be able to put it inside another function so that it gets handled reasonably, e.g.
def func2(x):
y = 10*der_test_func(x)
return(y)
>>> print(func2(5))
>>> 300
I found out that sympy
does derivations, which looks at first sight great, but it returns expressions, whereas I want somehow to have a function, so that I give input to it and get output. Any suggestions or workarounds on how to create der_test_func
? Tnx