On Apr 9, 2008, at 12:24 AM, Robert Bradshaw wrote:

>>
>> Could this be a bit more general?  There are other things one wants
>> to do that are similar, such as matrix.real() and matrix.imag(), or
>> matrix.abs() for real, imaginary, and absolute values of the entries
>> respectively.  It sounds like we want a map operator for a lot of
>> datatypes.
>
> There is an apply_map function that will do this. I experimented with
> making it automatic (i.e. if the method is not found, look up the
> element's method) and it felt weird--interesting but I don't think
> that's what we want to do.
>
> sage: M = matrix(3, [1+k^2 for k in range(9)]); M
> [ 1  2  5]
> [10 17 26]
> [37 50 65]
>
> sage: M.valuation(5)
> [0 0 1]
> [1 0 0]
> [0 2 1]
>
> sage: M.sqrt()   # I'm sure this isn't what we want
> [        1   sqrt(2)   sqrt(5)]
> [ sqrt(10)  sqrt(17)  sqrt(26)]
> [ sqrt(37) 5*sqrt(2)  sqrt(65)]
>
> sage: M.ndigits()
> [1 1 1]
> [2 2 2]
> [2 2 2]
>
> sage: M.next_prime()
> [ 2  3  7]
> [11 19 29]
> [41 53 67]
>
> sage: M.multifactorial(7)
> [             1              1              1]
> [            10            170           5928]
> [       3676320     5925744000 31101226041600]

Ugh. I don't like any of them. Even valuation is wrong.

david


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to