Está en la página 1de 4

NAME : - Supriya Suresh Wadkar

STD. :- SY BSc CS (Computer Science)


PRACTICAL NO. 8
1. Using sympy module find eigenvalues of the following matrix.
𝐴 = (1 2 3 3 − 1 1 1 1 − 1 )
Input :
from sympy import *
A = Matrix([[1,2,3], [3,-1,1],[1,1,-1]])
A.eigenvals()
Output :
{-1/3 + 34/(9*(sqrt(3945)/18 + 439/54)**(1/3)) +
(sqrt(3945)/18 + 439/54)**(1/3): 1,
-1/3 + 34/(9*(-1/2 + sqrt(3)*I/2)*(sqrt(3945)/18 +
439/54)**(1/3)) + (-1/2 + sqrt(3)*I/2)*(sqrt(3945)/18
+ 439/54)**(1/3): 1,
-1/3 + (-1/2 - sqrt(3)*I/2)*(sqrt(3945)/18 +
439/54)**(1/3) + 34/(9*(-1/2 -
sqrt(3)*I/2)*(sqrt(3945)/18 + 439/54)**(1/3)): 1}

2. Using sympy module declare any 4x4 matrix and find eigenvalues
of that matrix.
Input :
B =
Matrix([[1,2,3,3],[4,5,6,4],[7,8,9,8],[2,5,8,5]])
B.eigenvals()
Output :
{20/3 + 499/(9*(sqrt(63446)/3 + 11375/27)**(1/3)) +
(sqrt(63446)/3 + 11375/27)**(1/3): 1,
20/3 + 499/(9*(-1/2 + sqrt(3)*I/2)*(sqrt(63446)/3 +
11375/27)**(1/3)) + (-1/2 +
sqrt(3)*I/2)*(sqrt(63446)/3 + 11375/27)**(1/3): 1,
20/3 + (-1/2 - sqrt(3)*I/2)*(sqrt(63446)/3 +
11375/27)**(1/3) + 499/(9*(-1/2 -
sqrt(3)*I/2)*(sqrt(63446)/3 + 11375/27)**(1/3)): 1,
0: 1}
3. Using sympy module find eigenvalues of the following matrix.

Input :
C = Matrix([[1,1,1], [0,1,1],[0,0,1]])
C.eigenvals()
Output :
{1: 3}

4. Using sympy module find eigenvectors of the following matrix.

Input :
D = Matrix([[1,2,2], [2,1,2],[2,2,1]])
D.eigenvects()
Output :
[(-1,
2,
[Matrix([
[-1],
[ 1],
[ 0]]),
Matrix([
[-1],
[ 0],
[ 1]])]),
(5,
1,
[Matrix([
[1],
[1],
[1]])])]

5. Using sympy module find eigenvectors of the following matrix.


Input :
E = Matrix([[1,1,1], [0,1,1],[0,0,1]])
E.eigenvects()
Output :
[(1,
3,
[Matrix([
[1],
[0],
[0]])])]

6. Using sympy module find eigenvectors of the following matrix.

Input :
F = Matrix([[1,2,3], [3,-1,1],[1,1,-1]])
F.eigenvects()
Output :
[(-1/3 + (-1/2 - sqrt(3)*I/2)*(sqrt(3945)/18 +
439/54)**(1/3) + 34/(9*(-1/2 -
sqrt(3)*I/2)*(sqrt(3945)/18 + 439/54)**(1/3)),
1,
[Matrix([
[
-5/3 + (-1/3 + (-1/2 - sqrt(3)*I/2)*(sqrt(3945)/18 +
439/54)**(1/3) + 34/(9*(-1/2 -
sqrt(3)*I/2)*(sqrt(3945)/18 + 439/54)**(1/3)))**2/3],
[7/3 + (-1/2 - sqrt(3)*I/2)*(sqrt(3945)/18 +
439/54)**(1/3) - (-1/3 + (-1/2 -
sqrt(3)*I/2)*(sqrt(3945)/18 + 439/54)**(1/3) +
34/(9*(-1/2 - sqrt(3)*I/2)*(sqrt(3945)/18 +
439/54)**(1/3)))**2/3 + 34/(9*(-1/2 -
sqrt(3)*I/2)*(sqrt(3945)/18 + 439/54)**(1/3))],
[
1]])]),
(-1/3 + 34/(9*(-1/2 + sqrt(3)*I/2)*(sqrt(3945)/18 +
439/54)**(1/3)) + (-1/2 + sqrt(3)*I/2)*(sqrt(3945)/18
+ 439/54)**(1/3),
1,
[Matrix([
[
-5/3 + (-1/3 + 34/(9*(-1/2 +
sqrt(3)*I/2)*(sqrt(3945)/18 + 439/54)**(1/3)) + (-1/2
+ sqrt(3)*I/2)*(sqrt(3945)/18 + 439/54)**(1/3))**2/3],
[7/3 + 34/(9*(-1/2 + sqrt(3)*I/2)*(sqrt(3945)/18 +
439/54)**(1/3)) - (-1/3 + 34/(9*(-1/2 +
sqrt(3)*I/2)*(sqrt(3945)/18 + 439/54)**(1/3)) + (-1/2
+ sqrt(3)*I/2)*(sqrt(3945)/18 + 439/54)**(1/3))**2/3 +
(-1/2 + sqrt(3)*I/2)*(sqrt(3945)/18 + 439/54)**(1/3)],
[
1]])]),
(-1/3 + 34/(9*(sqrt(3945)/18 + 439/54)**(1/3)) +
(sqrt(3945)/18 + 439/54)**(1/3),
1,
[Matrix([
[
-5/3 + (-1/3 + 34/(9*(sqrt(3945)/18 + 439/54)**(1/3))
+ (sqrt(3945)/18 + 439/54)**(1/3))**2/3],
[-(-1/3 + 34/(9*(sqrt(3945)/18 + 439/54)**(1/3)) +
(sqrt(3945)/18 + 439/54)**(1/3))**2/3 +
34/(9*(sqrt(3945)/18 + 439/54)**(1/3)) +
(sqrt(3945)/18 + 439/54)**(1/3) + 7/3],
[
1]])])]

También podría gustarte