Mathematica Asked on December 21, 2021
I would like to calculate the second order derivative of a function with respect to a matrix coefficient symbolically. Below is the first order derivative of S with respect to the coefficient of x. For getting the answer what I have done is I have expressed the S as the function of only coefficients.
myD[S , x_[n_, s_]] := D[S[x[n, s]], x[n, s]];
Here S is a function of the big matrix ‘x’. But as I said before I need to find the derivative of S with respect to the coefficient of x.
myD[myD[S, x_[n_, s_]], x_[t_, r_]] :=
D[S[x[n, s]], {x[n, s], 2}];
Above code is what I have written for second derivative and of course it is not correct as what I need is something as below equation.
Is there a best way to define that?
$$sum_{nu<mu}sum_{beta<alpha}x_{ialpha}x_{beta j}x_{kmu}x_{nuell}frac{partial^{2}S}{partial x_{numu}x_{betaalpha}}$$
This is how it participate.
Definition:
$$frac{partial^{2}S}{partial x_{numu}x_{betaalpha}}=frac{partial}{partial x_{numu}}left(frac{partial S}{partial x_{betaalpha}}right)$$
If we have,
$$K=x_{lalpha}x_{beta k}x_{inu}x_{mu j}$$
$$frac{partial SK_{left(betaalpharight),left(upsilonmuright)}}{dx_{upsilonmu}}=Sfrac{partial K_{left(betaalpharight),left(upsilonmuright)}}{dx_{upsilonmu}}+Kfrac{partial S}{dx_{upsilonmu}}$$
$$frac{partial^{2}SK_{left(alphabetaright),left(muupsilonright)}}{dx_{betaalpha}x_{upsilonmu}} =frac{partial}{dx_{betaalpha}}left(frac{partial SK_{left(betaalpharight),left(upsilonmuright)}}{dx_{upsilonmu}}right)
=frac{partial}{dx_{betaalpha}}left(Sfrac{partial K_{left(betaalpharight),left(upsilonmuright)}}{dx_{upsilonmu}}+Kfrac{partial S}{dx_{upsilonmu}}right)
=left(Sfrac{partial^{2}K_{left(betaalpharight),left(upsilonmuright)}}{dx_{betaalpha}x_{upsilonmu}}+frac{partial K_{left(betaalpharight),left(upsilonmuright)}}{dx_{upsilonmu}}frac{partial S}{dx_{betaalpha}}+Kfrac{partial^{2}S}{dx_{betaalpha}x_{upsilonmu}}+frac{partial K_{left(betaalpharight),left(upsilonmuright)}}{dx_{betaalpha}}frac{partial S}{dx_{upsilonmu}}right)
$$
provided D is the dimension of the matrix.
Also,
$$ frac{partial x_{lj}}{dx_{betaalpha}}=delta_{j,alpha}delta_{l,beta}-delta_{j,beta}delta_{l,alpha}$$
EDITED
But when I put the rule of differentiation of real antisymmetric matrix as in the above equation by the following code, it is showing error.
myD[x_[k_, l_],
x_[v_, g_]] := [Delta][k, v] [Delta][l, g] - [Delta][k,
g] [Delta][l, v];
If it's just for display, then I think the following is enough:
Clear[myD, x]
myD[myD[a_, b__], c__] := myD[a, b, c]
Format[HoldPattern@myD[a_, b__]] := TraditionalForm@HoldForm@D[a, b]
Format[x[a_, b_]] := Subscript[x, a, b]
myD[myD[S, x[ν, μ]], x[α, β]]
To automate the subsequent calculation, just define
myD[a_ + b_, c_] := myD[a, c] + myD[b, c]
and the following two lines that are already in your previous question:
myD[a_ b_, c_] := a myD[b, c] + b myD[a, c]
Format[x[a_, b_]] := Subscript[x, a, b]
Check:
myD[myD[S K, x[β, α]], x[ν, μ]]
Answered by xzczd on December 21, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP