Let's assume I have function $\mathbf F(h)$ that has the scalar $h$ as an input and a matrix as an output. I define the distance between two matrices
$$ \mathbf A = \mathbf F(h_1) \\ \mathbf B = \mathbf F(h_2) $$
where A and B have the same shape as
$$ dist(\mathbf A, \mathbf B) = \sum_i \frac{ \mathbf {A_i} \cdot \mathbf {B_i} }{ \|\mathbf {A_i} \| \cdot \|\mathbf {B_i} \| } $$
where $i$ is the row for $A$ and $B$ respective.
Next I can define a stability $s$ in respect to $h$ with
$$ s(h) = \frac { dist(\mathbf F(h_1), \mathbf F(h_2)) } { h_2 - h_1 } \text{ for } h_2 \rightarrow h \text{ and } h_1 \rightarrow h $$
where $h_1 < h < h_2$ and $h-h_1 = h_2 - h$.
I want to find the $h$ which results in the highest stability, so I want to find the maximum of $s(h)$.
The main issue is the not-so-closed form of the definition of the stability $s(h)$. A side issue is that calculating any $\mathbf F(h)$ is very expensive.
What is the best way to find the $h$ which results in the highest stability?