I have a generic quartic function
$$f(x) = a + b x + c x^2 + d x^3 + e x^4$$
and I want to find the values for $a$, $b$, $c$, $d$ and $e$ such that the function has two minima at $x = 0$ and $x = 1$ and one maximum at a given $x = x_e$ (which must be calculated). Other restrictions to the problem are that $f(0) = 0$, $f(1) = 0.5$ and $f(x_e) = 1$.
At first, it is easy to predict that $a = 0$ and $b = 0$. But I do not know how to find the other values of $c$, $d$ and $e$. Perhaps making use of Lagrange multipliers is a way, but I can't figure it out how to solve the problem this way.
I'm trying to use IPython with SymPy to solve and plot the problem, so preferably a solution showed with these packages would be great.
From $f(0) = 0$, we conclude that $\color{blue}{a = 0}$. From the fact that $f$ has two local minima and one local maximum, we conclude that $\color{blue}{e > 0}$. Taking the 1st derivative of $f$, we obtain
$$f ' (x) = b + 2 c x + 3 d x^2 + 4 e x^3$$
From $f ' (0) = 0$, we conclude that $\color{blue}{b = 0}$. From $f ' (1) = 0$ and $f (1) = \frac 12$, we obtain a system of $2$ linear equations in unknowns $c$, $d$ and $e$
$$\begin{array}{rl} 2 c + 3 d + 4 e &= 0\\ c + d + e &= \frac 12\end{array}$$
Let us introduce parameter $t > 0$. Let $\color{blue}{e = t}$. Hence, $\color{blue}{c = t + \frac 32}$ and $\color{blue}{d = -1 - 2 t}$. Thus,
$$f ' (x) = (2 t + 3) x + 3 (-1 - 2 t) x^2 + 4 t x^3 = x \left( 2 t + 3 - 3 (1 + 2 t) x + 4t x^2 \right)$$
After some tedious work, we conclude that the maximum is attained at
$$x_{\max} := \frac{2 t + 3}{4t}$$
Since $f (x_{\max}) = 1$, we eventually obtain the quartic equation
$$(2 t + 3)^3 (2 t - 1) - 256 t^3 = 0$$
Using SymPy to solve the quartic equation above:
Print the $4$ roots in floating-point:
Print the positive root:
Since only one root is real and positive, we conclude that the value of parameter $t$ is
$$\boxed{ \quad t = \frac{3 \sqrt{3}}{2} + 3 + \frac{1}{2} \sqrt{72 + 42 \sqrt{3}} \approx 11.6136005841302 \quad }$$
Let us verify:
Let us check the derivatives:
The 3rd one is messy. In floating-point:
which is zero. So far, so good! Let us check if $f (1) = \frac 12$:
It works! Lastly, quartic function $f$ is
$$\boxed{\quad f (x) = \frac 12 \left( 3 \sqrt{3} + 6 + \sqrt{72 + 42 \sqrt{3}} \right) x^{4} - \left(3 \sqrt{3} + 7 + \sqrt{72 + 42 \sqrt{3}}\right) x^{3} + \quad \\ \qquad\quad + \frac 12 \left( 3 \sqrt{3} + 9 + \sqrt{72 + 42 \sqrt{3}} \right) x^{2} \quad}$$
Plotting the graph of function $f$,
The local maximum is attained at
$$\frac{2t+3}{4t} = \frac{1}{2} \left( \dfrac{3 \sqrt{3} + 9 + \sqrt{72 + 42 \sqrt{3}}}{3 \sqrt{3} + 6 + \sqrt{72 + 42 \sqrt{3}}} \right) \approx 0.564579455317661$$