0

So, say I wanted to assign a function J[x_, y_] :={D[system, x], D[system, y]}//Transpose where system is some system of equations. This seems to assign J to be the expression itself and the variables x,y are the variables it drives with respect to. How can I get it to assign to just the output of {D[system, x], D[system, y]} so that I don't get an error message when I try to plug actual numbers into the function?

  • 2
    See the differences between SetDelayed (:=) and Set (=): https://mathematica.stackexchange.com/questions/18393/what-are-the-most-common-pitfalls-awaiting-new-users/18487#18487 Most of the time functions are best defined with SetDelayed, but this is an instance where Set may be more appropriate. – eyorble Dec 02 '22 at 18:41
  • It looks like you instead should be using D[system, {{x, y}}] or Grad[sys, {x, y}]. – Alan Dec 02 '22 at 19:48

0 Answers0