Minimization with symbolic calculations in a function
I am a new Sage user, and I am unable to get the constrained minimization function working if I include a symbolic differentiation.
The code below works fine
c=var('c')
y=5*c^3
def f(c):
#z=dy^2
w=5*(c-10)^3
z=w^2
return z
minimize_constrained(f, [(-10,10)],[9])
This code gives an error
c=var('c')
y=5*c^3
def f(c):
dy=y.diff(c)
w=5*(c-10)^3
z=dy+w
return z
minimize_constrained(f, [(-10,10)],[9])
Any assistance would be greatly appreciated.