On Fri, Dec 19, 2008 at 4:57 AM, Jan Groenewald <j...@aims.ac.za> wrote: >
... > > sage: A=matrix([[1,2],[2,1]]);A > > [1 2] > [2 1] > sage: eig=A.eigenvectors_right();eig > > [(3, [ > (1, 1) > ], 1), (-1, [ > (1, -1) > ], 1)] > sage: v=eig[0][1][0];v > (1, 1) > sage: var('t') > t > sage: type(v) > <type 'sage.modules.vector_rational_dense.Vector_rational_dense'> > sage: type(v*t) > <type 'sage.modules.free_module_element.FreeModuleElement_generic_dense'> > > For instance, I want to subtract v*t from A*v which is not > possible in sage. > > I think this would have worked if v*t was of the type > sage.modules.vector_rational_dense.Vector_rational_dense > just like v. I think it should be that type? > > sage: A*v-v*t > --------------------------------------------------------------------------- > TypeError Traceback (most recent call last) > ... > > A workaround we are using in the meantime: > > sage: A*v-v*identity_matrix(2)*t > (3 - t, 3 - t) > I'm not sure this is a bug or a missing feature or what but here is another workaround: sage: t^0*A*v-t*v (3 - t, 3 - t) > I still don't get it though, the v*identity_matrix(2)*t has the same type as > v*t, why > does that even work as a workaround? > > sage: type(v*t) > <type 'sage.modules.free_module_element.FreeModuleElement_generic_dense'> > sage: type(v*identity_matrix(2)*t) > <type 'sage.modules.free_module_element.FreeModuleElement_generic_dense'> > sage: type(A*v) > <type 'sage.modules.vector_rational_dense.Vector_rational_dense'> > sage: type(A*v-v*identity_matrix(2)*t) > <type 'sage.modules.free_module_element.FreeModuleElement_generic_dense'> > > I hope that is clearer. > > regards, > Jan > > > > --~--~---------~--~----~------------~-------~--~----~ 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 URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---