Last active
August 29, 2015 14:25
-
-
Save evanbiederstedt/27e52a63ebbe2d297017 to your computer and use it in GitHub Desktop.
What is the value of the x^T C^-1 x term at the best-fit point? And what is its value when you reduce C_3 by ten percent?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C3_sample1 = 4e-8 | |
sigma2samples1 = np.linspace(1e-22, 6e-23, num=40) | |
# param is our parameter, C_3 | |
Sij = C3_sample1 * norm_matrix[1][None, :, :] | |
newSij = (1e22)*Sij # multiply S_ij by 1e12 | |
Nij = sigma2samples1[:, None, None] * id_mat[None, :, :] | |
newNij = (1e22)*Nij | |
# Format 7/4pi * param * P_3(M) where param is the parameter we vary, C_l | |
# Sij.shape = (40, 3072, 3072) | |
Cij = newSij + newNij | |
#invCij = np.linalg.inv(Cij) | |
logdetC = np.linalg.slogdet(Cij) # returns sign and determinant; use logdetC[1] | |
# model_fit_terms = m^T C^-1 m | |
# | |
# model_fit_terms = np.array([np.dot(tempval.T , np.dot(invCij[i] , tempval) ) | |
# for i in range(invCij.shape[0])]) | |
# | |
model_fit_terms = np.array([np.dot(tempp.T , np.linalg.solve(Cij[i], tempp) ) for i in range(Cij.shape[0]) ]) | |
print model_fit_terms | |
OUTPUT IS: | |
[ -6.54990301e+05 -6.54990301e+05 1.19083809e+05 1.19083809e+05 | |
1.19083809e+05 -8.52103763e+05 -8.52103763e+05 -8.52103763e+05 | |
-9.70917894e+05 -9.70917894e+05 -9.70917894e+05 -1.77769621e+06 | |
-1.77769621e+06 -1.77769621e+06 -3.93333671e+07 -3.93333671e+07 | |
-3.93333671e+07 -5.58136674e+05 -5.58136674e+05 -5.58136674e+05 | |
-3.16037652e+06 -3.16037652e+06 -3.16037652e+06 -1.86591114e+04 | |
-1.86591114e+04 -1.86591114e+04 1.01764609e+06 1.01764609e+06 | |
1.01764609e+06 1.98358099e+05 1.98358099e+05 1.98358099e+05 | |
-1.40628207e+06 -1.40628207e+06 -1.40628207e+06 -1.40628207e+06 | |
5.09936449e+06 5.09936449e+06 5.09936449e+06 -1.73093522e+06] | |
For 3.6e-08, OUTPUT IS: | |
[ 216652.36865427 216652.36865427 7229836.39263844 7229836.39263844 | |
7229836.39263844 4440519.06167877 4440519.06167877 4440519.06167877 | |
1256311.03694729 1256311.03694729 1256311.03694729 4807585.29728004 | |
4807585.29728004 4807585.29728004 7138847.36595693 7138847.36595693 | |
7138847.36595693 850361.20217029 850361.20217029 850361.20217029 | |
-2355755.45923652 -2355755.45923652 -2355755.45923652 -1296041.99250639 | |
-1296041.99250639 -1296041.99250639 658522.94116765 658522.94116765 | |
658522.94116765 -5030606.16602418 -5030606.16602418 -5030606.16602418 | |
-138380.29050851 -138380.29050851 -138380.29050851 -138380.29050851 | |
-1138487.77807789 -1138487.77807789 -1138487.77807789 -1134975.40711535] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment