Minimization with symbolic calculations in a function
asked 2012-04-06 18:15:58 -0500
This post is a wiki. Anyone with karma >750 is welcome to improve it.
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)],)
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)],)
Any assistance would be greatly appreciated.