0
$\begingroup$

I used NSolve on a partial differential equation with boundary conditions to get a numerical solution that Mathematica says is of the form InterpolatingFunction. I then defined a function f(x,y) which evaluates this solution for a given (x,y). I want to be able to retrieve all of the values of (x,y) such that f(x,y) = C for a given constant C, and then pick the (x,y) in this set that maximizes a different (non-interpolative) function g(x,y). Is this possible? If so, how?

$\endgroup$
3
  • $\begingroup$ Perhaps something like Maximize[{g[x,y], f[x,y]==C}, {x,y}]? Or NMaximize etc. Hard to tell without some code to play with. $\endgroup$
    – Michael E2
    Feb 25 '14 at 23:38
  • $\begingroup$ Do you mean you used NDSolve (not NSolve)? For finding zeros of interpolating functions, see this answer. $\endgroup$
    – Szabolcs
    Feb 26 '14 at 1:09
  • $\begingroup$ Were this question clarified with even a minimal example, it would become clear that it is not a duplicate of the linked Q&A. (For instance, I don't think this problem can be solved with WhenEvent.) $\endgroup$
    – Michael E2
    May 28 '19 at 13:48