Skip to content

Commit

Permalink
changed omega_q, omega_r to frequency_q, frequency_r
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyyaker committed Apr 20, 2023
1 parent 000dd91 commit 8770619
Showing 1 changed file with 67 additions and 114 deletions.
181 changes: 67 additions & 114 deletions examples/demo-jaynes-cummings.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"execution_count": null,
"outputs": [],
"source": [
"# exact eigenenergies for comparing with numerics\n",
Expand All @@ -86,31 +81,29 @@
" all_energies = np.append(energies_0, energies_minus)\n",
" all_energies = np.append(all_energies, energies_plus)\n",
" return np.sort(all_energies)"
]
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
}
},
{
"cell_type": "markdown",
"source": [
"### Set up the subsystems"
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"### Set up the subsystems"
]
}
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"ExecuteTime": {
"end_time": "2020-03-31T11:43:54.037807Z",
"start_time": "2020-03-31T11:43:54.024841Z"
},
"pycharm": {
"name": "#%%\n"
}
},
"execution_count": null,
"outputs": [],
"source": [
"frequency_q = 1.0\n",
Expand All @@ -124,31 +117,29 @@
" E_osc=frequency_r,\n",
" truncated_dim=10 # up to 9 photons\n",
")"
]
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
}
},
{
"cell_type": "markdown",
"source": [
"### Set up Hilbert space"
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"### Set up Hilbert space"
]
}
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"ExecuteTime": {
"end_time": "2020-03-31T11:44:00.099411Z",
"start_time": "2020-03-31T11:44:00.092429Z"
},
"pycharm": {
"name": "#%%\n"
}
},
"execution_count": null,
"outputs": [],
"source": [
"# Form a list of all components making up the Hilbert space.\n",
Expand All @@ -160,106 +151,68 @@
" op2 = osc.creation_operator,\n",
" add_hc = True\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 5,
],
"metadata": {
"ExecuteTime": {
"end_time": "2020-03-31T11:43:54.772581Z",
"start_time": "2020-03-31T11:43:54.765597Z"
},
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"HilbertSpace: subsystems\n",
"-------------------------\n",
"\n",
"GenericQubit--------| [GenericQubit_1]\n",
" | E: 1.0\n",
" |\n",
" | dim: 2\n",
"\n",
"\n",
"Oscillator----------| [Oscillator_1]\n",
" | E_osc: 0.8\n",
" | l_osc: None\n",
" | truncated_dim: 10\n",
" |\n",
" | dim: 10\n",
"\n",
"\n",
"\n",
"HilbertSpace: interaction terms\n",
"--------------------------------\n",
"InteractionTerm----------| [Interaction_1]\n",
" | g_strength: 0.1\n",
" | operator_list: [(0, array([[0., 0.],\n",
" [1., 0.]])), (1, arra ...\n",
" | add_hc: True\n",
"\n",
"\n"
]
}
],
"source": [
"print(hilbertspace)"
]
}
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"outputs": [],
"source": [
"print(hilbertspace)"
],
"metadata": {
"ExecuteTime": {
"end_time": "2020-03-31T11:44:06.327709Z",
"start_time": "2020-03-31T11:44:06.314743Z"
},
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[-0.5 0.25857864 0.54142136 1.02679492 1.37320508]\n"
]
}
],
}
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"evals = hilbertspace.eigenvals(evals_count=5)\n",
"print(evals)"
]
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
}
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"outputs": [],
"source": [
"energies(frequency_r, frequency_q, g, 3)"
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"data": {
"text/plain": "array([-0.5 , 0.25857864, 0.54142136, 1.02679492, 1.37320508])"
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
],
"source": [
"energies(frequency_r, frequency_q, g, 3)"
]
}
},
{
"cell_type": "code",
Expand Down

0 comments on commit 8770619

Please sign in to comment.