# [Numpy-discussion] array vs matrix

Ondrej Certik ondrej@certik...
Wed Jun 11 18:43:26 CDT 2008

```On Sun, Jun 8, 2008 at 3:54 AM, Anne Archibald
<peridot.faceted@gmail.com> wrote:
> 2008/6/7 Robert Kern <robert.kern@gmail.com>:
>> On Sat, Jun 7, 2008 at 14:37, Ondrej Certik <ondrej@certik.cz> wrote:
>>> Hi,
>>>
>>> what is the current plan with array and matrix with regard of calculating
>>>
>>> sin(A)
>>>
>>> ? I.e. elementwise vs sin(A) = Q*sin(D)*Q^T? Is the current approach
>>> (elementwise for array and Q*sin(D)*Q^T for matrix) the way to go?
>>
>> I don't believe we intend to make numpy.matrix any more featureful. I
>> don't think it's a good idea for you to base sympy.Matrix's
>> capabilities in lock-step with numpy.matrix, though. There are very
>> different constraints at work. Please, do what you think is best for
>> sympy.Matrix.
>
> Let me elaborate somewhat:
>
> We recently ran across some painful quirks in numpy's handling of
> matrices, and they spawned massive discussion. As it stands now, there
> is significant interest in reimplementing the matrix object from
> scratch, with different behaviour. So emulating its current behaviour
> is not a win.
>
> For consistency, it makes a certain amount of sense to have sin(A)
> compute a matrix sine, since A**n computes a matrix power. But looking
> at the matrix exponential, I see that we have several implementations,
> none of which is satisfactory for all matrices. I would expect the
> matrix sine to be similar - particularly when faced with complex
> matrices - so perhaps needing an explicit matrix sine is a good thing?
>
> Also worth noting is that this problem can be evaded with namespaces;
> matrix sin could be scipy.matrixmath.sin, abbreviated perhaps to
> mm.sin, as opposed to np.sin.

I see. Thanks Robert and Anne for the replies. That's all I needed to know.

Ondrej
```