On 2017-11-17, rajni goyal <goyalrajni2...@gmail.com> wrote:
> I want to know commend to get eigen values

Aparently you don't know how to use SageMath's search tools. So
I'll start by that.

1. There is a searchable documentation for SageMath. It is very
   easy to find examples for eigen value computations there.
2. During a SageMath session, the command
      search_def("eigen")
   will show you all methods whose name contains the string "eigen".
3. As often in Python, commands are in fact methods of objects.
   Hence, if you have a matrix M and guess that it has a method
   called "eigenvalues", then you should just start to type
        M.eigen
   and then hit the <tab> key.

For instance:
  sage: M = random_matrix(QQ,5)
  sage: M
  [ 1/2   -2    0    0  1/2]
  [   1   -2   -1    0   -1]
  [  -1   -1    0   -2   -1]
  [   2    0    1 -1/2   -2]
  [   2    2    0    1    0]

Now start to type M.eig and hit the tab key. You'll see 7 possible
completions, one of them is "eigenvalues". So, let's try this, but first
consult the doc, by (as usual in Python) putting a question mark after
the method:

  sage: M.eigenvalues?
of course you need to hit the <return> key. You'll see a description of
the method and several examples.

And, finally, the result:
  sage: M.eigenvalues()
  [0.9652779576432229?, -1.749813720203932? - 2.054034745529191?*I,
   -1.749813720203932? + 2.054034745529191?*I,
   0.2671747413823206? - 1.769195418760009?*I,
   0.2671747413823206? + 1.769195418760009?*I]

By the way, if you wonder about the question mark that is displayes after
a few decimal digits: The eigenvalues belong the the algebraic field, i.e.
are defined in terms of solutions of algebraic equations. Since an exact
solution typically is not available, the "?" indicates that it is an
approximation. If you need more digits, you can convert the eigenvalues
into a floating point number with a large mantissa:
  sage: ev = M.eigenvalues()[0]
  sage: ev
  0.9652779576432229?
  sage: ev.numerical_approx(digits=30)
  0.965277957643222989774440303246

Regards,
Simon

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to