# Trying to figure out Speed, given Value

Hi,

so this is something I fear may not be possible with the approach I've taken so far; but what I'm trying to do is graph the speed of change of a value..

In the example I've attached I used a Timelines patch to create a value curve, and it's inside an Iterator to generate a dot graph. What I'm trying to figure out is how I can get the derivative of this curve: the curve of the slope of this curve.

In this example, where the value curve begins and ends with a slope of 0, the speed curve should look like a large arch, starting at 0,0, arching up to some point in the middle and back down to end at 1,0

I realize there's a Derivator patch but I don't get how it works...

Any tips?

PreviewAttachmentSize
ValueNoSpeed.qtz3.25 KB

## Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

### Re: Trying to figure out Speed, given Value

My suggestion is define your curve with a mathematical expression in JS patch (or maths expression patch). Then you can work out your derivative expression off-line and place it in the JS patch (or a second maths expression patch) and feed it the same time based values.

NB. JS patch uses Radians and Maths Patch uses Degrees when doing trig.

Otherwise you are going to have to estimate 'speed' or derivative over a given period of time by sampling before and after a given event and use the delta in 'Y' over delta in 'X' to find slope or speed at any given value for 'X' where x is the time-based value.

http://en.wikipedia.org/wiki/Derivative

PreviewAttachmentSize
derivative.qtz21.61 KB
derivative complex f(x).qtz16.91 KB

### Re: Trying to figure out Speed, given Value

Thanks usefuldesign --

yet again I had to spend some time with Wikipedia and remember the math I did in high school! I've been able to write the derivative forms for all the curve types I'm using except bezier. I don't know how to correctly write the derivative of a parametric equation.

Does anyone know how to do this? I've attached a Grapher file which shows the equation I need the derivative of. The correct derivative definition will look like a large arch, being more curved if you decrease the value of p towards 0, I believe

PreviewAttachmentSize
Bezier.zip43.42 KB

### Re: Trying to figure out Speed, given Value

Have you tried employing following?

My maths is too rusty. I tried but it looks wrong check grapher file.

Try here looks promising: http://www.mathhelpforum.com/math-help/

Let me know how you went too… I love maths + QC even if I'm lame at maths these days.

PreviewAttachmentSize
Bezier m is what?.gcx_.zip91.25 KB

### Re: Trying to figure out Speed, given Value

Thanks usefuldesign,

I checked a ton of sites about doing derivatives on parametric equations but the result I get doesn't look right, so I'm failing to get something. I'll try that forum and let you know what comes out

In the meantime...anyone else who wants to take a stab at it...?

### Re: Trying to figure out Speed, given Value

Parametric derivatives of a Bezier curve are determined from its control points.

E.g

A curve of degree n with control points Pi, the first parametric derivative can be expressed as a curve of degree n − 1 with control points Di where Di = n(Pi+1 − Pi)

### Re: Trying to figure out Speed, given Value

Thanks cybero,

but I'm not quite sharp enough to to translate that in to a solution.

I was able to figure out the math for my bezier curve, using the explanation on this page:

http://www.moshplant.com/direct-or/bezier/math.html

...any chance you could put your explanation in those terms?

Thanks again

### Re: Trying to figure out Speed, given Value -- SOLVED

Figured it out; you can see in the pic the derivative curve. I got hung up on thinking that the derivative curve would also be parametric, but its not, it's a y vs. x curve. So, should be no problem graphing speed curves now....

PreviewAttachmentSize
bezierderiv.png133.51 KB