Minimal optimization using a cost function

88 Views Asked by At

enter image description here

The above image is data that cannot be saved in a list because there's too much of it. This image is just a small snippet of what my real data looks like. The plot is created by some cost function $y=f(k)$... where $y$ is the vertical axis and $k$ is the horizontal axis. We are guaranteed there will be only two points shown in yellow, $0=f(k_n)$ and $0=f(k_m)$. I know both the far left and far right data points. What is the most efficient method to find either $k_n$ or $k_m$ that make $y=0$? The value of $k$ is not a root.

$f(k_n) = \frac{\sqrt{B_n}}{2\sqrt{A_n}} - 1$ ; Where $A_n = A - k_n$ and $B_n = \frac{C}{A_n}$ ; ($B_n > A_n$ always).

I was able to convert the data in the post into a gradient by the following method:

$m_k = m_k + m_{k-1}$.

[Doesn't help me find $0=f(k_n)$ and $0=f(k_m)$].

Note that this is fine for data that can be stored into an array or list. I'll still need to find a method to generate some form of gradient in real-time. If I discover something or create an artificial gradient, I'll post it here.

enter image description here

1

There are 1 best solutions below

2
On

Through substitutions, we have

$$ f\left(k_{n}\right) = \frac{ \sqrt{C} }{ 2\left(A-k_{n}\right) } -1 $$

Solving for $f\left(k_{n}\right)=0$ yields

$$ k_{n}= A-\frac{\sqrt{C}}{2} $$

Something is missing in your post. Do you have the values of $A$ and $C$, or are these unknowns and you wish to estimate them from the data?