Vacuum Neutrino Oscillations

Here is a notebook for homogeneous gas model.

Here we are talking about a homogeneous gas bulk of neutrinos with single energy. The EoM is $$ i \partial_t \rho_E = \left[ \frac{\delta m^2}{2E}B ,\rho_E \right] $$

while the EoM for antineutrinos is $$ i \partial_t \bar\rho_E = \left[- \frac{\delta m^2}{2E}B ,\bar\rho_E \right] $$

Initial: Homogeneous, Isotropic, Monoenergetic $\nu_e$ and $\bar\nu_e$

The equations becomes $$ i \partial_t \rho_E = \left[ \frac{\delta m^2}{2E} B ,\rho_E \right] $$ $$ i \partial_t \bar\rho_E = \left[- \frac{\delta m^2}{2E}B,\bar\rho_E \right] $$

Define $\omega=\frac{\delta m^2}{2E}$, $\omega = \frac{\delta m^2}{-2E}$, $\mu=\sqrt{2}G_F n_\nu$ $$ i \partial_t \rho_E = \left[ \omega B ,\rho_E \right] $$ $$ i \partial_t \bar\rho_E = \left[\bar\omega B,\bar\rho_E \right] $$

where

$$ B = \frac{1}{2} \begin{pmatrix} -\cos 2\theta_v & \sin 2\theta_v \\ \sin 2\theta_v & \cos 2\theta_v \end{pmatrix} = \begin{pmatrix} -0.38729833462 & 0.31622776601\\ 0.31622776601 & 0.38729833462 \end{pmatrix} $$$$ L = \begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix} $$

Initial condition $$ \rho(t=0) = \begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix} $$

$$ \bar\rho(t=0) =\begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix} $$

define the following quantities

  1. hbar$=\hbar$ %2. delm2E$= \delta m^2/2E$ %3. lamb $= \lambda$, lambb $= \bar\lambda$ %4. gF $= G_F$ %5. mu $=\mu$
  2. omega $=\omega$, omegab $=-\bar\omega$

Numerical


In [1]:
# This line configures matplotlib to show figures embedded in the notebook, 
# instead of opening a new window for each figure. More about that later. 
# If you are using an old version of IPython, try using '%pylab inline' instead.
%matplotlib inline
%load_ext snakeviz

import numpy as np
from scipy.optimize import minimize
from scipy.special import expit
import matplotlib.pyplot as plt

from matplotlib.lines import Line2D

import timeit

import pandas as pd

import plotly.plotly as py
from plotly.graph_objs import *
import plotly.tools as tls

In [2]:
# hbar=1.054571726*10**(-34)
hbar=1.0
delm2E=1.0
# lamb=1.0  ## lambda for neutrinos
# lambb=1.0 ## lambda for anti neutrinos
# gF=1.0
# nd=1.0  ## number density
# ndb=1.0   ## number density
omega=1.0
omegab=-1.0

## Here are some matrices to be used

elM = np.array([[1.0,0.0],[0.0,0.0]])
bM = 1.0/2*np.array( [ [ - 0.38729833462,0.31622776601] , [0.31622776601,0.38729833462] ] )

## sqareroot of 2
sqrt2=np.sqrt(2.0)

Using Mathematica, I can find the 4*2 equations


In [3]:
#r11prime(t)

## The matrix eqn for neutrinos. Symplify the equation to the form A.X=0. Here I am only writing down the LHS.
## Eqn for r11'
# 1/2*( r21(t)*( bM12*delm2E - 2*sqrt2*gF*rb12(t) ) + r12(t) * ( -bM21*delm2E + 2*sqrt2*gF*rb21(t) ) - 1j*r11prime(t)  )
## Eqn for r12'
# 1/2*( r22(t)* ( bM12 ) )

### wait a minute I don't actually need to write down this. I can just do this part in numpy.

I am going to substitute all density matrix elements using their corrosponding network expressions.

So first of all, I need the network expression for the unknown functions.

A function is written as

$$ y_i= 1+t_i v_k f(t_i w_k+u_k) ,$$

while it's derivative is

$$v_k f(t w_k+u_k) + t v_k f(tw_k+u_k) (1-f(tw_k+u_k)) w_k .$$

Now I can write down the equations using these two forms.


In [4]:
def trigf(x):
    #return 1/(1+np.exp(-x)) # It's not bad to define this function here for people could use other functions other than expit(x).
    return expit(x)

In [5]:
## The time derivative part

### Here are the initial conditions

init = np.array( [[1,0],[0,0]] )


### For neutrinos

def rho(x,ti,initialCondition): # x is the input structure arrays, ti is a time point

    v11,w11,u11,v12,w12,u12,v21,w21,u21,v22,w22,u22 = x[:12]
        
    elem11= np.sum(ti * v11 * trigf( ti*w11 +u11 ) )
    elem12= np.sum(ti * v12 * trigf( ti*w12 +u12 ) )
    elem21= np.sum(ti * v21 * trigf( ti*w21 +u21 ) )
    elem22= np.sum(ti * v22 * trigf( ti*w22 +u22 ) )
    
    return initialCondition + np.array([[ elem11 , elem12 ],[elem21, elem22]])

In [6]:
## Test
xtemp=np.ones(120)
rho(xtemp,0,init)


Out[6]:
array([[ 1.,  0.],
       [ 0.,  0.]])

In [7]:
## Define Hamiltonians for both

def hamilv():
    return delm2E*bM

In [8]:
## The commutator

def commv(x,ti,initialCondition):
    
    return np.dot(hamilv(), rho(x,ti,initialCondition) ) - np.dot(rho(x,ti,initialCondition), hamilv() )

In [9]:
## Test

print bM

print hamilv()

print "neutrino\n",commv(xtemp,0,init)


[[-0.19364917  0.15811388]
 [ 0.15811388  0.19364917]]
