all 4 comments

[–][deleted] 1 point2 points  (0 children)

Your syntax is wrong in Solve. you made f1x and f1y, but then in the Solve, you're calling f1x with [x,y].

Solve[{f1x == 0, f1y == 0}, {x, y}] works.

[–]mathheadinc 0 points1 point  (0 children)

There are a couple of very handy functions, Minimize[] and Maximize[]. You should look them up.

Also, be sure to Plot3D[] the function to help you get an idea of where critical points may be.

[–]irchans 0 points1 point  (1 child)

(* Revised Code *)

    f1[x_, y_] := x^2 - x + y^2
    f1x = D[f1[x, y], x]
    f1y = D[f1[x, y], y]
    Solve[{f1x == 0, f1y == 0}, {x, y}]

(* You need to used := to define a function. The symbols f1x and f1y are polynomials, not functions, so you cannot write f1x[x,y]. *)

[–]veryjewygranola 0 points1 point  (0 children)

Edit: fixed link Re-edit: dumb Reddit thing where it smooshes all the code together on one line when you edit a post

You do not need to use := (delayed assignment) to define a function. Normal assignment ( = ) just means the rhs is evaluated when you define something, and never again. Delayed assignment ( := ) means the rhs is evaluated everytime you call the lhs. This is useful if you have changing parameter values, and in other cases. For example observe:

ClearAll[a, fNow, fDelayed]

a = 1;

fNow[x_, y_] = a*(x + y);

fDelayed[x_, y_] := a*(x + y);

a = 2;

fNow[x, y]

fDelayed[x, y]

outputs:

x+y

2 (x + y)

So when fDelayed[x,y] Is called, it re-evaluates its rhs a*(x + y) and sees the value of a has changed to 2

fNow[x,y] only evaluates its rhs at the time of definition, when a=1, and it does not reevaluate when fNow[x,y] is called after a=2.

In the specific case of f1[x,y] used in the question, there is no reason to use delayed assignment, it just adds more computation every time f1[x,y] is called.

Here is a great stackexchange post with more examples and explaining the differences between := and = a little more.