1
$\begingroup$

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.

$\endgroup$

closed as off-topic by m_goldberg, Pinti, MarcoB, Carl Lange, march Mar 1 at 17:37

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, Pinti, Carl Lange, march
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Is f defined prior to defining FOCf? $\endgroup$ – Edmund Feb 28 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 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 at 22:24
  • $\begingroup$ Thank you, I didn't know about the = . $\endgroup$ – Dick Oosthuizen Feb 28 at 22:28
  • 1
    $\begingroup$ or you can write FOCf[x, y] := Evaluate @ D[f[x, y], x] $\endgroup$ – m_goldberg Mar 1 at 7:07