[[-0.19364917  0.15811388]
 [ 0.15811388  0.19364917]]
neutrino
[[ 0.         -0.15811388]
 [ 0.15811388  0.        ]]

In [10]:
## The COST of the eqn set

regularization = 0.0001

def costvTi(x,ti,initialCondition): # l is total length of x
    
    v11,w11,u11,v12,w12,u12,v21,w21,u21,v22,w22,u22 = x[:12]

    fvec11 = np.array(trigf(ti*w11 + u11) )  # This is a vector!!!
    fvec12 = np.array(trigf(ti*w12 + u12) )
    fvec21 = np.array(trigf(ti*w21 + u21) )
    fvec22 = np.array(trigf(ti*w22 + u22) )
    
    costi11= ( np.sum (v11*fvec11 + ti * v11* fvec11 * ( 1 -  fvec11  ) * w11 ) + 1.0j*  ( commv(x,ti,initialCondition)[0,0] )  )  
    costi12= ( np.sum (v12*fvec12 + ti * v12* fvec12 * ( 1 -  fvec12  ) * w12 ) + 1.0j*  ( commv(x,ti,initialCondition)[0,1] )  )  
    costi21= ( np.sum (v21*fvec21 + ti * v21* fvec21 * ( 1 -  fvec21  ) * w21 ) + 1.0j*  ( commv(x,ti,initialCondition)[1,0] )  )  
    costi22= ( np.sum (v22*fvec22 + ti * v22* fvec22 * ( 1 -  fvec22  ) * w22 ) + 1.0j*  ( commv(x,ti,initialCondition)[1,1] )  )  

    
    return (np.real(costi11))**2 + (np.real(costi12))**2+ (np.real(costi21))**2 +  (np.real(costi22))**2 + (np.imag(costi11))**2 + (np.imag(costi12))**2+ (np.imag(costi21))**2 +  (np.imag(costi22))**2
    
    #return np.abs(np.real(costi11)) + np.abs(np.real(costi12))+ np.abs(np.real(costi21)) +  np.abs(np.real(costi22)) + np.abs(np.imag(costi11)) + np.abs(np.imag(costi12))+ np.abs(np.imag(costi21)) +  np.abs(np.imag(costi22))

    #return ( (np.real(costi11))**2 + (np.real(costi12))**2+ (np.real(costi21))**2 +  (np.real(costi22))**2 + (np.imag(costi11))**2 + (np.imag(costi12))**2+ (np.imag(costi21))**2 +  (np.imag(costi22))**2 )/v11.size + regularization * ( np.sum(v11**2)+np.sum(v12**2)+np.sum(v21**2) + np.sum(v22**2) + np.sum(w11**2) + np.sum(w12**2)+ np.sum(w21**2)+ np.sum(w22**2) )

In [11]:
costvTi(xtemp,2,init)


Out[11]:
5.9563317039229577

In [12]:
## Calculate the total cost

def costv(x,t,initialCondition):

    t = np.array(t)
    
    costvTotal = np.sum( costvTList(x,t,initialCondition)  )
        
    return costvTotal
    

def costvTList(x,t,initialCondition):  ## This is the function WITHOUT the square!!! 
        
    t = np.array(t)
    
    costvList = np.asarray([])
    
    for temp in t:
        tempElement = costvTi(x,temp,initialCondition)
        costvList = np.append(costvList, tempElement)
        
    return np.array(costvList)

In [13]:
ttemp = np.linspace(0,10)
print ttemp


[  0.           0.20408163   0.40816327   0.6122449    0.81632653
   1.02040816   1.2244898    1.42857143   1.63265306   1.83673469
   2.04081633   2.24489796   2.44897959   2.65306122   2.85714286
   3.06122449   3.26530612   3.46938776   3.67346939   3.87755102
   4.08163265   4.28571429   4.48979592   4.69387755   4.89795918
   5.10204082   5.30612245   5.51020408   5.71428571   5.91836735
   6.12244898   6.32653061   6.53061224   6.73469388   6.93877551
   7.14285714   7.34693878   7.55102041   7.75510204   7.95918367
   8.16326531   8.36734694   8.57142857   8.7755102    8.97959184
   9.18367347   9.3877551    9.59183673   9.79591837  10.        ]

In [14]:
ttemp = np.linspace(0,10)
print costvTList(xtemp,ttemp,init)
print costv(xtemp,ttemp,init)


[  2.18778658   2.69101119   3.17577819   3.62848532   4.04353065
   4.4219527    4.76937906   5.09396415   5.40471177   5.7103183
   6.01850406   6.33572211   6.66711949   7.01664398   7.38721874
   7.78093467   8.19923235   8.64306006   9.11300383   9.60939022
  10.1323652   10.6819532   11.25810034  11.86070545  12.48964177
  13.14477185  13.82595734  14.53306531  15.26597189  16.02456424
  16.80874131  17.61841376  18.45350348  19.3139428   20.19967349
  21.11064577  22.04681735  23.00815246  23.99462098  25.00619765
  26.04286137  27.10459457  28.19138266  29.30321359  30.44007738
  31.60196587  32.78887231  34.00079123  35.23771811  36.49964933]
765.886679446

In [ ]:

Minimization

Here is the minimization


In [15]:
tlin = np.linspace(0,15,80)
# tlinTest = np.linspace(0,14,10) + 0.5
# initGuess = np.ones(120)
initGuess = np.asarray(np.split(np.random.rand(1,360)[0],12))
    


costvF = lambda x: costv(x,tlin,init)
costvFTest = lambda x: costv(x,tlinTest,init)

In [17]:
print costv(initGuess,tlin,init)#, costv(initGuess,tlinTest,init)


 367610.666941

In [18]:
## %%snakeviz
# startCG = timeit.default_timer()
#costFResultCG = minimize(costF,initGuess,method="CG")
#stopCG = timeit.default_timer()

#print stopCG - startCG

#print costFResultCG

In [19]:
#%%snakeviz
#startBFGS = timeit.default_timer()
#costvFResultBFGS = minimize(costvF,initGuess,method="BFGS")
#stopBFGS = timeit.default_timer()

#print stopBFGS - startBFGS

#print costvFResultBFGS

In [20]:
%%snakeviz
startSLSQP = timeit.default_timer()
costvFResultSLSQP = minimize(costvF,initGuess,method="SLSQP")
stopSLSQP = timeit.default_timer()

print stopSLSQP - startSLSQP

print costvFResultSLSQP


1479.47530293
  status: 0
 success: True
    njev: 27
    nfev: 9786
     fun: 1.1689032426729573
       x: array([ -1.88788475e-02,   4.73007176e+00,   3.19479005e+00,
        -2.31134807e-02,   2.14586224e+01,   9.27084589e+00,
        -2.31134867e-02,   1.90342794e+01,   8.41622348e+00,
         1.88751604e-02,   1.03633649e+01,   4.58119903e+00,
         3.56875284e-01,   5.00352618e-01,   4.49314670e-01,
         1.09789529e-01,   8.64248268e-02,   9.12945423e-01,
         7.79673974e-01,   3.91570683e-01,   3.44360883e-01,
         7.90674687e-01,   2.60052721e-01,   2.39291096e-01,
         1.00417676e-01,   8.80390606e-01,   9.07187362e-01,
         2.44566996e-01,   8.13319693e-01,   7.51410145e-03,
         7.98116407e-01,   3.31929911e-01,   9.28633298e-01,
         1.14852679e-01,   3.81145178e-01,   8.32874196e-01,
         9.61608863e-01,   5.48771692e-01,   7.77438801e-01,
         4.47384069e-01,   2.72279123e-01,   8.93435338e-01,
         3.64733302e-01,   3.66137373e-01,   7.64384060e-01,
         4.42556810e-01,   3.88672148e-01,   7.06841199e-01,
         4.57060735e-01,   8.95157779e-01,   8.21502736e-01,
         9.64304681e-01,   9.79134641e-01,   6.41973790e-01,
         4.75630139e-01,   9.39734303e-01,   3.13038239e-01,
         7.61100395e-01,   9.11013866e-01,   7.32620613e-01,
         7.33390245e-01,   8.24461465e-01,   4.95809115e-01,
         3.38696719e-01,   1.86574802e-01,   4.11716321e-01,
         6.73811340e-01,   7.53419724e-01,   2.86301821e-01,
         1.89817791e-01,   8.50105985e-01,   2.16315881e-01,
         6.45374672e-01,   9.40453927e-01,   1.01646700e-01,
         1.94309355e-01,   5.21365718e-01,   3.77801829e-01,
         3.81687858e-01,   9.81791438e-01,   4.25421057e-01,
         2.32662476e-01,   3.48459005e-01,   1.08309268e-01,
         5.84800997e-01,   2.02582133e-01,   4.23700797e-01,
         1.54514423e-01,   4.11169271e-01,   4.05734136e-01,
         6.82372839e-01,   9.08288125e-01,   6.96440037e-01,
         9.76130810e-01,   6.28499574e-01,   5.29910934e-01,
         5.29198143e-01,   4.22597584e-01,   8.33177338e-01,
         4.25874550e-01,   6.68311047e-01,   6.05855363e-01,
         1.89719240e-01,   3.56529117e-01,   7.69103603e-01,
         6.75961665e-01,   8.51451924e-01,   7.72482367e-02,
         9.60959585e-02,   4.48036290e-01,   1.80172307e-01,
         1.71314641e-01,   3.79300500e-01,   5.37256721e-01,
         3.45102821e-01,   2.77046835e-02,   9.59724580e-01,
         4.90979102e-01,   2.60044989e-01,   3.84731571e-01,
         9.24029373e-01,   3.11452929e-01,   9.17579518e-01,
         4.88480706e-01,   3.66639744e-02,   3.63375566e-01,
         1.51405116e-01,   3.06835034e-01,   6.15478893e-01,
         7.83348685e-01,   2.61884510e-02,   1.53809740e-01,
         7.96863835e-02,   7.58140008e-01,   5.03559165e-01,
         9.57252372e-01,   6.35408267e-01,   7.76611251e-01,
         3.78797956e-01,   6.64851320e-01,   4.47781531e-01,
         1.58190376e-01,   4.40246451e-01,   5.32069201e-01,
         2.69923663e-01,   2.28909317e-01,   5.57759554e-01,
         7.77033677e-01,   9.51188628e-02,   1.82138290e-01,
         8.27147798e-01,   2.81140589e-01,   7.88671292e-01,
         1.70443830e-01,   3.67077199e-01,   7.94138327e-01,
         8.29891211e-01,   1.15810174e-01,   9.11685279e-01,
         9.37955131e-01,   8.29110833e-01,   5.71895944e-02,
         2.24549613e-01,   6.50438783e-01,   1.52816085e-01,
         5.89851797e-01,   6.19754375e-01,   7.29860511e-01,
         5.83059506e-01,   5.11378480e-01,   1.04594493e-01,
         9.13929793e-01,   7.66220484e-01,   1.55640983e-01,
         5.80973435e-01,   4.34790049e-01,   9.32062518e-01,
         4.18285416e-01,   9.67575138e-01,   2.93321731e-01,
         1.06000763e-01,   3.83357433e-01,   2.68332893e-01,
         1.48200793e-01,   4.68684823e-01,   6.70220680e-01,
         1.75643053e-01,   2.33848734e-01,   5.52054176e-01,
         1.30660487e-01,   9.26891376e-01,   2.58185564e-02,
         5.85938198e-01,   1.39234344e-01,   5.44901643e-01,
         7.62607248e-01,   1.64855538e-01,   2.76137298e-01,
         1.23937300e-01,   5.76470760e-01,   4.41605434e-01,
         1.66466616e-01,   4.46765194e-01,   7.49562145e-01,
         4.65528677e-01,   7.59381645e-01,   2.08670497e-01,
         1.56910025e-01,   6.71011049e-01,   3.95059849e-01,
         3.47516055e-01,   8.63518157e-01,   2.64595426e-01,
         5.79348364e-01,   4.96766366e-01,   2.10281280e-01,
         3.42392782e-01,   6.22104776e-01,   2.40582995e-01,
         4.37186711e-01,   9.76835278e-01,   9.81351577e-01,
         9.96684076e-01,   2.51093448e-01,   5.09287344e-01,
         5.21546326e-01,   3.02516362e-01,   5.79472880e-02,
         1.22935469e-01,   9.33905817e-01,   6.31595672e-01,
         6.73771420e-01,   3.51654567e-01,   1.08253251e-01,
         3.89836459e-01,   9.03693755e-01,   4.99366455e-01,
         1.93358123e-01,   9.26083816e-01,   8.84565724e-01,
         8.81049651e-01,   8.17235858e-01,   1.44787963e-01,
         6.23144401e-01,   5.75231339e-01,   3.53153129e-01,
         5.54389683e-01,   7.05536034e-01,   5.21503733e-01,
         2.74351019e-01,   2.23312411e-01,   5.85162511e-01,
         7.19577276e-01,   6.16658158e-01,   2.40581055e-01,
         6.67606988e-01,   8.94939996e-01,   3.37944224e-01,
         8.11172729e-01,   6.90348598e-01,   9.63657835e-01,
         4.56546388e-01,   8.54365222e-01,   9.02927727e-01,
         1.35379932e-01,   3.02410581e-01,   7.05715091e-01,
         8.05271634e-01,   2.01197848e-01,   6.33767822e-01,
         9.28701896e-01,   4.02806734e-01,   1.05904195e-02,
         4.40213183e-01,   1.12228971e-01,   3.75883207e-01,
         7.08570138e-01,   9.13402359e-01,   5.82206325e-01,
         2.92262888e-01,   5.06838095e-01,   4.57147788e-02,
         9.95119399e-01,   1.13608942e-01,   8.90427956e-01,
         7.65216929e-01,   7.20196558e-01,   7.30989894e-01,
         8.11896336e-01,   4.68656118e-01,   3.56896218e-01,
         9.54328447e-01,   5.81957406e-01,   1.34683848e-01,
         6.46623169e-01,   4.06120694e-01,   1.23588150e-01,
         3.25862931e-01,   2.74257781e-02,   8.41582857e-01,
         8.16802309e-01,   3.87413200e-01,   1.72465579e-01,
         1.13966017e-02,   7.88643993e-01,   9.17014068e-01,
         6.65968530e-02,   6.64600014e-01,   5.95560034e-01,
         5.20201681e-01,   6.94090901e-01,   7.96664277e-03,
         3.53776385e-01,   8.84203331e-01,   8.73429242e-01,
         4.55278945e-01,   4.68539280e-01,   5.81468712e-01,
         8.58288388e-01,   6.19019965e-01,   9.90323134e-02,
         4.69957917e-01,   3.05901971e-01,   1.81528248e-01,
         6.37860117e-02,   3.39140634e-01,   4.84899868e-01,
         3.93676694e-02,   5.62301332e-01,   9.47872884e-01,
         7.37060969e-01,   4.93122604e-01,   6.43876855e-01,
         9.85164670e-01,   5.65553987e-01,   3.08719272e-01,
         9.89898135e-01,   2.12803405e-01,   3.36353998e-01,
         7.62916672e-01,   5.40978862e-01,   4.90755115e-01,
         4.69438802e-01,   4.83677499e-02,   3.77107628e-01,
         3.45312911e-01,   6.24495080e-01,   9.02105887e-01,
         6.79188850e-02,   5.35059025e-01,   9.23716050e-01,
         2.17113007e-01,   6.98838715e-01,   9.54079575e-01,
         4.01116729e-02,   1.89895961e-01,   7.06459694e-01,
         6.84170345e-01,   9.59637639e-01,   1.45305686e-01])
 message: 'Optimization terminated successfully.'
     jac: array([ -1.32367015e-04,  -7.95722008e-06,   0.00000000e+00,
        -1.52140856e-05,   0.00000000e+00,   8.94069672e-08,
        -2.37673521e-05,   0.00000000e+00,   2.08616257e-07,
        -2.32905149e-05,  -3.27825546e-07,   4.88758087e-06,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00])
     nit: 27
 
