type() is one very helpful function in SAGE to know about data kinds

print type(T)

returns 

<type 'list'>


so T is not strictly an "array"  but a "list".
your knowledge is mixing with other programming languages where [ and ] are 
special characters to get one element of an array.
(some computer men will say to you: it's same, only difference, is list as 
no defined maximum number of elements)

to get first element of this list in SAGE : use  T[0]

print T[0]

returns
t == 1

you can ask: what is it ? answer: simply first element of list:   an 
"equation"   

next question: how can I get "t" ? answer: get the left hand part of 
equation: T[0].left()

print T[0].left()

returns
t

next question: how to assign "x" with "t" ? answer: not assignement of 
value but substitution

x = T[0].left() ; print x

returns
x

next question: which value has x ?

print x

returns
t

Argh...I don't want this, but I want x has the same value than t ? answer: 
t has NO value, because t == 1, is not an "assignment" but an "equation"

x = T[0].right()

print x

returns
1

OK..now x has value 1, and no relation anymore with t.


To be 1 or not to be 1, was it the question ? 


On Sunday, 23 February 2014 05:39:54 UTC+1, Santanu wrote:
>
> Following code  I want to assign a value. 
>
>
> var('a,t,x')
> T=[t==1, a==2]
>
> Now I want to make x=t which is 1 in this case. 
> That is x will be 1. 
>
>
>  
>

-- 
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 http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to