# Given a function $f(t,s)$, compute $\max_{t_2\in [0,1]}\min_{t_1\in [0,1]} |f(t_1,s_1)-f(t_2,s_2)|$

Given a continuous and bounded function $$f(t,s)$$, $$t,s\in[0,1]$$, I would like to compute $$\max_{t_2\in [0,1]}\min_{t_1\in [0,1]} |f(t_1,s_1)-f(t_2,s_2)|,$$ for each numeric values of $$s_1$$ and $$s_2$$. I tried by combining NMaxValue and NMinValue but the time is prohibitively large.

I read on the Internet that this distance is sometimes referred to as Fréchet or Hausdorff distance. Is there a built-in function in Mathematica that solves this max-min problem (something like NMaxMinValue)? Or which would be the correct algorithm to proceed with?

• Is the domain of the variable in the question the same as the real problem you want to solve? – Xminer Jun 5 at 9:04
• @Xminer Yes. I have a particular function on $[0,1]\times[0,1]$. I tried to apply NMaxValue of NMinValue. Although after a long time I obtain the correct max-min value, I would like a faster procedure than just combining these two functions. I would expect something as NMaxMinValue. As this distance has a well-known name (Fréchet or Hausdorff), maybe it has been already implemented in Mathematica. – user65970 Jun 5 at 9:11
• I searched this community and documents,but no builtin-function for Hausdorff distance here. so,we have to build new one. – Xminer Jun 5 at 10:08
• Some undocumented minmax routines exists here – Ulrich Neumann Jun 5 at 13:43
• @UlrichNeumann Oh, I've re-invented the degraded wheels... – Xminer Jun 5 at 14:42

(This is example)
There is No Built-in,Documented Function for Hausdorff distance.
Anyway,my code is the following:

f[t_, s_] := Cos[t]*Cos[s];
domain = Range[0, 1, 0.01];
Do[
Do[
funvalue[i, j] = f[i, j];
,
{i, domain}];
, {j, domain}];

AbsoluteTiming[
data = Outer[
With[{s1 = #1, s2 = #2},
Max[
With[{x = #},
Min[ 