[Python ]How can I improve my 1D Kalman Filter estimate?
I believe ZHUANG's answer is correct, so I went searching for some source code in Python that implemented it.  The closest I could find was a 2D example that uses velocity as well.  The reference is at the top of the listing.  I have reformatted and restructured the code to make it more readable to me and likely more efficient.  I also adapted it to the OPs function.

I am a newbie to Kalman filters.  I am using this as my learning tool.  It can probably be improved upon greatly.  I am posting it hoping that it will be helpful to the OP as well as others.

Ced



# Derived from:
# https://stackoverflow.com/questions/13901997/kalman-2d-filter-in-python
#   and
# https://dsp.stackexchange.com/questions/48343

import numpy as np
import matplotlib.pyplot as plt

#=============================================================================
def main():

#---- Set Parameters

        N = 50

        x = np.matrix( '0. 0. 0. 0.' ).T 
        P = np.matrix( np.eye( 4 ) ) * .0001000 # initial uncertainty

        R = 0.1**2

#---- Set up Helper Matrices

        F = np.matrix( '''
            1. 0. 1. 0.;
            0. 1. 0. 1.;
            0. 0. 1. 0.;
            0. 0. 0. 1.
            ''' )

        H = np.matrix( '''
            1. 0. 0. 0.;
            0. 1. 0. 0.''' )

        motion = np.matrix( '0. 0. 0. 0.' ).T

        Q = np.matrix( np.eye( 4 ) )

        m = np.matrix( '0. 0.' ).T

#---- Create the Test Case

#        true_x = np.linspace( 0.0, 10.0, N )
#        true_y = true_x**2

#        observed_x = true_x + 0.05 * np.random.random( N ) * true_x
#        observed_y = true_y + 0.05 * np.random.random( N ) * true_y

        sz = (N) # size of array

        true_x = np.linspace( 0.0, 10.0, N )
        true_y = true_x + 2 * true_x**2

        observed_x = true_x
        observed_y = true_y + np.random.normal( 0, 7.5, size=sz )

#---- Run the Sequence

        kalman_x = np.zeros( N )
        kalman_y = np.zeros( N )

        for n in range( N  ):
            m[0] = observed_x[n]
            m[1] = observed_y[n]
            x, P = kalman( x, P, m, R, motion, Q, F, H )
            kalman_x[n] = x[0]
            kalman_y[n] = x[1]

#---- Plot the Results

#        plt.plot( observed_x, observed_y, 'ro' )
#        plt.plot( kalman_x, kalman_y, 'g-' )
#        plt.show()

        plt.figure()
        plt.plot( true_x, observed_y,'k+',label='noisy measurements')
        plt.plot( true_x, kalman_y,'b-',label='a posteri estimate')
        plt.plot( true_x, true_y,color='g',label='truth value')
        plt.legend()
        plt.xlabel('t')
        plt.ylabel('f(t)')

        plt.show()

#=============================================================================
#def kalman( x, P, measurement, R, motion, Q, F, H ):
def kalman( x, P, m, R, motion, Q, F, H ):
        '''
        Parameters:
        x: initial state
        P: initial uncertainty convariance matrix
        measurement: observed position ( same shape as H * x )
        R: measurement noise ( same shape as H )
        motion: external motion added to state vector x
        Q: motion noise ( same shape as P )
        F: next state function: x_prime = F * x
        H: measurement function: position = H * x

        Return: the updated and predicted new values for ( x, P )

        See also http://en.wikipedia.org/wiki/Kalman_filter

        This version of kalman can be applied to many different situations by
        appropriately defining F and H 
        '''

#---- UPDATE x, P based on measurement m    
#            distance between measured and current position-belief

        y = m - H * x

        S = H * P * H.T + R  # residual convariance
        K = P * H.T * S.I    # Kalman gain

        x = x + K * y
        I = np.matrix( np.eye( F.shape[0] ) ) # identity matrix
        P = ( I - K * H ) * P

#---- PREDICT x, P based on motion

        x = F * x + motion
        P = F * P * F.T + Q

#---- Exit

        return x, P

#=============================================================================
main()