Last active
June 7, 2016 04:10
-
-
Save jrjohansson/71947f8336dbcce8c93f to your computer and use it in GitHub Desktop.
time_dep_supers
This file contains 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
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:60f6b4a2de06299430d2ea7cd08ffd693f630878015605d3eb641551593431fe" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"%matplotlib inline\n", | |
"from qutip import *\n", | |
"from math import *\n", | |
"from pylab import *" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 1 | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Input Lindblad operator" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"NN = 20;\n", | |
"\n", | |
"ti = 0; # Keep at zero always\n", | |
"tf = 2;\n", | |
"res = 50;\n", | |
"t=linspace(ti,tf,res) # start time, end time, number of increments\n", | |
"\n", | |
"# Parameter and input state\n", | |
"alp = 0.23\n", | |
"def alp1(t,args):\n", | |
" return sqrt(alp)+0.*t\n", | |
"\n", | |
"def alp1sq(t,args):\n", | |
" return sqrt(alp)+0.*t\n", | |
"\n", | |
"inp = ( coherent(NN,1) + coherent(NN,2) ) .unit()\n", | |
"\n", | |
"# Jumps\n", | |
"F1 = spre(destroy(NN))*spost(create(NN))-0.5*spre(num(NN))-0.5*spost(num(NN))\n", | |
"\n", | |
"# Time indep. input\n", | |
"out0 = mesolve(0*qeye(NN),inp,t,[sqrt(alp)*destroy(NN)],[])\n", | |
"\n", | |
"# Time dep. input\n", | |
"out1 = mesolve(0*qeye(NN),inp,t,[qeye(NN),[destroy(NN),alp1]],[])\n", | |
"\n", | |
"# Time indep. superoperator input\n", | |
"out2 = mesolve(0*qeye(NN),inp,t,[alp*F1],[])\n", | |
"\n", | |
"# Time dep. superoperator input: list array\n", | |
"out3 = mesolve(0*qeye(NN),inp,t,[[F1,alp+0.*t]],[])\n", | |
"\n", | |
"# Time dep. superoperator input: list callback\n", | |
"out4 = mesolve(0*qeye(NN),inp,t,[[F1, alp1sq]],[])\n", | |
"\n", | |
"# Time dep. superoperator input: list string\n", | |
"out5 = mesolve(0*qeye(NN),inp,t,[[F1, 'alp']],[], args={'alp': alp})" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 2 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"# Check Liouvillian\n", | |
"truth = liouvillian(0*qeye(NN),[sqrt(alp)*destroy(NN)])\n", | |
"print (( truth - liouvillian(0*qeye(NN),[alp1(t,[])[0]*destroy(NN)]) ).norm() )\n", | |
"print (( truth - alp*F1 ).norm())\n", | |
"print (( truth - (alp+0.*t[0])*F1 ).norm())\n", | |
"print (( truth - (alp1sq(t,[])[0])**2 * F1 ).norm())" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"0.0\n", | |
"0.0" | |
] | |
}, | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"\n", | |
"0.0" | |
] | |
}, | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"\n", | |
"0.0" | |
] | |
}, | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"\n" | |
] | |
} | |
], | |
"prompt_number": 3 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"# Check state\n", | |
"print (( out0.states[res-1] - out1.states[res-1] ).norm())\n", | |
"print (( out0.states[res-1] - out2.states[res-1] ).norm())\n", | |
"print (( out0.states[res-1] - out3.states[res-1] ).norm())\n", | |
"print (( out0.states[res-1] - out4.states[res-1] ).norm())\n", | |
"print (( out0.states[res-1] - out5.states[res-1] ).norm())" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"stream": "stdout", | |
"text": [ | |
"0.0\n", | |
"0.0\n", | |
"4.84003564908e-05\n", | |
"0.0\n", | |
"0.0\n" | |
] | |
} | |
], | |
"prompt_number": 4 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"from qutip.ipynbtools import version_table\n", | |
"\n", | |
"version_table()" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<table><tr><th>Software</th><th>Version</th></tr><tr><td>OS</td><td>posix [darwin]</td></tr><tr><td>SciPy</td><td>0.14.0</td></tr><tr><td>IPython</td><td>2.1.0</td></tr><tr><td>Cython</td><td>0.20.1</td></tr><tr><td>matplotlib</td><td>1.3.1</td></tr><tr><td>QuTiP</td><td>3.1.0.dev-46b0355</td></tr><tr><td>Numpy</td><td>1.8.1</td></tr><tr><td>Python</td><td>3.4.1 (default, May 21 2014, 01:39:38) \n", | |
"[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)]</td></tr><tr><td colspan='2'>Sat Sep 06 11:02:03 2014 JST</td></tr></table>" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 5, | |
"text": [ | |
"<IPython.core.display.HTML at 0x1094de860>" | |
] | |
} | |
], | |
"prompt_number": 5 | |
} | |
], | |
"metadata": {} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment