Intereting Posts

Bounding $(x+y)^n$
elementary ways to show $\zeta(-1) = -1/12$
A convex optimization problem over two vectors
What is spectrum for Laplacian in $\mathbb{R}^n$?
How do you find the formula for an area of the circle through integration?
Are $(\mathbb{R},+)$ and $(\mathbb{C},+)$ isomorphic as additive groups?
If a sub-C*-algebra does not contain the unit, is it contained in a proper ideal?
$F$ has undecidable positive existential theory in the language $\{+, \cdot , 0, 1, t\}$
Proving a limit of a trigonometric function: $\lim_{x \to 2/\pi}\lfloor \sin \frac{1}{x} \rfloor=0$
How to check if a 8-puzzle is solvable?
Definition of Ordinals in Set Theory in Layman Terms
solutions of $a^2+b^2=c^2$
Inequality with five variables
Can different choices of regulator assign different values to the same divergent series?
definition of a free object in a category

Given 3 pairs of coordinates, $x_1, y_1, x_2, y_2, x_3, y_3$, I need a function $y(x)$ that will return the $y$ coordinate of any $x$ coordinate between $x_1$ and $x_3$ (it can be assumed that $x_1 < x_2 < x_3$).

$y(x_1)$ must equal $y_1$, $y(x_2)$ must equal $y_2$, and $y(x_3)$ must equal $y_3$.

**However**, it must never return a $y$ coordinate that is larger than the largest of $y_1$, $y_2$, and $y_3$, or smaller than the smallest of $y_1$, $y_2$, and $y_3$. This is the part which I have not yet figured out how to do.

(This is not schoolwork. I’m writing an audio creation library, and these curves will be used to define volume over time.)

- Solving the curve equation for logarithmic decay using two anchor points.
- Divisor on curve of genus $2$
- Why is it so difficult to find beginner books in Algebraic Geometry?
- Computing the monodromy for a cover of the Riemann sphere (and Puiseux expansions)
- Intuitive explantions for the concepts of divisor and genus
- Nonsingular projective variety of degree $d$

- Solution of $ f \circ f=f'$
- Is $M_g$ NEVER proper? And why does $T_g$ contain products?
- Confusion about the definition of function
- Predicate logic for statements about functions?
- What is $\arctan(x) + \arctan(y)$
- Finding the inverse of $f(x) = x^3 + x$
- What are functions used for?
- Function mapping challange
- Real analytic $f$ satisfying $f(2x)=f(x-1/4)+f(x+1/4)$ on $(-1/2,1/2)$
- How does one calculate genus of an algebraic curve?

What you apparently want is a monotonic interpolation scheme. As mentioned already, fitting a single polynomial to your data will result in an interpolant that does not necessarily satisfy your constraints. Using a piecewise polynomial function (a function that has a different polynomial representation at each interval) should do a better job.

Classically, the most-used class of piecewise polynomial functions is the piecewise cubic Hermite interpolant, whose representation in an interval $[x_i,x_{i+1}]$ looks like

$y_i+y_i^{\prime}\left(x-x_i\right)+c_i\left(x-x_i\right)^2+d_i\left(x-x_i\right)^3$

where

$c_i=\frac{3s_i-2y_i^\prime-y_{i+1}^\prime}{x_{i+1}-x_i}$

$d_i=\frac{y_i^\prime+y_{i+1}^\prime-2s_i}{\left(x_{i+1}-x_i\right)^2}$

$s_i=\frac{y_{i+1}-y_i}{x_{i+1}-x_i}$

and ${y_i^\prime,y_{i+1}^\prime}$ are the slopes (derivative values) of your interpolant at the corresponding points $(x_i,y_i)$, $(x_{i+1},y_{i+1})$.

Now, you will rightly ask, “how do I determine the $y_i^\prime$?” There are a number of schemes to do this: one of the most popular is the cubic spline, which imposes the additional constraint that the interpolant have two continuous derivatives. The problem with this approach is that there can still be extraneous wiggles in your interpolant.

One approach to ensure the monotonicity (i.e. the curve representing your data to fit against has no spurious wiggles) of your piecewise cubic Hermite interpolant is to use the Stineman scheme. The formula for computing slopes is a bit more elaborate, so I’ll just have to refer you to the paper. As an aside, Stineman also proposes a *rational* interpolant you can use with the slope determination scheme in the linked paper; you can try that one instead if for some reason using a piecewise Hermite cubic is unsatisfactory.

In general, no 2nd degree polynomial fits your requirements: If you fix its maximum/minimum at the highest/lowest of your three points, just one of the remaining two points would completely determine the curve due to its symmetry.

But if you want to use this to control volume, there are probably some additional side conditions that you need to consider anyway: If y2 is the highest point, you probably want the curve to have just one local maximum (at x2, then). I would also guess that the slope at x1 and x3 should be 0 (though that depends). In any case, you probably don’t want a polynomial. The simplest solution might be to take pieces of sine curves between $0$ and $\pi$, stretch them according to your values, and attach them at x2. You could also use splines, but then you explicitly need to fix the slope at x2 to be 0.

- What are well-defined functions?
- Simplifying Trig Product in terms of a single expression and $n$
- Halmos, Naive Set Theory, recursion theorem proof: why must he do it that way?
- Is “integrability” equivalent to “having antiderivative”?
- Convolution is uniformly continuous and bounded
- Summing digits of powers of 2 to get 1 2 4 8 7 5 pattern
- probability of A dice with X faces beating B dice with Y faces
- Compound Poisson process: calculate $E\left( \sum_{k=1}^{N_t}X_k e^{t-T_k} \right)$, $X_k$ i.i.d., $T_k$ arrival time
- How to prove that inverse Fourier transform of “1” is delta funstion?
- Prove that a sequence is a Cauchy sequence.
- Finding $E\Bigl(\overline{Y^2}\Bigm|\overline{Y\vphantom{Y^2}}\Bigr)$ by Basu's theorem?
- proving the function $\frac{1}{1+x^2}$ is analytic
- When is $\sin(x) = \cos(x)$?
- Prove that $X'$ is a Banach space
- If $A$ is normal, then $A(M)\subset M \Rightarrow A(M^{\perp})\subset M^{\perp}$.