Possible to use object speed/acceleration as driver variable?
import bpy
import math

thecube = bpy.context.scene.objects['Cube']
def updateFramePlease():
    #get the values from these properties on this frame
    oxVal = bpy.context.scene.objects['Cube']['o_x']
    oyVal = bpy.context.scene.objects['Cube']['o_y']
    ozVal = bpy.context.scene.objects['Cube']['o_z']
    #get the current frame number
    cframe = bpy.context.scene.frame_current
    if cframe &gt; 1:
        #if the cube has had a chance to change position get the delta of those positions
        deltaX = abs(thecube.location.x - oxVal)
        deltaY = abs(thecube.location.y - oyVal)
        deltaZ = abs(thecube.location.z - ozVal)
        #calculate the 3D linear distance travelled
        h1 = math.sqrt( (deltaX*deltaX) + (deltaY*deltaY) )
        h2 = math.sqrt( (h1*h1) + (deltaZ*deltaZ))
        #update the custom x,y,z fields before moving to the next frame
        bpy.context.scene.objects['Cube']['o_x'] = thecube.location.x
        bpy.context.scene.objects['Cube']['o_y'] = thecube.location.y
        bpy.context.scene.objects['Cube']['o_z'] = thecube.location.z
        bpy.context.scene.update()
        #answer the delta field request to have a value from this driver – Answer is the 3D linear distance
        return h2
    else:
        #if the cube has not had an opportunity to move
        return 0.0


# Add variable defined in this script into the drivers namespace.
bpy.app.driver_namespace["updateFramePlease"] = updateFramePlease


Here is everything in play:

Notice the bottom right hand corner, see the purple field, and the three below it?
These are the property objects of the Cube. The purple indicates that there is a driver driving the value. To actually add the driver, you Right click on the value part of the field and select add driver. Then in the graph editor, make sure your graph type is Drivers, then select the property to drive at the top left of the screen. Then enter the function name as the expression and hit Enter. Over on the text editor, check register, and Run Script. Now increment the frame 1 step at a time, and pay attention to those properties on the lower right.



Here's the Blend File for reference:



And here is a link that basically seems to describe exactly what you are asking for in terms of the F-Curves:

F-Curves as Drivers