How to convert Vector space of dimension 1 to field

29 views
Skip to first unread message

msantopr

unread,
May 26, 2014, 8:04:27 PM5/26/14
to sage-s...@googlegroups.com
Hi all,

I am new to sage, so please forgive me if this is a trivial question.

I tried to find a minimal example for my problem.
I can define two real interval fields:

t0=RIF(2.9, 3.1)
t1=RIF(2.9, 3.1)

and then define a matrix

t=matrix([[t0],[t1]])

Clearly 

parent(t0)

Real Interval Field with 53 bits of precision

However,

 parent(t[0])

Vector space of dimension 1 over Real Interval Field with 53 bits of precision

I would like to do some computations with t[0] and t[1] in which they should be regarded as elements of a real interval fields. Is there any way to convert from Vector space of dimension 1 over the real interval field to real interval field? In my actual code I don't have t0 and t1 explicitly  since the matrix is obtained form a computation.

Any help would be much appreciated!

Manuele

David Joyner

unread,
May 27, 2014, 7:07:52 AM5/27/14
to SAGE support
Does this help?

sage: t0=RIF(2.9, 3.1)
sage: t1=RIF(2.9, 3.1)
sage: t=matrix([[t0],[t1]])
sage: parent(t[0])
Vector space of dimension 1 over Real Interval Field with 53 bits of precision
sage: parent(t[0][0])
Real Interval Field with 53 bits of precision

>
> Any help would be much appreciated!
>
>
> Manuele
>
>
> --
> 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...@googlegroups.com.
> To post to this group, send email to sage-s...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.

John Cremona

unread,
May 27, 2014, 7:08:18 AM5/27/14
to SAGE support
sage: t = [t0,t1]
sage: t[0] is t0
True
sage: t[1] is t1
True

John Cremona

unread,
May 27, 2014, 7:08:28 AM5/27/14
to SAGE support
You defined t to be a 1x2 matrix over the field RIF, and t[0] is its
first row which is a vector (lof length 1) over that field. I think
you just meant to define an array (called list in python) with two
elements, t0 and t1:

sage: t = [t0,t1]
sage: t[0] is t0
True
sage: t[1] is t1
True

msantopr

unread,
May 27, 2014, 3:11:22 PM5/27/14
to sage-s...@googlegroups.com
Thanks. My bad. As you noticed it was enough to take t[0][0] rather than t[0] 
Reply all
Reply to author
Forward
0 new messages