# Given a cubic function, and its quadratic derivative- can I recover the cubic from quadratic?

Background: I'm trying to learn how to work with cubic and quadratic bezier splines for various drawing libraries, and working through how to approximate a cubic spline with a quadratic spline. It's occured to me that it should be possible to approximate any continuous parametric function with an arbitrary series of interconnected quadratic splines, as long as you have a suitable fitness function for each section.

It has further occured to me that the derivative of any cubic spline is expressible as a quadratic spline. So now I am curious.

if I have an abitrary function f(t); its derivative f'(t); and I can approximate f'(t) with a series of quadratic splines... can I have some way of assuming those quadratics as derivatives of cubics, and directly compute a series of cubics that then approximates f(t) from the quadratics?

is there something wrong with my reasoning here?

(edited for brevity)

(clarification) I mentioned I was working through how to approximate a cubic spline with a quadratic spline. Let us assume for the purposes of this question that I have already solved this problem, and I have a procedure P which takes any arbitrary function f(t) (which could be a cubic spline, or anything else) with the constraint that we will only approximate over intervals where f'(t) is continuous.

The question therefore is not how do I approximate a cubic with a quadric but, given that I have procedure P, if I apply procedure P to f'(t) to compute a series of quadratic splines, can I use that information to recover a cubic spline approximation of f(t).

From the answers, if I am understanding corrrectly, I think that I can so long as I can still use f(t) to recover this "integral constant". This is an acceptable solution since what I want is something like a procedure P2 which can take a f(t) and give me a sequence of cubic splines which approximate it.

edit: further, it seems that if we have f(t) and its f'(t) and its f''(t) we could even do a straight forward linear approximation of f''(t) and recover a cubic spline approximation of f(t) by solving for the integral constants in f'(t) and f(t). neat.

-
A spline is a curve that goes through some given data points. The derivative of a cubic function is certainly a quadratic function, but the quadratic won't go through the same data points as the cubic, so I don't see the derivative of a cubic spline being a quadratic spline (for the same data points). –  Gerry Myerson Jun 18 '12 at 3:21
@GerryMyerson: The OP seems to be asking whether, if you have a quadratic spline for f'(t), you can find a cubic spline for f(t): this makes sense: if you have a cubic function approximating a set of points given by a curve f(t), then the quadratic function that is its derivative will also approximate the set of points given by the other curve f'(t), though it may not be (AFAICT) the best quadratic approximation unless the cubic function was already exact for f(t). –  ShreevatsaR Jun 18 '12 at 3:32
@ShreevatsaR You are correct that is what I am asking. Thanks for that. –  Breton Jun 18 '12 at 4:10
@Breton I'm not entirely sure if I understand or can answer your question, but if you don't find my answer satisfactory, I suggest that you un-accept it, as to let others know that this question remains unanswered. –  talmid Jun 18 '12 at 4:54
@talmid no no, you certainly understood my question well enough and you have answered it to my satisfaction. –  Breton Jun 18 '12 at 5:10

In general, we can only recover $f$ from $f'$ up to a constant summand, the famous constant of integration. For example, $x^3 + 2x + 4$ and $x^3 + 2x - 5$ have the same derivative, $3x^2 + 2$. Suppose we have a derivative of second degree $f' = ax^2 + bx + c$. Then, $f$ could be any of $\frac{1}{3}ax^3 + \frac{1}{2}bx^2 + cx + d$, with $d \in \mathbb{R}$. So, in order to uniquely recover $f$, we would have to find $d$. We need more information; the derivative is never enough to determine the original function.
If, for example, we know the value of $f$ at any point $x_0$, we can get the original function back, because we could then pose the equation $f(x_0) = \frac{1}{3}ax_0^3 + \frac{1}{2}bx_0^2 + cx_0 + d$ and solve for $d$.
Edit: Ok, so I'm a bit confused about what you're asking, to be honest. I don't know if my answer is relevant, but I'd like to add a third comment regarding the same issue: if we have a spline for $f'$, we won't be able to get a spline for $f$ if we don't have any further information; because the spline for $f'$ is also a spline for $(f+C)'$, with $C \in \mathbb{R}$ any constant, but it's certainly not true that there's one unique spline that works for all such $f+C$. In any case, you need more information about $f$, something that goes beyond what you can deduce from $f'$.