My question is about assigning the resulting expression after evaluation of a function.

So what I want:

FOCf[x, y] := D[f[x, y], x]

such it immediately evaluates the right hand side, making it a conditional expression.

How I do it now.

I first shift-enter: D[f[x, y], x]. Then, I manually copy the resulting output to the right end of FOCf[x, y] :=.

Is there a better way to do this? I already tried using Evaluate, but that did not seem to work.

  • $\begingroup$ Is f defined prior to defining FOCf? $\endgroup$ – Edmund Feb 28 '19 at 22:20
  • 4
    $\begingroup$ Not sure how to interpret your question. You can evaluate in place with [Ctrl] + [Shift] + [Enter], or you can use = (without the colon) to first evaluate the r.h.s. and then assign the result to the l.h.s. symbol. Btw., normally you indicate variables with an underscore on the left side, e.g. FOCf[x_, y_]. $\endgroup$ – JEM_Mosig Feb 28 '19 at 22:23
  • $\begingroup$ Yes,f[x_, y_] := "conditional expression" before. I can also plot that one, so that seems fine. $\endgroup$ – Dick Oosthuizen Feb 28 '19 at 22:24
  • $\begingroup$ Thank you, I didn't know about the = . $\endgroup$ – Dick Oosthuizen Feb 28 '19 at 22:28
  • 1
    $\begingroup$ or you can write FOCf[x, y] := Evaluate @ D[f[x, y], x] $\endgroup$ – m_goldberg Mar 1 '19 at 7:07