Finding the d value that will keep all coefficients at a minimum in a Cubic

59 Views Asked by At

I have a particular scenario.

In this scenario, we have the standard cubic equation,

ax^3 + bx^2 + cx + d = y 

as well as 3 points that are graphed, as can be seen in this graph. (The line is irrelevant for now)

Assume that

a, b, and c 

will all adapt themselves so that they can fit all three dots as well as

d

and create a cubic line.

The problem at hand, now, is to find some sort of general equation that would find the value of d that would lead to having the smallest sum of all coefficients, those being

a, b, c and d

The ending result doesn't have to be a specific number, though. A range of values a reasonable amount of numbers wide or so that is guaranteed to contain the number is acceptable as well.

If any clarifications or more details are needed, then feel free to comment and I'll add anything necessary.

EDIT

I should have mentioned that by minimum, I mean the smallest absolute value of the equation, so in other words

|a| + |b| + |c| + |d|

Here's a program that simulates the scenario

2

There are 2 best solutions below

0
On

First, fit a quadratic through the three points, getting $y=ux^2+vx+w$. If the $x$ coordinates of the three points are $x_1,x_2,x_3$, the family of cubics that go through your points is parameterized by $r$ as $y=r(x-x_1)(x-x_2)(x-x_3)+ux^2+vx+w=rx^3+(u-rx_1-rx_2-rx_3)x^2+(v+rx_1x_2+rx_1x_3+rx_2x_3)x+(w-rx_1x_2x_3)$.

The function you want to minimize is therefore $f(r)=|r|+|u-r(x_1+x_2+x_3)|+|v+r(x_1x_2+x_1x_3+x_2x_3)|+|w-rx_1x_2x_3|$ This is a piecewise linear function, so you can just compute the values at all the turning points and pick the lowest.

0
On

You have three linear equations in $a,b,c,d$ once you substitute in the $x$- and $y$-values for those three points. This system can be solved to give $$a=a(d)=a_1d+a_0$$ $$b=b(d)=b_1d+b_0$$ $$c=c(d)=c_1d+c_0$$ (I'm saying that you can use linear algebra to have exact values for $a_1,a_0,b_1,b_0,c_1,c_0$.)

Then you want to minimize $$\left\lvert d\right\rvert+\left\lvert a_1d+a_0\right\rvert+\left\lvert b_1d+b_0\right\rvert+\left\lvert c_1d+c_0\right\rvert$$ which is a continuous function of $d$, piece-wise linear, where there can be nondifferentiability where quantities in the absolute values change sign. The critical points are $$d=0, \quad d=-a_0/a_1,\quad d=-b_0/b_1,\quad d=-c_0/c_1$$ (although remove from this list any where the linear coefficient had been $0$.) It will be enough to check which of these four (or fewer) $d$-values gives minimal sum of the absolute values.