0

How does one create and perform differentiation on tuple valued functions in Mathematica.

More specifically, I have the following functions, where R denotes the real line

f:R^2 -> R^3

g:R^3 -> R^3 

h: R^3 -> R^1

I want to consider the composition of these functions k:R^2 -> R^1 i.e. k= h(g(f(x,y))) and I want to find the derivatives k_x, k_y, k_xx, k_yy, k_xy

How can I do this in Mathematica?

smilingbuddha
  • 14,334
  • 33
  • 112
  • 189

1 Answers1

1

I'm assuming you don't have an expression for f,g,h, but you want the derivative of the composition in terms of derivatives of f,g,h.

You could always reduce the problem to single-valued functions, by using a definition like f[x_,y_] := {f1[x,y],f2[x,y],f3[x,y]}

For example:

f[x_, y_] := Through[{f1, f2, f3}[{x, y}]]
g[x_, y_, z_] := Through[{g1, g2, g3}[{x, y, z}]]

D[h @@ g @@ f[x, y], x]

Result:

(Derivative[{1, 0}][f3][{x, y}]*Derivative[{0, 0, 1}][g3][{f1[{x, y}], f2[{x, y}], f3[{x, y}]}] + 
   Derivative[{1, 0}][f2][{x, y}]*Derivative[{0, 1, 0}][g3][{f1[{x, y}], f2[{x, y}], f3[{x, y}]}] + 
   Derivative[{1, 0}][f1][{x, y}]*Derivative[{1, 0, 0}][g3][{f1[{x, y}], f2[{x, y}], f3[{x, y}]}])*
  Derivative[0, 0, 1][h][g1[{f1[{x, y}], f2[{x, y}], f3[{x, y}]}], g2[{f1[{x, y}], f2[{x, y}], f3[{x, y}]}], 
   g3[{f1[{x, y}], f2[{x, y}], f3[{x, y}]}]] + 
 (Derivative[{1, 0}][f3][{x, y}]*Derivative[{0, 0, 1}][g2][{f1[{x, y}], f2[{x, y}], f3[{x, y}]}] + 
   Derivative[{1, 0}][f2][{x, y}]*Derivative[{0, 1, 0}][g2][{f1[{x, y}], f2[{x, y}], f3[{x, y}]}] + 
   Derivative[{1, 0}][f1][{x, y}]*Derivative[{1, 0, 0}][g2][{f1[{x, y}], f2[{x, y}], f3[{x, y}]}])*
  Derivative[0, 1, 0][h][g1[{f1[{x, y}], f2[{x, y}], f3[{x, y}]}], g2[{f1[{x, y}], f2[{x, y}], f3[{x, y}]}], 
   g3[{f1[{x, y}], f2[{x, y}], f3[{x, y}]}]] + 
 (Derivative[{1, 0}][f3][{x, y}]*Derivative[{0, 0, 1}][g1][{f1[{x, y}], f2[{x, y}], f3[{x, y}]}] + 
   Derivative[{1, 0}][f2][{x, y}]*Derivative[{0, 1, 0}][g1][{f1[{x, y}], f2[{x, y}], f3[{x, y}]}] + 
   Derivative[{1, 0}][f1][{x, y}]*Derivative[{1, 0, 0}][g1][{f1[{x, y}], f2[{x, y}], f3[{x, y}]}])*
  Derivative[1, 0, 0][h][g1[{f1[{x, y}], f2[{x, y}], f3[{x, y}]}], g2[{f1[{x, y}], f2[{x, y}], f3[{x, y}]}], 
   g3[{f1[{x, y}], f2[{x, y}], f3[{x, y}]}]]
Niki
  • 15,662
  • 5
  • 48
  • 74