*** Profile stats marshalled to file u'/var/folders/mj/1sl30v6x2g5_lnlgdnngtd3c0000gn/T/tmp4XySGo'. 

In [21]:
#%%snakeviz
#startSLSQPTest = timeit.default_timer()
#costvFResultSLSQPTest = minimize(costvFTest,initGuess,method="SLSQP")
#stopSLSQPTest = timeit.default_timer()

#print stopSLSQPTest - startSLSQPTest

#print costvFResultSLSQPTest

In [22]:
costvFResultSLSQP.get('x')


Out[22]:
array([ -1.88788475e-02,   4.73007176e+00,   3.19479005e+00,
        -2.31134807e-02,   2.14586224e+01,   9.27084589e+00,
        -2.31134867e-02,   1.90342794e+01,   8.41622348e+00,
         1.88751604e-02,   1.03633649e+01,   4.58119903e+00,
         3.56875284e-01,   5.00352618e-01,   4.49314670e-01,
         1.09789529e-01,   8.64248268e-02,   9.12945423e-01,
         7.79673974e-01,   3.91570683e-01,   3.44360883e-01,
         7.90674687e-01,   2.60052721e-01,   2.39291096e-01,
         1.00417676e-01,   8.80390606e-01,   9.07187362e-01,
         2.44566996e-01,   8.13319693e-01,   7.51410145e-03,
         7.98116407e-01,   3.31929911e-01,   9.28633298e-01,
         1.14852679e-01,   3.81145178e-01,   8.32874196e-01,
         9.61608863e-01,   5.48771692e-01,   7.77438801e-01,
         4.47384069e-01,   2.72279123e-01,   8.93435338e-01,
         3.64733302e-01,   3.66137373e-01,   7.64384060e-01,
         4.42556810e-01,   3.88672148e-01,   7.06841199e-01,
         4.57060735e-01,   8.95157779e-01,   8.21502736e-01,
         9.64304681e-01,   9.79134641e-01,   6.41973790e-01,
         4.75630139e-01,   9.39734303e-01,   3.13038239e-01,
         7.61100395e-01,   9.11013866e-01,   7.32620613e-01,
         7.33390245e-01,   8.24461465e-01,   4.95809115e-01,
         3.38696719e-01,   1.86574802e-01,   4.11716321e-01,
         6.73811340e-01,   7.53419724e-01,   2.86301821e-01,
         1.89817791e-01,   8.50105985e-01,   2.16315881e-01,
         6.45374672e-01,   9.40453927e-01,   1.01646700e-01,
         1.94309355e-01,   5.21365718e-01,   3.77801829e-01,
         3.81687858e-01,   9.81791438e-01,   4.25421057e-01,
         2.32662476e-01,   3.48459005e-01,   1.08309268e-01,
         5.84800997e-01,   2.02582133e-01,   4.23700797e-01,
         1.54514423e-01,   4.11169271e-01,   4.05734136e-01,
         6.82372839e-01,   9.08288125e-01,   6.96440037e-01,
         9.76130810e-01,   6.28499574e-01,   5.29910934e-01,
         5.29198143e-01,   4.22597584e-01,   8.33177338e-01,
         4.25874550e-01,   6.68311047e-01,   6.05855363e-01,
         1.89719240e-01,   3.56529117e-01,   7.69103603e-01,
         6.75961665e-01,   8.51451924e-01,   7.72482367e-02,
         9.60959585e-02,   4.48036290e-01,   1.80172307e-01,
         1.71314641e-01,   3.79300500e-01,   5.37256721e-01,
         3.45102821e-01,   2.77046835e-02,   9.59724580e-01,
         4.90979102e-01,   2.60044989e-01,   3.84731571e-01,
         9.24029373e-01,   3.11452929e-01,   9.17579518e-01,
         4.88480706e-01,   3.66639744e-02,   3.63375566e-01,
         1.51405116e-01,   3.06835034e-01,   6.15478893e-01,
         7.83348685e-01,   2.61884510e-02,   1.53809740e-01,
         7.96863835e-02,   7.58140008e-01,   5.03559165e-01,
         9.57252372e-01,   6.35408267e-01,   7.76611251e-01,
         3.78797956e-01,   6.64851320e-01,   4.47781531e-01,
         1.58190376e-01,   4.40246451e-01,   5.32069201e-01,
         2.69923663e-01,   2.28909317e-01,   5.57759554e-01,
         7.77033677e-01,   9.51188628e-02,   1.82138290e-01,
         8.27147798e-01,   2.81140589e-01,   7.88671292e-01,
         1.70443830e-01,   3.67077199e-01,   7.94138327e-01,
         8.29891211e-01,   1.15810174e-01,   9.11685279e-01,
         9.37955131e-01,   8.29110833e-01,   5.71895944e-02,
         2.24549613e-01,   6.50438783e-01,   1.52816085e-01,
         5.89851797e-01,   6.19754375e-01,   7.29860511e-01,
         5.83059506e-01,   5.11378480e-01,   1.04594493e-01,
         9.13929793e-01,   7.66220484e-01,   1.55640983e-01,
         5.80973435e-01,   4.34790049e-01,   9.32062518e-01,
         4.18285416e-01,   9.67575138e-01,   2.93321731e-01,
         1.06000763e-01,   3.83357433e-01,   2.68332893e-01,
         1.48200793e-01,   4.68684823e-01,   6.70220680e-01,
         1.75643053e-01,   2.33848734e-01,   5.52054176e-01,
         1.30660487e-01,   9.26891376e-01,   2.58185564e-02,
         5.85938198e-01,   1.39234344e-01,   5.44901643e-01,
         7.62607248e-01,   1.64855538e-01,   2.76137298e-01,
         1.23937300e-01,   5.76470760e-01,   4.41605434e-01,
         1.66466616e-01,   4.46765194e-01,   7.49562145e-01,
         4.65528677e-01,   7.59381645e-01,   2.08670497e-01,
         1.56910025e-01,   6.71011049e-01,   3.95059849e-01,
         3.47516055e-01,   8.63518157e-01,   2.64595426e-01,
         5.79348364e-01,   4.96766366e-01,   2.10281280e-01,
         3.42392782e-01,   6.22104776e-01,   2.40582995e-01,
         4.37186711e-01,   9.76835278e-01,   9.81351577e-01,
         9.96684076e-01,   2.51093448e-01,   5.09287344e-01,
         5.21546326e-01,   3.02516362e-01,   5.79472880e-02,
         1.22935469e-01,   9.33905817e-01,   6.31595672e-01,
         6.73771420e-01,   3.51654567e-01,   1.08253251e-01,
         3.89836459e-01,   9.03693755e-01,   4.99366455e-01,
         1.93358123e-01,   9.26083816e-01,   8.84565724e-01,
         8.81049651e-01,   8.17235858e-01,   1.44787963e-01,
         6.23144401e-01,   5.75231339e-01,   3.53153129e-01,
         5.54389683e-01,   7.05536034e-01,   5.21503733e-01,
         2.74351019e-01,   2.23312411e-01,   5.85162511e-01,
         7.19577276e-01,   6.16658158e-01,   2.40581055e-01,
         6.67606988e-01,   8.94939996e-01,   3.37944224e-01,
         8.11172729e-01,   6.90348598e-01,   9.63657835e-01,
         4.56546388e-01,   8.54365222e-01,   9.02927727e-01,
         1.35379932e-01,   3.02410581e-01,   7.05715091e-01,
         8.05271634e-01,   2.01197848e-01,   6.33767822e-01,
         9.28701896e-01,   4.02806734e-01,   1.05904195e-02,
         4.40213183e-01,   1.12228971e-01,   3.75883207e-01,
         7.08570138e-01,   9.13402359e-01,   5.82206325e-01,
         2.92262888e-01,   5.06838095e-01,   4.57147788e-02,
         9.95119399e-01,   1.13608942e-01,   8.90427956e-01,
         7.65216929e-01,   7.20196558e-01,   7.30989894e-01,
         8.11896336e-01,   4.68656118e-01,   3.56896218e-01,
         9.54328447e-01,   5.81957406e-01,   1.34683848e-01,
         6.46623169e-01,   4.06120694e-01,   1.23588150e-01,
         3.25862931e-01,   2.74257781e-02,   8.41582857e-01,
         8.16802309e-01,   3.87413200e-01,   1.72465579e-01,
         1.13966017e-02,   7.88643993e-01,   9.17014068e-01,
         6.65968530e-02,   6.64600014e-01,   5.95560034e-01,
         5.20201681e-01,   6.94090901e-01,   7.96664277e-03,
         3.53776385e-01,   8.84203331e-01,   8.73429242e-01,
         4.55278945e-01,   4.68539280e-01,   5.81468712e-01,
         8.58288388e-01,   6.19019965e-01,   9.90323134e-02,
         4.69957917e-01,   3.05901971e-01,   1.81528248e-01,
         6.37860117e-02,   3.39140634e-01,   4.84899868e-01,
         3.93676694e-02,   5.62301332e-01,   9.47872884e-01,
         7.37060969e-01,   4.93122604e-01,   6.43876855e-01,
         9.85164670e-01,   5.65553987e-01,   3.08719272e-01,
         9.89898135e-01,   2.12803405e-01,   3.36353998e-01,
         7.62916672e-01,   5.40978862e-01,   4.90755115e-01,
         4.69438802e-01,   4.83677499e-02,   3.77107628e-01,
         3.45312911e-01,   6.24495080e-01,   9.02105887e-01,
         6.79188850e-02,   5.35059025e-01,   9.23716050e-01,
         2.17113007e-01,   6.98838715e-01,   9.54079575e-01,
         4.01116729e-02,   1.89895961e-01,   7.06459694e-01,
         6.84170345e-01,   9.59637639e-01,   1.45305686e-01])

