extracting 'pieces' of vector element



On 10/31/2012 07:06 PM, Evan Cooch wrote:
> Suppose I have the element of some structure (say a vector), which is an
> expression.
> 
> e.g.,  [N=26.5]
> 
> I want to 'grab' the rhs of the expression (i.e., the number 26.5), but can't
> figure out how. Suppose the preceding is assigned to Y
> 
> I thought the following would work
> 
> rhs(Y);
> 
> but it keeps returning 0.
> 

I think you're looking for something like this:

(%i1) Y : [N=26.5]$
(%i2) Y[1];
(%o2)                              N = 26.5
(%i3) rhs(Y[1]);
(%o3)                                26.5

Whatever the structure, you just need to access the particular element first.

Cheers,
Kris Katterjohn