0
$\begingroup$

This is an excerpt from the article https://www.sciencedirect.com/science/article/abs/pii/S0094114X10000418.

How do I write this using vector-matrix operations (TensorProduct or KroneckerProduct or other) in Mathematica?

enter image description here

$\endgroup$

1 Answer 1

1
$\begingroup$

D[A,{X}] will do it because D already operates on all elements of the matrix and the {X} argument (grad) will differentiate w.r.t each part of X. But you'll need to flatten each row to get the form you want:

n = 2; m = 3;
X = Array[x, n]
A = Array[a[#1, #2] @@ X &, {n, m}];

(Flatten /@ D[A, {X}]) // MatrixForm
$\endgroup$
6
  • $\begingroup$ thank you for your answer! I need a formal mathematical description of this operation, is it possible? $\endgroup$
    – dtn
    Jul 16, 2021 at 9:18
  • 1
    $\begingroup$ Not sure what you mean. If anything the maths you've shown is less formal than Mathematica as it loosely inserts vectors into a matrix becoming a bigger matrix of scalars instead of a NxM matrix of vectors. The flattening is like $\text{vec}(...)$. $\endgroup$
    – flinty
    Jul 16, 2021 at 9:23
  • 1
    $\begingroup$ @dtn the Tensor product and Kronecker product are not relevant here. $\endgroup$
    – flinty
    Jul 16, 2021 at 9:25
  • 1
    $\begingroup$ @dtn Only Grad or $\nabla$ as this is applied to every entry in the matrix. $\endgroup$
    – flinty
    Jul 16, 2021 at 9:27
  • 1
    $\begingroup$ @dtn it's just Flatten /@ D[Q, {v}] ?? $\endgroup$
    – flinty
    Jul 16, 2021 at 10:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.