Just for reference, two comments on the documentation for quaternions:

If x is an element of L as below, then neither x? nor x?? returns any
information about methods that apply to x.

Second, in the documentation on quaternions in the reference manual,
there is no reference that
I could find to the vector() method (and I went through this carefully
a number of times).  Also there
is no indication in the reference manual that vector() applies to
quaternions, although I did not
spend much time on this search.

But x.vector() does exactly what I need, and now I am an even-more
happy customer.

Chris

On Mar 27, 6:19 pm, Justin Walker <[EMAIL PROTECTED]> wrote:
> On Mar 27, 2008, at 12:58 PM, Chris Godsil wrote:
>
>
>
> > I want to extract the "real part" of a quaternion, i.e., if
>
> >  L.<i,j,k> = QuaternionAlgebra(QQ,-1,-1);
>
> > and a is in L, then I want the coefficient of 1 in the expansion of as
> > a linear combination of 1, i, j and k.
>
> > Is there a way to do this?  A graceful way?
>
> One way is:
>    x.reduced_trace()/2
> since you are working over QQ :-}
>
> Another is x.vector()[0].
>
> Note that, if x is a Sage (or generally, python) object, "x.TAB" will  
> get you a list of "methods" that might[*] apply to x.  Then if 'foo'  
> is one, "x.foo?" will get you documentation[+] on what 'foo' does.
>
> HTH
>
> Justin
>
> [*] Some methods are shown due to inheritance, and might actually not  
> apply in a specific situation.
>
> [+] Documentation: the best documentation is had with "??" we might  
> not find it in either case, if it's not in a ".py" file.
>
> --
> Justin C. Walker, Curmudgeon at Large
> Director
> Institute for the Enhancement of the Director's Income
> -----------
> Nobody knows the trouble I've been
> -----------
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to