Sorry if this is a really simple question, but I was looking for an equation to produce a non-symmetrical parabola. (The left side of the parabola would have a different 'slope' than the right side of the parabola)
Thanks!
Edit: If I clarify the purpose of this, it may help people understand my problem better. I'm trying to make a physics engine for a game, where the character can jump. The parabola-shape will represent the jump arc - it takes more time to jump up (to the vertex) than it does to fall down (to the x-intercept). Because of this, I'd like the y-intercept and first x-intercept to be at the origin, and move up from there.
$\endgroup$ 44 Answers
$\begingroup$You can stitch a Frankenbola together like this. $$ f(x) = \begin{cases} a_l x^2 + b_l x + c_l & \text{for } x < 0 \\ a_r x^2 + b_r x + c_r & \text{for } x > 0 \\ c & \text{for } x = 0 \end{cases} $$ You can require continuity for $f$ then you get $$ f(x) = \begin{cases} a_l x^2 + b_l x + c & \text{for } x < 0 \\ a_r x^2 + b_r x + c & \text{for } x > 0 \\ c & \text{for } x = 0 \end{cases} $$ However your derivative looks like $$ f'(x) = \begin{cases} 2 a_l x + b_l & \text{for } x < 0 \\ 2 a_r x + b_r & \text{for } x > 0 \\ b & \text{for } x = 0 \end{cases} $$ You can ask for continuity for $f'$ too and get $$ f'(x) = \begin{cases} 2 a_l x + b & \text{for } x < 0 \\ 2 a_r x + b & \text{for } x > 0 \\ b & \text{for } x = 0 \end{cases} $$ Which gives you this $f''$: $$ f''(x) = \begin{cases} 2 a_l & \text{for } x < 0 \\ 2 a_r & \text{for } x > 0 \\ a & \text{for } x = 0 \end{cases} $$ You could require continuity again, but then you end up with a symmetrical parabola.
So it is up to you where to give up continuity.
$\endgroup$ 1 $\begingroup$I'm going assume that you mean symmetric along a fixed $x$ value.
What you can do to construct a parabola which does not have that is to start with one which has one and then apply a rotation of all points in the plane. Basically exchanging the old x and y coordinates with new ones according to the rotation:
$$x_{old} = \cos(\phi)x_{new} + \sin(\phi)y_{new}$$ $$y_{old} = -\sin(\phi)x_{new} + \cos(\phi)y_{new}$$
So if the initial parabola is
$$y_{old} = (x_{old}-c)^2$$
you can just plug in the above and simplify to see what you get. It will be an equation involving $y_{new}$, $x_{new}$ and their squares and stuff.
$\endgroup$ $\begingroup$If you need something skew, looking roughly like a parabola, you could use higher polynomials: y(x) = $x^4 + 2x^3 + 3x^2$, or with other coefficients.
$\endgroup$ 3 $\begingroup$You can construct a function whose parts are all parabolas but the resulting graph will not be a parabola. For example:
$$f(x)= \begin{cases} x^{2} &\text{if}\,\,x\le 0\\ 2x^{2} &\text{if}\,\, x> 0 \end{cases}$$
In a more general way, you can define
$$p(x)=\sum_{i}\left(\mathbb{I}_{[a_{i},b_{i})}(x)\right)(\alpha_{i} x^{2}+\beta_{i})$$ where $$\mathbb{I}_{[a_{i},b_{i})}(x)= \begin{cases} 1 &\text{if}\,\,x\in [a_{i},b_{i})\\ 0 &\text{if}\,\,x\notin [a_{i},b_{i}) \end{cases}$$ and $[a_{i},b_{i})\cap[a_{j}, b_{j})=\emptyset$ for all $i\neq j$. By taking successively distinct $\alpha_{i},\beta_{i}$, you'll have a function whose parts are all parts of some parabola, but its graph will not be one.
$\endgroup$