In [23]:
#np.savetxt('./assets/homogen/optimize_ResultSLSQPT2120_Vac.txt', costvFResultSLSQP.get('x'), delimiter = ',')

Functions

Find the solutions to each elements.


In [24]:
# costvFResultSLSQPx = np.genfromtxt('./assets/homogen/optimize_ResultSLSQP.txt', delimiter = ',')

In [31]:
## The first element of neutrino density matrix
xresult = np.asarray(costvFResultSLSQP.get('x'))
#xresult = np.asarray(costvFResultBFGS.get('x'))

print xresult

plttlin=np.linspace(0,15,100)

pltdata11 = np.array([])
pltdata11Test = np.array([])
pltdata22 = np.array([])

for i in plttlin:
    pltdata11 = np.append(pltdata11 ,rho(xresult,i,init)[0,0] )
    
print pltdata11

#for i in plttlin:
#    pltdata11Test = np.append(pltdata11Test ,rho(xresultTest,i,init)[0,0] )
#    
#print pltdata11Test


for i in plttlin:
    pltdata22 = np.append(pltdata22 ,rho(xresult,i,init)[1,1] )
    
print pltdata22

print rho(xresult,0,init)


[ -1.88788475e-02   4.73007176e+00   3.19479005e+00  -2.31134807e-02
   2.14586224e+01   9.27084589e+00  -2.31134867e-02   1.90342794e+01
   8.41622348e+00   1.88751604e-02   1.03633649e+01   4.58119903e+00
   3.56875284e-01   5.00352618e-01   4.49314670e-01   1.09789529e-01
   8.64248268e-02   9.12945423e-01   7.79673974e-01   3.91570683e-01
   3.44360883e-01   7.90674687e-01   2.60052721e-01   2.39291096e-01
   1.00417676e-01   8.80390606e-01   9.07187362e-01   2.44566996e-01
   8.13319693e-01   7.51410145e-03   7.98116407e-01   3.31929911e-01
   9.28633298e-01   1.14852679e-01   3.81145178e-01   8.32874196e-01
   9.61608863e-01   5.48771692e-01   7.77438801e-01   4.47384069e-01
   2.72279123e-01   8.93435338e-01   3.64733302e-01   3.66137373e-01
   7.64384060e-01   4.42556810e-01   3.88672148e-01   7.06841199e-01
   4.57060735e-01   8.95157779e-01   8.21502736e-01   9.64304681e-01
   9.79134641e-01   6.41973790e-01   4.75630139e-01   9.39734303e-01
   3.13038239e-01   7.61100395e-01   9.11013866e-01   7.32620613e-01
   7.33390245e-01   8.24461465e-01   4.95809115e-01   3.38696719e-01
   1.86574802e-01   4.11716321e-01   6.73811340e-01   7.53419724e-01
   2.86301821e-01   1.89817791e-01   8.50105985e-01   2.16315881e-01
   6.45374672e-01   9.40453927e-01   1.01646700e-01   1.94309355e-01
   5.21365718e-01   3.77801829e-01   3.81687858e-01   9.81791438e-01
   4.25421057e-01   2.32662476e-01   3.48459005e-01   1.08309268e-01
   5.84800997e-01   2.02582133e-01   4.23700797e-01   1.54514423e-01
   4.11169271e-01   4.05734136e-01   6.82372839e-01   9.08288125e-01
   6.96440037e-01   9.76130810e-01   6.28499574e-01   5.29910934e-01
   5.29198143e-01   4.22597584e-01   8.33177338e-01   4.25874550e-01
   6.68311047e-01   6.05855363e-01   1.89719240e-01   3.56529117e-01
   7.69103603e-01   6.75961665e-01   8.51451924e-01   7.72482367e-02
   9.60959585e-02   4.48036290e-01   1.80172307e-01   1.71314641e-01
   3.79300500e-01   5.37256721e-01   3.45102821e-01   2.77046835e-02
   9.59724580e-01   4.90979102e-01   2.60044989e-01   3.84731571e-01
   9.24029373e-01   3.11452929e-01   9.17579518e-01   4.88480706e-01
   3.66639744e-02   3.63375566e-01   1.51405116e-01   3.06835034e-01
   6.15478893e-01   7.83348685e-01   2.61884510e-02   1.53809740e-01
   7.96863835e-02   7.58140008e-01   5.03559165e-01   9.57252372e-01
   6.35408267e-01   7.76611251e-01   3.78797956e-01   6.64851320e-01
   4.47781531e-01   1.58190376e-01   4.40246451e-01   5.32069201e-01
   2.69923663e-01   2.28909317e-01   5.57759554e-01   7.77033677e-01
   9.51188628e-02   1.82138290e-01   8.27147798e-01   2.81140589e-01
   7.88671292e-01   1.70443830e-01   3.67077199e-01   7.94138327e-01
   8.29891211e-01   1.15810174e-01   9.11685279e-01   9.37955131e-01
   8.29110833e-01   5.71895944e-02   2.24549613e-01   6.50438783e-01
   1.52816085e-01   5.89851797e-01   6.19754375e-01   7.29860511e-01
   5.83059506e-01   5.11378480e-01   1.04594493e-01   9.13929793e-01
   7.66220484e-01   1.55640983e-01   5.80973435e-01   4.34790049e-01
   9.32062518e-01   4.18285416e-01   9.67575138e-01   2.93321731e-01
   1.06000763e-01   3.83357433e-01   2.68332893e-01   1.48200793e-01
   4.68684823e-01   6.70220680e-01   1.75643053e-01   2.33848734e-01
   5.52054176e-01   1.30660487e-01   9.26891376e-01   2.58185564e-02
   5.85938198e-01   1.39234344e-01   5.44901643e-01   7.62607248e-01
   1.64855538e-01   2.76137298e-01   1.23937300e-01   5.76470760e-01
   4.41605434e-01   1.66466616e-01   4.46765194e-01   7.49562145e-01
   4.65528677e-01   7.59381645e-01   2.08670497e-01   1.56910025e-01
   6.71011049e-01   3.95059849e-01   3.47516055e-01   8.63518157e-01
   2.64595426e-01   5.79348364e-01   4.96766366e-01   2.10281280e-01
   3.42392782e-01   6.22104776e-01   2.40582995e-01   4.37186711e-01
   9.76835278e-01   9.81351577e-01   9.96684076e-01   2.51093448e-01
   5.09287344e-01   5.21546326e-01   3.02516362e-01   5.79472880e-02
   1.22935469e-01   9.33905817e-01   6.31595672e-01   6.73771420e-01
   3.51654567e-01   1.08253251e-01   3.89836459e-01   9.03693755e-01
   4.99366455e-01   1.93358123e-01   9.26083816e-01   8.84565724e-01
   8.81049651e-01   8.17235858e-01   1.44787963e-01   6.23144401e-01
   5.75231339e-01   3.53153129e-01   5.54389683e-01   7.05536034e-01
   5.21503733e-01   2.74351019e-01   2.23312411e-01   5.85162511e-01
   7.19577276e-01   6.16658158e-01   2.40581055e-01   6.67606988e-01
   8.94939996e-01   3.37944224e-01   8.11172729e-01   6.90348598e-01
   9.63657835e-01   4.56546388e-01   8.54365222e-01   9.02927727e-01
   1.35379932e-01   3.02410581e-01   7.05715091e-01   8.05271634e-01
   2.01197848e-01   6.33767822e-01   9.28701896e-01   4.02806734e-01
   1.05904195e-02   4.40213183e-01   1.12228971e-01   3.75883207e-01
   7.08570138e-01   9.13402359e-01   5.82206325e-01   2.92262888e-01
   5.06838095e-01   4.57147788e-02   9.95119399e-01   1.13608942e-01
   8.90427956e-01   7.65216929e-01   7.20196558e-01   7.30989894e-01
   8.11896336e-01   4.68656118e-01   3.56896218e-01   9.54328447e-01
   5.81957406e-01   1.34683848e-01   6.46623169e-01   4.06120694e-01
   1.23588150e-01   3.25862931e-01   2.74257781e-02   8.41582857e-01
   8.16802309e-01   3.87413200e-01   1.72465579e-01   1.13966017e-02
   7.88643993e-01   9.17014068e-01   6.65968530e-02   6.64600014e-01
   5.95560034e-01   5.20201681e-01   6.94090901e-01   7.96664277e-03
   3.53776385e-01   8.84203331e-01   8.73429242e-01   4.55278945e-01
   4.68539280e-01   5.81468712e-01   8.58288388e-01   6.19019965e-01
   9.90323134e-02   4.69957917e-01   3.05901971e-01   1.81528248e-01
   6.37860117e-02   3.39140634e-01   4.84899868e-01   3.93676694e-02
   5.62301332e-01   9.47872884e-01   7.37060969e-01   4.93122604e-01
   6.43876855e-01   9.85164670e-01   5.65553987e-01   3.08719272e-01
   9.89898135e-01   2.12803405e-01   3.36353998e-01   7.62916672e-01
   5.40978862e-01   4.90755115e-01   4.69438802e-01   4.83677499e-02
   3.77107628e-01   3.45312911e-01   6.24495080e-01   9.02105887e-01
   6.79188850e-02   5.35059025e-01   9.23716050e-01   2.17113007e-01
   6.98838715e-01   9.54079575e-01   4.01116729e-02   1.89895961e-01
   7.06459694e-01   6.84170345e-01   9.59637639e-01   1.45305686e-01]
[ 1.          0.99719569  0.99433451  0.99145947  0.98858488  0.98571411
  0.98284695  0.97998241  0.97711958  0.97425778  0.97139659  0.96853574
  0.96567508  0.96281453  0.95995403  0.95709357  0.95423312  0.95137268
  0.94851224  0.94565181  0.94279137  0.93993094  0.93707051  0.93421008
  0.93134965  0.92848921  0.92562878  0.92276835  0.91990792  0.91704749
  0.91418706  0.91132663  0.90846619  0.90560576  0.90274533  0.8998849
  0.89702447  0.89416404  0.89130361  0.88844317  0.88558274  0.88272231
  0.87986188  0.87700145  0.87414102  0.87128059  0.86842015  0.86555972
  0.86269929  0.85983886  0.85697843  0.854118    0.85125757  0.84839713
  0.8455367   0.84267627  0.83981584  0.83695541  0.83409498  0.83123455
  0.82837411  0.82551368  0.82265325  0.81979282  0.81693239  0.81407196
  0.81121152  0.80835109  0.80549066  0.80263023  0.7997698   0.79690937
  0.79404894  0.7911885   0.78832807  0.78546764  0.78260721  0.77974678
  0.77688635  0.77402592  0.77116548  0.76830505  0.76544462  0.76258419
  0.75972376  0.75686333  0.7540029   0.75114246  0.74828203  0.7454216
  0.74256117  0.73970074  0.73684031  0.73397988  0.73111944  0.72825901
  0.72539858  0.72253815  0.71967772  0.71681729]
