I have another simple matplotlib example, based on the parabola post from the other day (here). The conclusion from that post was that any function:
can be manipulated to the form:
That is, the parabola is just
y = a(x)2
translated to have a different vertex. I didn't do a systematic examination or anything, but here is one example in Python.The function
quadratic
takes arguments a, b, and c
and returns the vertex (x0, y0)
as well as a numpy array containing x
such that |x - x0| <= 4
, and a second one containing f(x)
for each value of x
.We plot two sets of three parabolas, each set has one for each of
a = 1, 2 and 3
. One set is at the origin (cyan, blue and purple). The second set (magenta, salmon and red) has c = 3
and:Since
x0 = -b/2a
is the same for each parabola in the second set, they all have the same axis of symmetry. The only difference (besides the shape parameter a
) is y0
, which can be calculated either from plugging a, b, c and x0
into the standard form, or by using the fact thatUsing the second method, I get:
We ought to be able to solve for b and c to put the parabola anywhere on the x,y-plane..
UPDATE: