I’m coding my first physics simulation in Mathematica, and have a problem. I want to do the following inside a single cell input.
Clear[x, y]
F[x_, y_] := Cos[x] Cos[y];
\!\(
\*SubscriptBox[\(\[PartialD]\), \(x\)]\(F[x, y]\)\)
Then I click shift enter and copy output -Cos[y] Sin[x] to the next cell as the deffinition of G[x,y].
G[x_, y_] := -Cos[y] Sin[x];
Print[{G[a, b], G[c, d], G[e, f]}]
Note, that above was only an example. The code should work for any differentiable function F[x,y]. Also, I want the code to do differentiation only once, because G[x,y] will then be evaluated tens of millions of times.