extracting 'pieces' of vector element




On 10/31/2012 8:21 PM, Barton Willis wrote:
> The rhs of something that isn't an equation is 0;  the lhs of 
> something that isn't an equation is itself. Examples:
>
>   (%i6) rhs(a);
>   (%o6) 0
>
>   (%i7) lhs(a);
>   (%o7) a
>
> I think you want rhs(first(y)):
>
>   (%i9) y : [N=26.5];
>   (%o9) [N=26.5]
>
>   (%i10) rhs(first(y));
>   (%o10) 26.5
>

Thanks - this and other responses gave me a clue. Suppose I have the 
following:

[[N_1=33.7837837837838],[N_2=43.837838]]

I want to extract 'the numbers'. Suppose (again) this is assigned to Y

Y[1];

returns

[N_1=33.7837837837838]

rhs(Y[1]);

returns 0

rhs(first(Y));

returns 0

If I treat this in steps:

piece : Y[1];

(%o22) [N_1=33.7837837837838]

rhs(piece[1]);

(%o24) 33.7837837837838

It works. So, putting the logic together:

rhs(Y[1][1]);

returns...


33.7837837837838

Ta-dah!



So, what do I execute to return just the number: 33.783783...