[Math] Reconstructing a function from its critical points and inflection points

continuityderivativesfunctionsgraphing-functionsreal-analysis

For my class I have sketched the following graph which depicts certain critical points and curvatures including one local maximum, minimum, two inflection points and a saddle point (which is an inflection point as well):

sketched graph

I would like to draw this graph (and the graphs of the first and second derivate as well) in LaTeX but I need a possible corresponding function. At first I was considering to obtain such a function with the properties of the derivatives based on the critical points but that would be way too complicated with so many equations. Hence I was thinking about using a piecewise function (seems like two functions from $\mathcal{O}(x^2)$ and one from $\mathcal{O}(x^3)$ to mimick the behaviour from the graph) and glueing those pieces together such that the entire function is continuous.

What would you do to reconstruct such a function for plotting purposes?


EDIT

There are no specific values $x$ and $f(x)$ so we're free to take values which make the reconstruction of the function as simple as possible as long as $f$ remains two times differentiable.

Best Answer

The derivative has to be zero at 3 points, and at one of them, it has to have a double zero to get that saddle point. This is a total of 4 zeros for the derivative, meaning it has to be a fourth order polynomial where the zeros are at known locations, meaning I can write it as:

$$ f'(x) = (x-x_1)(x-x_2)(x-x_3)^2, $$ where $x_1$ is the max point, $x_2$ is the min point, and $x_3$ is the saddle point. You can plug in some some concrete values and get a form for $f'$, then integrate. So the most general formula for your curve is

$$ f(x) = \int(x-x_1)(x-x_2)(x-x_3)^2\;dx $$

I used some concrete values ($x_1=1/8,\;x_2=1/2,\;x_3=1$) and got

$$ f(x) = 1/16 x - 3/8 x^2 + 37/48 x^3 - 21/32 x^4 + x^5/5 $$

Take a look here so you can put in your own values if you want and get the polynomial coefficients for LaTeX use.

EDIT If you really want that the function must be zero and have zero derivative at $x_2$, then you can begin as mentioned in the comments, and add in an offset:

$$ g(x) = f(x) - f(1/2) $$

So clearly $g(1/2)=0$, but now $g(0)\neq 0$. However, we can just move the curve to the right by the correct amount now to get the curve to go through the origin. This requires finding where $g(x_4)=0$ (a small shift in this problem of about $x_4=-0.01346503$, this has a closed form in terms of radicals), but once we have that, we form a shifted function

$$ h(x) = g(x+x_4). $$

The function $h$ satisfies all the requirements, as you can see through the links below. If you want the final, exact coefficients, they are really messy (here). You can also get approximate coefficients using the decimal approximation above. With the approximation, $h(0)\approx 10^{-10}$ which isn't exactly zero, but it is graphically indistinguishable from zero for your plot.

Related Question