Equation of a curve

161 Views Asked by At

EDIT : What is the equation for this function ?

  • Before editing (no longer consider)

    What is the function that goes through these points ?

    $f(0) = 2$

    $f(1) = 3$

    $f(2) = 0$

    $f(3) = 1$

    The curve looks like this.

5

There are 5 best solutions below

9
On BEST ANSWER

Here is a periodic solution defined for $x\in[-2.5,1.5]$ and looking much like the OP's sketch.

(For $x\notin[-2.5,1.5]$, continue periodically with period 4.)

$$\textstyle F(x)={3\over2} -{52\over2205}(x+{1\over2})^7 +{2\over2205}(x+{1\over2})^5 +{1163\over8820}(x+{1\over2})^3 +{237\over245}(x+{1\over2}). $$

Note that $F(x)\in[0,3]$ for all $x$; in particular, $$\textstyle F(-2)=0, \ \ F(-1)=1, \ \ F(0)=2, \ \ F(1)=3, \ \ F({3\over2})={3\over2}, $$ $$ F'(-2)=0, \ \ F'(1)=0. \tag{$*$} $$

Here is a WolframAlpha command to plot this solution.

plot 3/2-52/2205(x+.5)^7+2/2205(x+.5)^5+1163/8820(x+.5)^3+237/245(x+.5) from -2.5 to 1.5

To continue with period 4: in the function formula replace all occurrences of $(x+{1\over2})$ with $$(((x+2.5)\%4)-2) $$ where $\%4$ denotes the operation of taking the remainder of division by $4$. Below is a WolframAlpha command that plots the periodically continued function (Wolfram syntax for $\%4$ is mod4):

plot 3/2-52/2205(((x+2.5)mod4)-2)^7+2/2205(((x+2.5)mod4)-2)^5+1163/8820(((x+2.5)mod4)-2)^3+237/245(((x+2.5)mod4)-2) from -2.5 to 10

This solution was obtained by:

(1) noticing that if we place the origin of a new coordinate system at $(-{1\over2},{3\over2})$, then in the new coordinates the curve is an odd function;

(2) determining the unknown coefficients of a 7th-degree polynomial by solving a system of linear equations, to satisfy conditions equivalent to $(*)$;

(3) transforming the result back into the $(x,y)$ coordinates;

(4) periodic continuation.

2
On

I am assuming the desired curve is a polynomial.

Any 4 points like this can be fitted to a cubic. So a cubic is sufficient.

There is a maximum between 0 and 2 and a minimum between 1 and 3. Since there are at least two points where f'(x) = 0, the curve is at least a cubic.

Therefore a cubic is the lowest degree polynomial that works.

Now go and find it.

1
On

Such an equation is not uniquely determined, without some structural constraints.

However, if restricted to polynomials, there is a unique polynomial $p(x)$ with rational coefficients and degree at most $3$ such that $$p(0)=2,\;\;p(1)=3,\;\;p(2)=0,\;\;p(3)=1$$ given by $$p(x)={\small{\frac{4}{3}}}x^3-6x^2+{\small{\frac{17}{3}}}x+2$$ obtained via the Lagrange Interpolation formula:

$\qquad$ https://en.wikipedia.org/wiki/Lagrange_polynomial

The graph of $p$ does go through the required points, and its shape resembles the one you show in your posted image, but the relative extreme points of $p$ are not exactly the same as the ones in that image.

Also, your latest edit indicates that you want the function to be periodic function with period $4$, and everywhere nonnegative. Of course, a non-constant polynomial can't match those additional conditions. But I'll leave my answer in place, since it addresses the question as it was before the latest edit.

As to whether a polynomial exists which matches both the value conditions and the relative extrema conditions, I'm not sure, but I've posed that question (i.e,. $P$ restricted to polynomials, and matching values as well as relative extrema)

$\qquad$Finding a polynomial with a given shape

as a followup to your question

0
On

If you're looking for a periodic function of period $4$, you might try something like $$ f(x) = \frac{3}{2} + \cos\left(\frac{\pi x}{2}\right) + \sin \left(\frac{\pi x}{2}\right) - \frac{\cos (\pi x)}{2} $$

1
On

The $\color{blue}{@marty cohen}$ solution:

Problem specification

We start with a sequence of $m=4$ measurements of the form $\left\{ x_{k}, y_{k} \right\}_{k=1}^{m}$.

$$ y(x) = a_{0} + a_{1} x + a_{2} x^{2} + a_{3} x^{4} $$

Linear system $$ % \begin{align} % \mathbf{A} a &= y\\ % ATA \left[ \begin{array}{cccc} 1 & x_{1} & x^{2}_{1} & x^{3}_{1}\\ \vdots & \vdots & \vdots & \vdots \\ 1 & x_{m} & x^{2}_{m} & x^{3}_{m}\\ \end{array} \right] % a \left[ \begin{array}{ccc} a_{0} \\ a_{1} \\ a_{2} \\ a_{3} \end{array} \right] % &= % y \left[ \begin{array}{ccc} y_{1} \\ \vdots \\ y_{m} \end{array} \right] % \end{align} % $$

Normal equations $$ % \begin{align} % \mathbf{A}^{*} \mathbf{A} a &= \mathbf{A}^{*} y \\ % ATA \left[ \begin{array}{rrrr} 4 & 6 & 14 & 36 \\ 6 & 14 & 36 & 98 \\ 14 & 36 & 98 & 276 \\ 36 & 98 & 276 & 794 \\ \end{array} \right] % a \left[ \begin{array}{ccc} a_{0} \\ a_{1} \\ a_{2} \\ a_{3} \end{array} \right] % &= % ATy \left[ \begin{array}{ccc} 6 \\ 6 \\ 12 \\ 30 \end{array} \right] % \end{align} % $$

Least squares solution $$ % \begin{align} % a &= \left( \mathbf{A}^{*}\mathbf{A} \right)^{-1} \mathbf{A}^{*} y \\ % &= \frac{1}{18} \left[ \begin{array}{rrrr} 18 & -33 & 18 & -3 \\ -33 & 265 & -225 & 47 \\ 18 & -225 & 207 & -45 \\ -3 & 47 & -45 & 10 \\ \end{array} \right] % ATy \left[ \begin{array}{ccc} 6 \\ 6 \\ 12 \\ 30 \end{array} \right] \\ & = % \frac{1}{3} \left[ \begin{array}{r} 6 \\ 17 \\ -18 \\ 4 \end{array} \right] % \end{align} % $$

Solution function

$$ \boxed{y(x) = 2 + \frac{17}{3}x - 6x^{2} + \frac{4}{3} x^{3}} $$

Solution curve and data

cubic

As Marty noted, the solution is exact.