[ 0.          0.00285379  0.00571721  0.00857883  0.01143927  0.01429931
  0.01715922  0.02001911  0.02287898  0.02573885  0.02859873  0.0314586
  0.03431847  0.03717835  0.04003822  0.04289809  0.04575796  0.04861784
  0.05147771  0.05433758  0.05719746  0.06005733  0.0629172   0.06577707
  0.06863695  0.07149682  0.07435669  0.07721657  0.08007644  0.08293631
  0.08579618  0.08865606  0.09151593  0.0943758   0.09723567  0.10009555
  0.10295542  0.10581529  0.10867517  0.11153504  0.11439491  0.11725478
  0.12011466  0.12297453  0.1258344   0.12869428  0.13155415  0.13441402
  0.13727389  0.14013377  0.14299364  0.14585351  0.14871338  0.15157326
  0.15443313  0.157293    0.16015288  0.16301275  0.16587262  0.16873249
  0.17159237  0.17445224  0.17731211  0.18017199  0.18303186  0.18589173
  0.1887516   0.19161148  0.19447135  0.19733122  0.2001911   0.20305097
  0.20591084  0.20877071  0.21163059  0.21449046  0.21735033  0.2202102
  0.22307008  0.22592995  0.22878982  0.2316497   0.23450957  0.23736944
  0.24022931  0.24308919  0.24594906  0.24880893  0.25166881  0.25452868
  0.25738855  0.26024842  0.2631083   0.26596817  0.26882804  0.27168791
  0.27454779  0.27740766  0.28026753  0.28312741]
