
def update(mean1, var1, mean2, var2):
    new_mean = (var2 * mean1 +var1 * mean2)/(var1 + var2)
    new_var =  1 / (1 / var1 + 1 / (var2))
    return [new_mean, new_var]

def predict(mean1, var1, mean2, var2):
	# Write a program to update your mean and variance
	# when given the mean and variance of your belief
	# and the mean and variance of your measurement.
	# This program will update the parameters of your
	# belief function.
    new_mean = mean1 + mean2
    new_var =  var1 + var2
    return [new_mean, new_var]
# Write a program that will iteratively update and
# predict based on the location measurements 
# and inferred motions shown below. 
measurements = [5., 6., 7., 9., 10.]
motion = [1., 1., 2., 1., 1.]
measurement_sig = 4.
motion_sig = 2.
mu = 0.
sig = 10000.

for n in range(len(measurements)):
	[mu,sig] = update(mu,sig,measurements[n],measurement_sig)
	print('update: ',[mu,sig])
	[mu,sig] = predict(mu,sig,motion[n],motion_sig)
	print('predict: ',[mu,sig])





























ff81171509424446f09ada7d921b12d5f07d3f2a
def update(mean1, var1, mean2, var2):
    new_mean = (var2 * mean1 + var1 * mean2) / (var1 + var2)
    new_var = 1 / (1 / var1 + 1 / var2)
    return [new_mean, new_var]


<mask token>

def update(mean1, var1, mean2, var2):
    new_mean = (var2 * mean1 + var1 * mean2) / (var1 + var2)
    new_var = 1 / (1 / var1 + 1 / var2)
    return [new_mean, new_var]


def predict(mean1, var1, mean2, var2):
    new_mean = mean1 + mean2
    new_var = var1 + var2
    return [new_mean, new_var]


<mask token>

def update(mean1, var1, mean2, var2):
    new_mean = (var2 * mean1 + var1 * mean2) / (var1 + var2)
    new_var = 1 / (1 / var1 + 1 / var2)
    return [new_mean, new_var]


def predict(mean1, var1, mean2, var2):
    new_mean = mean1 + mean2
    new_var = var1 + var2
    return [new_mean, new_var]


<mask token>
for n in range(len(measurements)):
    [mu, sig] = update(mu, sig, measurements[n], measurement_sig)
    print('update: ', [mu, sig])
    [mu, sig] = predict(mu, sig, motion[n], motion_sig)
    print('predict: ', [mu, sig])

def update(mean1, var1, mean2, var2):
    new_mean = (var2 * mean1 + var1 * mean2) / (var1 + var2)
    new_var = 1 / (1 / var1 + 1 / var2)
    return [new_mean, new_var]


def predict(mean1, var1, mean2, var2):
    new_mean = mean1 + mean2
    new_var = var1 + var2
    return [new_mean, new_var]


measurements = [5.0, 6.0, 7.0, 9.0, 10.0]
motion = [1.0, 1.0, 2.0, 1.0, 1.0]
measurement_sig = 4.0
motion_sig = 2.0
mu = 0.0
sig = 10000.0
for n in range(len(measurements)):
    [mu, sig] = update(mu, sig, measurements[n], measurement_sig)
    print('update: ', [mu, sig])
    [mu, sig] = predict(mu, sig, motion[n], motion_sig)
    print('predict: ', [mu, sig])


def update(mean1, var1, mean2, var2):
    new_mean = (var2 * mean1 +var1 * mean2)/(var1 + var2)
    new_var =  1 / (1 / var1 + 1 / (var2))
    return [new_mean, new_var]

def predict(mean1, var1, mean2, var2):
	# Write a program to update your mean and variance
	# when given the mean and variance of your belief
	# and the mean and variance of your measurement.
	# This program will update the parameters of your
	# belief function.
    new_mean = mean1 + mean2
    new_var =  var1 + var2
    return [new_mean, new_var]
# Write a program that will iteratively update and
# predict based on the location measurements 
# and inferred motions shown below. 
measurements = [5., 6., 7., 9., 10.]
motion = [1., 1., 2., 1., 1.]
measurement_sig = 4.
motion_sig = 2.
mu = 0.
sig = 10000.

for n in range(len(measurements)):
	[mu,sig] = update(mu,sig,measurements[n],measurement_sig)
	print('update: ',[mu,sig])
	[mu,sig] = predict(mu,sig,motion[n],motion_sig)
	print('predict: ',[mu,sig])




























