# A matrix containing differential operators acting on a matrix containing functions

Suppose I have a 2x2 operator matrix, D. Some of its elements are of the form (d/dx), and (d2/dx2). Now when this matrix is multiplied with another matrix, f, whose elements are functions of x, I will get the final matrix whose corresponding elements are differentiated.

for example: **D = matrix([[d/dx, d3/dx3], [d2/dx2, d2/dx2]])** is an operator matrix which operates on a function matrix, **f(x) = matrix([[x, x^2], [x^3, x]])** as D(f(x)) = D*f(x), (simple matrix multiplication).

Writing D = matrix([[diff( , x), diff( , x, 3)], [diff( , x, 2), diff( , x, 2)]]) does not work as diff() function needs an input function.

So how can I write the D() operator matrix?

PS: I could use f.apply_map(lambda e: diff(e, x)), but then it applies d/dx to all elements in f(x). Whereas, I have 'diff()' operators of different orders in the D matrix.

To improve the question, make it simpler and more concrete:

Once answered, it should be easy for you to adapt to your 6 x 3 and 3 x 12 setting.

Hey @slelievre, I have updated the question. This would be a simpler form of what I am trying to do. Thank you

You may try using https://doc.sagemath.org/html/en/refe...