2009/2/3 antonio sacchi <[email protected]>
>
> someone can help me?
> when I run this script It gave me this error
> "C:\Documents and Settings\Proprietario\D
> esktop\hessiana.py"
> 3
> -6*y + 2*x + 4*x
> -6*x + 6*y
> Traceback (most recent call last):
> File "C:\Documents and Settings\Proprietario\Desktop\hessiana.py",
> line 8, in
> <module>
> S.solve_system([a,b],[x,y])
> AttributeError: 'module' object has no attribute 'solve_system'
>
> this is hessiana.py:
>
> import sympy
> x, y = sympy.symbols('xy')
> f = x**4 + x**2 - 6*x*y + 3*y**2
>
> a = sympy.diff(f, x)
> sympy.pprint(a)
> b = sympy.diff(f, y)
> sympy.pprint(b)
>
> sympy.solve_system([a,b], [x,y])
> H = sympy.hessian(f, [x,y])
>
> M1 = sympy.Matrix([14,-6], [-6,6])
> M2 = sympy.Matrix([2,-6], [-6,6])
>
> sympy.Matrix.berkowitz_minors(M2)
> sympy.Matrix.berkowitz_minors(M1)
Hello Antonio,
the problem is that there's no function called solve_system. Maybe you want
to use sympy.solve_poly_system([a,b], x, y) instead
of sympy.solve_system([a,b], [x,y]). Here is the documentation of that
function
Solves a system of polynomial equations.
Returns all possible solutions over C[x_1, x_2, ..., x_m] of a
set F = { f_1, f_2, ..., f_n } of polynomial equations, using
Groebner basis approach. For now only zero-dimensional systems
are supported, which means F can have at most a finite number
of solutions.
The algorithm works by the fact that, supposing G is the basis
of F with respect to an elimination order (here lexicographic
order is used), G and F generate the same ideal, they have the
same set of solutions. By the elimination property, if G is a
reduced, zero-dimensional Groebner basis, then there exists an
univariate polynomial in G (in its last variable). This can be
solved by computing its roots. Substituting all computed roots
for the last (eliminated) variable in other elements of G, new
polynomial system is generated. Applying the above procedure
recursively, a finite number of solutions can be found.
The ability of finding all solutions by this procedure depends
on the root finding algorithms. If no solutions were found, it
means only that roots() failed, but the system is solvable. To
overcome this difficulty use numerical algorithms instead.
>>> from sympy import *
>>> x,y = symbols('xy')
>>> solve_poly_system([x*y - 2*y, 2*y**2 - x**2], x, y)
[(0, 0), (2, -2**(1/2)), (2, 2**(1/2))]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---