# Algorithmic stumper- Need to create a customizable error curve

Solution for Algorithmic stumper- Need to create a customizable error curve
is Given Below:

First time posting, but this might stimulate someone to think about it. I am working with a dataset that generates 2 variables that have a polynomial relationship. Using my data, I have fit the curve to the following code. I am writing in C++.

``````if (master_key > -300 && (mav[mav.size() - 1] - mav[mav.size() - 2]) < -280)

j_jump = true;

if (master_key > -400 && (mav[mav.size() - 1] - mav[mav.size() - 2]) < -300)

j_jump = true;

if (master_key > -700 && (mav[mav.size() - 1] - mav[mav.size() - 2]) < -350)

j_jump = true;

if (master_key > -900 && (mav[mav.size() - 1] - mav[mav.size() - 2]) < -750)

j_jump = true;

if (master_key > -1150 && (mav[mav.size() - 1] - mav[mav.size() - 2]) < -900)

j_jump = true;

if (master_key > -1600 && (mav[mav.size() - 1] - mav[mav.size() - 2]) < -1400)

j_jump = true;

if (master_key > -4000 && (mav[mav.size() - 1] - mav[mav.size() - 2]) < -3000)

j_jump = true;

if (master_key > -20000 && (mav[mav.size() - 1] - mav[mav.size() - 2]) < -16000)

j_jump = true;
``````

I have tried to curve fit it with a ton of different algorithms, it does not follow any classic curve. In essence, (mav[mav.size() – 1] – mav[mav.size() – 2])< X (e.g. -16000) is a probabilistic variable that represents the likelihood of a negative result when above the given X which was determined experimentally. The value of the master key (the more negative the value, the stronger the signal) is proportional to the value of mav. The more negative mav is, the more positive the master key must be to elicit a positive result. Any ideas on how to curve fit this would be greatly appreciated. Ideas as to a method for coding the above if statements into something more succinct would also be appreciated.