[[ 1.  0.]
 [ 0.  0.]]

In [32]:
rho(xresult,6.6,init)


Out[32]:
array([[ 0.87539961, -0.15254897],
       [-0.15254901,  0.12457606]])

In [33]:
#np.savetxt('./assets/homogen/optimize_pltdatar11.txt', pltdata11, delimiter = ',')
#np.savetxt('./assets/homogen/optimize_pltdatar22.txt', pltdata22, delimiter = ',')

In [34]:
plt.figure(figsize=(16,9.36))
plt.ylabel('rho11')
plt.xlabel('Time')
plt11=plt.plot(plttlin,pltdata11,"b4-",label="vac_rho11")
#plt.plot(plttlin,pltdata11Test,"m4-",label="vac_rho11Test")
plt.show()
#py.iplot_mpl(plt.gcf(),filename="vac_HG-rho11")


# tls.embed("https://plot.ly/~emptymalei/73/")



In [35]:
plt.figure(figsize=(16,9.36))
plt.ylabel('Time')
plt.xlabel('rho22')
plt22=plt.plot(plttlin,pltdata22,"r4-",label="vac_rho22")
plt.show()
#py.iplot_mpl(plt.gcf(),filename="vac_HG-rho22")



In [36]:
MMA_optmize_Vac_pltdata = np.genfromtxt('./assets/homogen/MMA_optmize_Vac_pltdata.txt', delimiter = ',')

plt.figure(figsize=(16,9.36))
plt.ylabel('MMArho11')
plt.xlabel('Time')
plt.plot(np.linspace(0,15,4501),MMA_optmize_Vac_pltdata,"r-",label="MMAVacrho11")
plt.plot(plttlin,pltdata11,"b4-",label="vac_rho11")
plt.show()
#py.iplot_mpl(plt.gcf(),filename="MMA-rho11-Vac-80-60")



In [ ]:


In [ ]:

Practice


In [ ]:
xtemp1 = np.arange(4)
xtemp1.shape = (2,2)
print xtemp1
xtemp1[0,1]
np.dot(xtemp1,xtemp1)
xtemp1[0,1]

In [ ]:


In [ ]: