sympy_matrix_eigenvects
Compute eigenvectors of a given matrix using symbolic mathematics. Obtain the eigenvalues and corresponding eigenvectors for algebraic analysis.
Instructions
Compute eigenvectors of a matrix.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| matrix | Yes | Matrix string |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/mcp_sympy/tools.py:717-731 (handler)The main handler function for 'sympy_matrix_eigenvects'. It converts the input string to a SymPy matrix using _sympify, then calls .eigenvects() on it and returns the result as a string.
def sympy_matrix_eigenvects(matrix: str) -> str: """Compute eigenvectors of a matrix. Args: matrix: Matrix string Returns: Eigenvectors as string Example: >>> sympy_matrix_eigenvects("Matrix([[1, 0], [0, 2]])") "(1, 1, [Matrix([[1], [0]]), Matrix([[0], [1]])])" """ m = _sympify(matrix) return str(m.eigenvects()) - src/mcp_sympy/tools.py:114-116 (helper)The _sympify helper function used to convert string input to a SymPy object before calling eigenvects().
def _sympify(expr: str) -> sympy.Basic: """Convert string expression to SymPy object.""" return sympy.sympify(expr) - src/mcp_sympy/tools.py:716-717 (registration)The @mcp.tool() decorator that registers the function as an MCP tool. The mcp instance is defined at line 119.
@mcp.tool() def sympy_matrix_eigenvects(matrix: str) -> str: