Trapezoidal rule for set of data
Just a few things I noticed.

Utilize built in functions

This

S = 0
for k in range(1, N):
    S += function[a + k * h]


can be this

S = sum(function[a + k * h] for k in range(1, N))


Python3's sum takes an iterable, and returns the sum of all the values in that iterable. So, you can pass in the for loop and it will return the sum for you. Looks neater, too.

Operator Spacing

There should be a space before and after every operator and equal sign. Here's an example from your code:

d = 1/2 * h * (function[a + k*h] + function[a + (k+1) * h])


This should be 

d = 1/2 * h * (function[a + k * h] + function[a + (k + 1) * h])


Spacing just helps you and other programmers read your code.

This, however, doesn't apply when passing default parameters. Have a look:

plot(time, distance, "g--", label = "position") # WRONG
plot(time, distance, "g--", label="position") # RIGHT


Variable Naming

A lot of single character variable names can confuse you, and make a program hard to read. I see you have comments such as #x_initial and #x_final. Why not use those as variable names? They're a lot more concise than a and b. h can also be something like diff.