Designing a symmetric function

86 Views Asked by At

I need to design an analytical function that looks like this (See figure bellow). The idea is to control the angles "a" at the beginning and at the end. If the function depends on x (any kind of parameter, angle, value in [-1,1], etc.), we should have f(x) symmetric to f(-x) towards the line y=-x+1 (orange line). I mean, I should be able to build in some ways with the symmetric function. For instance, we have x^2 symmetric to x^(1/2).

I can build this function with a Bezier curve, but I need an analytical form that would give something close to the Bezier solution.

Thanks :)

enter image description here

2

There are 2 best solutions below

7
On

A solution is a quadratic Bezier curve (a parabola), with control points $(0, 0)$, $(p, 1-p)$ and $(1, 1)$. The initial slope of this curve is $\frac{dy}{dx}=\frac{1-p}{p}=\tan(a+45°)$.

UPDATE: a more direct approach to the parabola.

Rotate the axis by $45°$ clockwise to make the axis of the parabola vertical. The equation is $v=\lambda u(\sqrt2-u)$, with the initial slope $\frac{dv}{du}=\lambda\sqrt2=\tan a$.

Then counter rotate using $u=\frac{x+y}{\sqrt2}$ and $v=\frac{y-x}{\sqrt2}$:

$$2(y-x)=\tan a(x+y)(2-x-y),$$

$$(\tan a)\ y^2\ +2(1-\tan a\ (1-x))\ y-(2x-\tan a\ x(2-x))=0.$$

1
On

To simplify the solution, we assume that $0\le x\le 1$ and $0\le f(x)\le 1$. From your figure we obtain $f(0)=0$ and $f(1)=1$.

Now consider function $g(\xi)=f(\xi)-\xi$. We have $g(0)=g(1)=0$. It is represented by the red curve but viewed from a frame that the dotted line is the $\xi$-axis.

Setting $$g(\xi)=b+c \xi^2\text{ (1)}$$ and requiring that $$\frac{dg(\xi)}{d\xi}=\tan(a),\text{ } g(0)=0$$

We obtain: $$b=-\frac{\tan a}{2^{3/2}},\text{ }c=\frac{\tan a}{2^{1/2}}$$

Thus $f(x)=x+g(x)$ is probably the simplest curve that satisfies your criteria.

If you have other requirements, you may add higher order even terms in the expression (1).