Bill Allombert on Wed, 12 Feb 2003 18:43:27 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Where's the logic?


On Wed, Feb 12, 2003 at 05:26:20PM -0000, Jon Perry wrote:
> ? v=[2,3,4,5]
> %1 = [2, 3, 4, 5]
> ? v-1
>   ***   forbidden addition t_INT + t_VEC.
> ? v/2
> %2 = [1, 3/2, 2, 5/2]
> ?

For PARI v/2 is equivalent (1/2)*v which is a legal operation
in a vector space over the rational field.

On the other hand, v-1 mix scalar and vector badly hence is not allowed. Also
what were you expecting as result ?  maybe [1,2,3,4] ? This cannot be done
because it will make 1==[1,1,1,1] true.

You must do something similar to
? v-vector(length(v),i,1)
or
? vector(length(v),i,v[i]-1)

Cheers,
Bill.