Home > Back-end >  How can I put values in a derivative function created with sympy?
How can I put values in a derivative function created with sympy?

Time:10-27

import sympy 

def ham(): #if I use ham(5) it will give 0  
    x = sympy.Symbol("x")
    return x**3   x**2   1
a = sympy.diff(ham())
print(a)

How can I put the value in Derivative function ?

Example :

( x^3 x^2 1 ) -- Derivative --> ( 3x^2 2x ) -- Put value 3 --> give me 33

Thanks for support ^^

CodePudding user response:

You can add as the last line the following:

a.subs(sympy.Symbol("x"), 3)
  • Related