I have some python code here
Code:
t = 1
xt = array([ -1.,-1. ])
xt[0] = theta[0][0]* P_all_States[t-1][0] + theta[1][0]*P_all_States[t-1][1]
xt[1] = theta[0][1]* P_all_States[t-1][0] + theta[1][1]*P_all_States[t-1][1]
P_all_States[t][0] = xt[0]
P_all_States[t][1] = xt[1]
print ("Added probability distribution for time t = " + str(t) + " to P_all_States")
print P_all_States
Output:
Added probability distribution for time t = 1 to P_all_States [[0.6, 0.4], [0.62000000000000011, 0.38000000000000006], [-1.0, -1.0], [-1.0, -1.0], [-1.0, -1.0], [-1.0, -1.0]]
How can I get the floating point numbers to round to 2 sigficant digits?
These are all floats, so Im not looking to convert these to strings, I want them to remain as floats
Thanks