I'm trying to generate a demand curve numerically, given a utility function. The function for the demand is defined like so:
Demand[UF_, x_, m_, w_, p_] := NArgMax[{UF, {x >= 0, m >= 0, p x + m <= w}}, {x, m}][[1]]
Where UF is the utility, x is consumption of a good, w is consumption of everything else in dollars, p is the price of the good in dollars and w is the budget. The constraints say that consumption must be non-negative and that the budget must not be exceeded.
Now I'm trying to plot the demand curve for an innocent looking utility function:
Manipulate[Plot[Demand[5 Sqrt[x] + m, x, m, w, p], {p, 1, 10}], {w, 1, 100}]
This is very slow. What am I doing wrong?