ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 24 Mar 2021 08:28:44 +0100A matrix containing differential operators acting on a matrix containing functionshttps://ask.sagemath.org/question/56311/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.Mon, 22 Mar 2021 13:29:51 +0100https://ask.sagemath.org/question/56311/a-matrix-containing-differential-operators-acting-on-a-matrix-containing-functions/Comment by FrédéricC for <p>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.</p>
<p>for example: <strong>D = matrix([[d/dx, d3/dx3], [d2/dx2, d2/dx2]])</strong> is an operator matrix which operates on a function matrix, <strong>f(x) = matrix([[x, x^2], [x^3, x]])</strong> as D(f(x)) = D*f(x), (simple matrix multiplication).</p>
<p>Writing D = matrix([[diff( , x), diff( , x, 3)], [diff( , x, 2), diff( , x, 2)]]) does not work as diff() function needs an input function.</p>
<p>So how can I write the D() operator matrix?</p>
<p>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.</p>
https://ask.sagemath.org/question/56311/a-matrix-containing-differential-operators-acting-on-a-matrix-containing-functions/?comment=56352#post-id-56352You may try using https://doc.sagemath.org/html/en/reference/algebras/sage/algebras/weyl_algebra.htmlWed, 24 Mar 2021 08:28:44 +0100https://ask.sagemath.org/question/56311/a-matrix-containing-differential-operators-acting-on-a-matrix-containing-functions/?comment=56352#post-id-56352Comment by Apoorv for <p>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.</p>
<p>for example: <strong>D = matrix([[d/dx, d3/dx3], [d2/dx2, d2/dx2]])</strong> is an operator matrix which operates on a function matrix, <strong>f(x) = matrix([[x, x^2], [x^3, x]])</strong> as D(f(x)) = D*f(x), (simple matrix multiplication).</p>
<p>Writing D = matrix([[diff( , x), diff( , x, 3)], [diff( , x, 2), diff( , x, 2)]]) does not work as diff() function needs an input function.</p>
<p>So how can I write the D() operator matrix?</p>
<p>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.</p>
https://ask.sagemath.org/question/56311/a-matrix-containing-differential-operators-acting-on-a-matrix-containing-functions/?comment=56350#post-id-56350Hey @slelievre, I have updated the question. This would be a simpler form of what I am trying to do. Thank youWed, 24 Mar 2021 06:12:04 +0100https://ask.sagemath.org/question/56311/a-matrix-containing-differential-operators-acting-on-a-matrix-containing-functions/?comment=56350#post-id-56350Comment by slelievre for <p>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.</p>
<p>for example: <strong>D = matrix([[d/dx, d3/dx3], [d2/dx2, d2/dx2]])</strong> is an operator matrix which operates on a function matrix, <strong>f(x) = matrix([[x, x^2], [x^3, x]])</strong> as D(f(x)) = D*f(x), (simple matrix multiplication).</p>
<p>Writing D = matrix([[diff( , x), diff( , x, 3)], [diff( , x, 2), diff( , x, 2)]]) does not work as diff() function needs an input function.</p>
<p>So how can I write the D() operator matrix?</p>
<p>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.</p>
https://ask.sagemath.org/question/56311/a-matrix-containing-differential-operators-acting-on-a-matrix-containing-functions/?comment=56317#post-id-56317To improve the question, make it simpler and more concrete:
- use a 2 x 2 matrix of differential operators
- use a 2 x 2 matrix of functions, and provide it explicitly
Once answered, it should be easy for you to adapt to your 6 x 3 and 3 x 12 setting.Mon, 22 Mar 2021 18:14:12 +0100https://ask.sagemath.org/question/56311/a-matrix-containing-differential-operators-acting-on-a-matrix-containing-functions/?comment=56317#post-id-56317