Hi,
in your example sublist_indices uses e.g. maybe(m[1] = -0.1) and equality tests with floating
point numbers are difficult.
What you see isn't always what you get. The list m is the result of a computation. So you
can't expect that the results are excactly what is shown. See the internal representation of
m[1] and -0.1 below.
(%i1) l:[1, 2, 3, 4]$
(%i2) m:map(lambda([x],x-1.1),l);
(%o2) [- 0.1, 0.9, 1.9, 2.9]
(%i3) m1: m[1];
(%o3) - 0.1
(%i4) :lisp (integer-decode-float $m1)
7205759403792800
-56
-1
(%i4) :lisp (integer-decode-float -0.1)
7205759403792794
-56
-1
HTH
Volker van Nek
Am 24 Aug 2008 um 14:05 hat Aitor Gonzalez geschrieben:
> Hello,
>
> In this maxima code:
>
> l:[1, 2, 3, 4];
> m:map(lambda([x],x-1.1),l);
> sublist_indices(m,lambda ([x], x=-0.1));
> sublist_indices(m,lambda ([x], x=0.9));
> sublist_indices(m,lambda ([x], x=1.9));
> sublist_indices(m,lambda ([x], x=2.9));
>
> why the first and second sublist_indices cannot find the -0.1 and 0.9 values,
> whereas the third and fourth sublist_indices can find the 1.9 and 2.9 values?
>
> (%i2) l : [1, 2, 3, 4]
> (%o2) [1, 2, 3, 4]
> (%i3) m : map(lambda([x], x - 1.1), l)
> (%o3) [- 0.1, 0.9, 1.9, 2.9]
> (%i4) sublist_indices(m, lambda([x], x = - 0.1))
> (%o4) []
> (%i5) sublist_indices(m, lambda([x], x = 0.9))
> (%o5) []
> (%i6) sublist_indices(m, lambda([x], x = 1.9))
> (%o6) [3]
> (%i7) sublist_indices(m, lambda([x], x = 2.9))
> (%o7) [4]
>
> Thanks in advance
> Aitor
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima