On 04/28/2014 11:16 PM, Waldek Hebisch wrote:
> With the patch:
>
> (1) -> m := matrix([[1, 2, 3], [4, 5, 6]])
>
> +1 2 3+
> (1) | |
> +4 5 6+
> Type: Matrix(Integer)
> (2) -> subMatrix(m, 2, 1, 1, 2)
>
> (2)
> Type: Matrix(Integer)
> (3) -> subMatrix(m, 3, 1, 1, 2)
>
> >> Error detected within library code:
> subMatrix: bad row indices
>
> (3) -> m(2..1, 1..2)
>
> (3)
> Type: Matrix(Integer)
> (4) -> m(3..1, 1..2)
>
> (4)
> Type: Matrix(Integer)
>
> In current trunk line 4 signals error. For consistency it
> would be good to get the same result from (2) and (4).
Well, it actually depends, whether (2) and (4) *are* different.
Do we see a Segment "a..b by c" just
(A) as the triple (a,b,c) or
(B) as the set of values {a, a+c, a+2c, ... a+nc} with n such that
a+nc<=b?
The interface of Segment suggests the first, because from (B) it would
be generally impossible to extract high(s) from a segment s. So in this
sense, Waldek is right to treat (2) and (4) in the same way.
Personally, it would also be more intuitive to me that m(3..1,1..2)
behaves just the same as m(2..1,1..2), because I would naturally look at
it as if it were written m(expand(3..1), expand(1..2)).
So technically, Waldek is right, but then we should also think about
(6) -> sum(1/n, n=1..-1)
(6) 0
Well, maybe that example is a little different, but still, it doesn't
evaluate 1/n if the interval is empty. Perhaps, I should have used this.
(9) -> li := [7]
(9) [7]
Type:
List(PositiveInteger)
(10) -> li.1
(10) 7
Type:
PositiveInteger
(11) -> sum(li.n, n=1..-1)
There are 3 exposed and 1 unexposed library operations named li
having 1 argument(s) but none was determined to be applicable.
Use HyperDoc Browse, or issue
)display op li
to learn more about the available operations. Perhaps
package-calling the operation or using coercions on the arguments
will allow you to apply the operation.
Cannot find a definition or applicable library operation named li
with argument type(s)
Variable(n)
Perhaps you should use "@" to indicate the required return type,
or "$" to specify which version of the function you need.
The last sum also gives this error if the upper bound is 1. That looks
like a bug.
Ralf
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.