On Nov 18, 2009, at 6:25 PM, Ichnich wrote:

> Hi,
>
> I want to find the solution of  a system of coupled differential
> equations.
> Therfore I need the eigenvalues and vectors of a matrix D and their
> complex conjugates.
> short example:
> sage: D=matrix([[0,1],[-1,0]])
>
> sage: EV=D.eigenvectors_left();EV
> [(-1*I, [(1, 1*I)], 1), (1*I, [(1, -1*I)], 1)]
>
> sage: EV[0][1][0]  # first eigenvector
> (1, 1*I)
>
> sage: (EV[0][1][0]).conjugate()
> Traceback (most recent call last):
> ...
> AttributeError: 'sage.modules.free_module_element.FreeModuleElement'
> object has no attribute 'conjugate'
>
> sage: matrix(sage_eval(repr(EV[0][1][0]))).conjugate()
> [ 1 -I]
>
> Is there an easier way to get the result of the last row? Or is there
> an easy way to cast from and to vector and matrix types?

No, unfortunately there's not a really easy way to do this. It would  
make sense for vectors to "inherit" some elements of their elements,  
or at least have a map command like matrix does.

sage: matrix(EV[0][1][0]).apply_map(conjugate)[0]
(1, -1*I)

Alternatively, I could use list comprehension,

sage: vector([a.conjugate() for a in EV[0][1][0]])
(1, -1*I)

- Robert

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to