On Wednesday 04 February 2009 00:16:14 antonio sacchi wrote:
> thank you for the answer
> I found the error "solve_system" instead of "solve"!!
>
> but now how I can pass every couple of critical point to the hessiana,
> and take determinant?
>
> this is my script now:
> import sympy
>
> x = sympy.Symbol('x')
> y = sympy.Symbol('y')
>
> f = input("scrivi la funzione :")
> print "hai scritto: ", f
>
> a = sympy.diff(f, x)
> print "La derivata prima in x:"
> sympy.pprint(a)
>
> b = sympy.diff(f, y)
> print "La derivata prima in y:"
> sympy.pprint(b)
>
> print "I punti critici sono:"
> print sympy.solve([a, b], [x, y])
>
> H = sympy.hessian(f, [x,y])
> print "La matrice Hessiana :"
> print H
> print "Il determinante dell'Hessiana:"
> print H.det()
>
> p.s.
> ciao riccardo grazie mille
> รจ la prima volta in assoluto che programmo scusami per le numerose
> richieste di aiuto!!

Ciao Antonio,
maybe you want to use subs method to substitute x and y of the Hessian matrix 
with the solution of the system a, b.

Try with something like:

cpts = sympy.solve([a,b], x, y)
print "I punti critici sono:"
print cpts

#cpts is a list of tuple [(x0,y0),(x1,y1)...(xn,yn)] so you can iterate it
#with a simple for in statement (see python manual)

for x0, y0 in cpts:
    print H.subs({x:x0, y:y0}).det()
    #oppure H.det().subs({x:x0, y:y0})

Cheers,
RIccardo


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com
To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to