physicskit 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- physicskit/__init__.py +51 -0
- physicskit/astro/__init__.py +66 -0
- physicskit/astro/cosmic_web.py +395 -0
- physicskit/astro/galactic_dynamics.py +137 -0
- physicskit/astro/nbody.py +208 -0
- physicskit/astro/orbital_mechanics.py +220 -0
- physicskit/astro/stellar_dynamo.py +628 -0
- physicskit/astro/stellar_structure.py +198 -0
- physicskit/astro/tests/__init__.py +0 -0
- physicskit/astro/tests/conftest.py +7 -0
- physicskit/astro/tests/test_cosmic_web.py +159 -0
- physicskit/astro/tests/test_galactic_dynamics.py +46 -0
- physicskit/astro/tests/test_nbody.py +81 -0
- physicskit/astro/tests/test_orbital_mechanics.py +73 -0
- physicskit/astro/tests/test_stellar_dynamo.py +198 -0
- physicskit/astro/tests/test_stellar_structure.py +52 -0
- physicskit/astro/tests/test_visualizers.py +159 -0
- physicskit/astro/visualizers.py +628 -0
- physicskit/chaos/__init__.py +55 -0
- physicskit/chaos/core/__init__.py +3 -0
- physicskit/chaos/core/base_system.py +342 -0
- physicskit/chaos/core/integrators.py +40 -0
- physicskit/chaos/exceptions.py +24 -0
- physicskit/chaos/quantum/__init__.py +38 -0
- physicskit/chaos/quantum/billiards.py +274 -0
- physicskit/chaos/quantum/husimi.py +85 -0
- physicskit/chaos/quantum/maps.py +366 -0
- physicskit/chaos/systems/__init__.py +38 -0
- physicskit/chaos/systems/billiards.py +1131 -0
- physicskit/chaos/systems/continuous.py +1276 -0
- physicskit/chaos/systems/maps.py +557 -0
- physicskit/chaos/tests/__init__.py +0 -0
- physicskit/chaos/tests/test_basins.py +76 -0
- physicskit/chaos/tests/test_bifurcation.py +132 -0
- physicskit/chaos/tests/test_billiards.py +115 -0
- physicskit/chaos/tests/test_continuous.py +224 -0
- physicskit/chaos/tests/test_dimension.py +69 -0
- physicskit/chaos/tests/test_divergence.py +90 -0
- physicskit/chaos/tests/test_dynamic_plots.py +269 -0
- physicskit/chaos/tests/test_integrators.py +96 -0
- physicskit/chaos/tests/test_io.py +41 -0
- physicskit/chaos/tests/test_maps.py +110 -0
- physicskit/chaos/tests/test_metrics.py +115 -0
- physicskit/chaos/tests/test_phase_space.py +73 -0
- physicskit/chaos/tests/test_properties.py +116 -0
- physicskit/chaos/tests/test_quantum_billiards.py +94 -0
- physicskit/chaos/tests/test_quantum_maps.py +144 -0
- physicskit/chaos/tests/test_recurrence.py +51 -0
- physicskit/chaos/tests/test_repr_and_api_consistency.py +134 -0
- physicskit/chaos/tests/test_section.py +49 -0
- physicskit/chaos/tests/test_spectral.py +48 -0
- physicskit/chaos/tests/test_streamlit_app.py +45 -0
- physicskit/chaos/tests/test_timeseries.py +131 -0
- physicskit/chaos/tests/test_viewer3d.py +41 -0
- physicskit/chaos/utils/__init__.py +46 -0
- physicskit/chaos/utils/dimension.py +139 -0
- physicskit/chaos/utils/io.py +95 -0
- physicskit/chaos/utils/metrics.py +304 -0
- physicskit/chaos/utils/recurrence.py +122 -0
- physicskit/chaos/utils/spectral.py +69 -0
- physicskit/chaos/utils/timeseries.py +303 -0
- physicskit/chaos/visualizers/__init__.py +85 -0
- physicskit/chaos/visualizers/basins.py +185 -0
- physicskit/chaos/visualizers/bifurcation.py +273 -0
- physicskit/chaos/visualizers/divergence.py +374 -0
- physicskit/chaos/visualizers/dynamic_plots.py +1372 -0
- physicskit/chaos/visualizers/phase_space.py +133 -0
- physicskit/chaos/visualizers/quantum.py +299 -0
- physicskit/chaos/visualizers/recurrence.py +91 -0
- physicskit/chaos/visualizers/section.py +161 -0
- physicskit/chaos/visualizers/theme.py +31 -0
- physicskit/chaos/visualizers/viewer3d.py +82 -0
- physicskit/classical/__init__.py +55 -0
- physicskit/classical/core/__init__.py +17 -0
- physicskit/classical/core/base_system.py +510 -0
- physicskit/classical/core/integrators.py +397 -0
- physicskit/classical/systems/__init__.py +32 -0
- physicskit/classical/systems/chains.py +334 -0
- physicskit/classical/systems/hamiltonian.py +215 -0
- physicskit/classical/systems/lagrangian.py +308 -0
- physicskit/classical/systems/newtonian.py +536 -0
- physicskit/classical/systems/rotations.py +614 -0
- physicskit/classical/tests/__init__.py +0 -0
- physicskit/classical/tests/conftest.py +7 -0
- physicskit/classical/tests/test_base_system.py +113 -0
- physicskit/classical/tests/test_chains.py +84 -0
- physicskit/classical/tests/test_conservation.py +244 -0
- physicskit/classical/tests/test_conservation_utils.py +47 -0
- physicskit/classical/tests/test_hamiltonian.py +44 -0
- physicskit/classical/tests/test_integrators.py +123 -0
- physicskit/classical/tests/test_lagrangian.py +69 -0
- physicskit/classical/tests/test_newtonian.py +45 -0
- physicskit/classical/tests/test_rotations.py +160 -0
- physicskit/classical/tests/test_stepsize.py +149 -0
- physicskit/classical/tests/test_symbolic.py +125 -0
- physicskit/classical/tests/test_visualizers.py +172 -0
- physicskit/classical/utils/__init__.py +20 -0
- physicskit/classical/utils/conservation.py +126 -0
- physicskit/classical/utils/stepsize.py +187 -0
- physicskit/classical/utils/symbolic.py +235 -0
- physicskit/classical/visualizers/__init__.py +25 -0
- physicskit/classical/visualizers/animations.py +508 -0
- physicskit/classical/visualizers/interactive.py +113 -0
- physicskit/classical/visualizers/modal_analysis.py +97 -0
- physicskit/classical/visualizers/phase_space.py +214 -0
- physicskit/condensed/__init__.py +122 -0
- physicskit/condensed/anderson_localization.py +155 -0
- physicskit/condensed/correlated.py +284 -0
- physicskit/condensed/ginzburg_landau.py +220 -0
- physicskit/condensed/landau_levels.py +246 -0
- physicskit/condensed/laughlin.py +229 -0
- physicskit/condensed/models.py +627 -0
- physicskit/condensed/tests/__init__.py +0 -0
- physicskit/condensed/tests/test_condensed.py +518 -0
- physicskit/condensed/tests/test_visualizers.py +87 -0
- physicskit/condensed/tight_binding.py +445 -0
- physicskit/condensed/topological_insulator_3d.py +178 -0
- physicskit/condensed/topology.py +217 -0
- physicskit/condensed/visualizers.py +296 -0
- physicskit/condensed/weyl.py +180 -0
- physicskit/constants.py +184 -0
- physicskit/fields/__init__.py +111 -0
- physicskit/fields/electrodynamics.py +671 -0
- physicskit/fields/quantum_fields.py +510 -0
- physicskit/fields/solitons.py +527 -0
- physicskit/fields/tests/__init__.py +0 -0
- physicskit/fields/tests/conftest.py +7 -0
- physicskit/fields/tests/test_field_animations.py +154 -0
- physicskit/fields/tests/test_fields.py +439 -0
- physicskit/fields/tests/test_visualizers.py +101 -0
- physicskit/fields/visualizers.py +503 -0
- physicskit/fluids/__init__.py +134 -0
- physicskit/fluids/core/__init__.py +23 -0
- physicskit/fluids/core/grid.py +165 -0
- physicskit/fluids/core/timestepping.py +231 -0
- physicskit/fluids/exceptions.py +26 -0
- physicskit/fluids/systems/__init__.py +70 -0
- physicskit/fluids/systems/compressible_flow.py +281 -0
- physicskit/fluids/systems/instabilities.py +343 -0
- physicskit/fluids/systems/navier_stokes.py +221 -0
- physicskit/fluids/systems/potential_flow.py +440 -0
- physicskit/fluids/systems/viscous_flow.py +425 -0
- physicskit/fluids/systems/vortex_dynamics.py +304 -0
- physicskit/fluids/tests/__init__.py +0 -0
- physicskit/fluids/tests/conftest.py +7 -0
- physicskit/fluids/tests/test_compressible_flow.py +66 -0
- physicskit/fluids/tests/test_instabilities.py +115 -0
- physicskit/fluids/tests/test_navier_stokes.py +67 -0
- physicskit/fluids/tests/test_potential_flow.py +92 -0
- physicskit/fluids/tests/test_static_visualizers.py +91 -0
- physicskit/fluids/tests/test_utils.py +100 -0
- physicskit/fluids/tests/test_viscous_flow.py +110 -0
- physicskit/fluids/tests/test_visualizers.py +34 -0
- physicskit/fluids/tests/test_vortex_dynamics.py +88 -0
- physicskit/fluids/utils/__init__.py +18 -0
- physicskit/fluids/utils/dimensionless.py +239 -0
- physicskit/fluids/utils/spectral_analysis.py +142 -0
- physicskit/fluids/visualizers/__init__.py +14 -0
- physicskit/fluids/visualizers/compressible.py +39 -0
- physicskit/fluids/visualizers/flow_fields.py +252 -0
- physicskit/fluids/visualizers/potential_flow.py +51 -0
- physicskit/fluids/visualizers/spectra.py +62 -0
- physicskit/fluids/visualizers/theme.py +38 -0
- physicskit/integrators/__init__.py +52 -0
- physicskit/integrators/adaptive.py +199 -0
- physicskit/integrators/fixed_step.py +360 -0
- physicskit/integrators/tests/__init__.py +0 -0
- physicskit/integrators/tests/test_integrators.py +101 -0
- physicskit/optics/__init__.py +124 -0
- physicskit/optics/_compat.py +5 -0
- physicskit/optics/gaussian.py +382 -0
- physicskit/optics/quantum_optics.py +428 -0
- physicskit/optics/ray.py +469 -0
- physicskit/optics/tests/__init__.py +0 -0
- physicskit/optics/tests/test_diffraction_animation.py +38 -0
- physicskit/optics/tests/test_gaussian.py +170 -0
- physicskit/optics/tests/test_quantum_optics.py +147 -0
- physicskit/optics/tests/test_ray.py +177 -0
- physicskit/optics/tests/test_visualizers.py +58 -0
- physicskit/optics/tests/test_wave.py +146 -0
- physicskit/optics/visualizers.py +264 -0
- physicskit/optics/wave.py +365 -0
- physicskit/particle/__init__.py +152 -0
- physicskit/particle/collider.py +382 -0
- physicskit/particle/confinement.py +125 -0
- physicskit/particle/decays.py +357 -0
- physicskit/particle/electroweak.py +300 -0
- physicskit/particle/kinematics.py +271 -0
- physicskit/particle/neutrinos.py +84 -0
- physicskit/particle/nuclear.py +100 -0
- physicskit/particle/scattering.py +159 -0
- physicskit/particle/tests/__init__.py +0 -0
- physicskit/particle/tests/conftest.py +7 -0
- physicskit/particle/tests/test_collider.py +119 -0
- physicskit/particle/tests/test_confinement.py +42 -0
- physicskit/particle/tests/test_decays.py +112 -0
- physicskit/particle/tests/test_electroweak.py +97 -0
- physicskit/particle/tests/test_kinematics.py +138 -0
- physicskit/particle/tests/test_neutrinos.py +36 -0
- physicskit/particle/tests/test_nuclear.py +45 -0
- physicskit/particle/tests/test_scattering.py +64 -0
- physicskit/particle/tests/test_visualizers.py +214 -0
- physicskit/particle/visualizers/__init__.py +38 -0
- physicskit/particle/visualizers/animations.py +705 -0
- physicskit/particle/visualizers/static.py +101 -0
- physicskit/plasma/__init__.py +176 -0
- physicskit/plasma/acceleration.py +152 -0
- physicskit/plasma/instabilities.py +417 -0
- physicskit/plasma/kinetic.py +588 -0
- physicskit/plasma/mhd.py +463 -0
- physicskit/plasma/single_particle.py +562 -0
- physicskit/plasma/tests/__init__.py +0 -0
- physicskit/plasma/tests/conftest.py +7 -0
- physicskit/plasma/tests/test_new_time_domain_features.py +222 -0
- physicskit/plasma/tests/test_plasma.py +232 -0
- physicskit/plasma/tests/test_visualizers.py +79 -0
- physicskit/plasma/turbulence.py +219 -0
- physicskit/plasma/visualizers.py +868 -0
- physicskit/plasma/waves.py +549 -0
- physicskit/quantum/__init__.py +180 -0
- physicskit/quantum/_compat.py +20 -0
- physicskit/quantum/chapters/__init__.py +0 -0
- physicskit/quantum/chapters/entanglement.py +489 -0
- physicskit/quantum/chapters/harmonic_spin.py +517 -0
- physicskit/quantum/chapters/hydrogen_am.py +292 -0
- physicskit/quantum/chapters/perturbation.py +350 -0
- physicskit/quantum/chapters/potentials.py +997 -0
- physicskit/quantum/chapters/spin.py +306 -0
- physicskit/quantum/chapters/wave_packets.py +541 -0
- physicskit/quantum/core/__init__.py +0 -0
- physicskit/quantum/core/eigensolvers.py +311 -0
- physicskit/quantum/core/operators.py +296 -0
- physicskit/quantum/core/solvers.py +271 -0
- physicskit/quantum/tests/__init__.py +0 -0
- physicskit/quantum/tests/conftest.py +7 -0
- physicskit/quantum/tests/test_animations.py +225 -0
- physicskit/quantum/tests/test_compat.py +43 -0
- physicskit/quantum/tests/test_eigensolvers.py +24 -0
- physicskit/quantum/tests/test_entanglement.py +127 -0
- physicskit/quantum/tests/test_harmonic_spin.py +140 -0
- physicskit/quantum/tests/test_hydrogen_am.py +48 -0
- physicskit/quantum/tests/test_measure.py +110 -0
- physicskit/quantum/tests/test_operators.py +105 -0
- physicskit/quantum/tests/test_perturbation.py +112 -0
- physicskit/quantum/tests/test_physics_checks.py +131 -0
- physicskit/quantum/tests/test_potentials.py +191 -0
- physicskit/quantum/tests/test_solvers.py +70 -0
- physicskit/quantum/tests/test_spin.py +22 -0
- physicskit/quantum/tests/test_unitarity.py +84 -0
- physicskit/quantum/tests/test_wave_packets.py +53 -0
- physicskit/quantum/utils/__init__.py +0 -0
- physicskit/quantum/utils/measure.py +253 -0
- physicskit/quantum/visualizers/__init__.py +0 -0
- physicskit/quantum/visualizers/bloch_sphere.py +205 -0
- physicskit/quantum/visualizers/entanglement.py +58 -0
- physicskit/quantum/visualizers/orbitals.py +187 -0
- physicskit/quantum/visualizers/phase_space.py +179 -0
- physicskit/quantum/visualizers/wavefunctions.py +230 -0
- physicskit/relativity/__init__.py +61 -0
- physicskit/relativity/chapters/__init__.py +33 -0
- physicskit/relativity/chapters/cosmology.py +190 -0
- physicskit/relativity/chapters/gw_merger.py +399 -0
- physicskit/relativity/chapters/kerr.py +371 -0
- physicskit/relativity/chapters/lensing.py +196 -0
- physicskit/relativity/chapters/neutron_star.py +149 -0
- physicskit/relativity/chapters/schwarzschild.py +412 -0
- physicskit/relativity/chapters/timekeeping.py +133 -0
- physicskit/relativity/core/__init__.py +12 -0
- physicskit/relativity/core/geodesics.py +216 -0
- physicskit/relativity/core/kerr_raytracer.py +259 -0
- physicskit/relativity/core/raytracer.py +241 -0
- physicskit/relativity/core/tensors.py +468 -0
- physicskit/relativity/tests/__init__.py +0 -0
- physicskit/relativity/tests/test_conservations.py +54 -0
- physicskit/relativity/tests/test_constants.py +34 -0
- physicskit/relativity/tests/test_cosmology.py +61 -0
- physicskit/relativity/tests/test_gw_merger.py +117 -0
- physicskit/relativity/tests/test_kerr.py +116 -0
- physicskit/relativity/tests/test_kerr_raytracer.py +103 -0
- physicskit/relativity/tests/test_lensing.py +75 -0
- physicskit/relativity/tests/test_neutron_star.py +48 -0
- physicskit/relativity/tests/test_raytracer.py +67 -0
- physicskit/relativity/tests/test_schwarzschild.py +126 -0
- physicskit/relativity/tests/test_shadow_render.py +81 -0
- physicskit/relativity/tests/test_tensors.py +86 -0
- physicskit/relativity/tests/test_timekeeping.py +51 -0
- physicskit/relativity/tests/test_visualizers_misc.py +115 -0
- physicskit/relativity/utils/__init__.py +1 -0
- physicskit/relativity/utils/constants.py +232 -0
- physicskit/relativity/visualizers/__init__.py +46 -0
- physicskit/relativity/visualizers/interactive.py +127 -0
- physicskit/relativity/visualizers/shadow_render.py +367 -0
- physicskit/relativity/visualizers/spacetime_3d.py +92 -0
- physicskit/relativity/visualizers/spacetime_diagrams.py +198 -0
- physicskit/relativity/visualizers/wave_plots.py +185 -0
- physicskit/rmt/__init__.py +8 -0
- physicskit/rmt/ensembles/__init__.py +108 -0
- physicskit/rmt/ensembles/banded.py +114 -0
- physicskit/rmt/ensembles/base.py +135 -0
- physicskit/rmt/ensembles/bdg.py +218 -0
- physicskit/rmt/ensembles/chiral.py +308 -0
- physicskit/rmt/ensembles/circular.py +104 -0
- physicskit/rmt/ensembles/crossover.py +82 -0
- physicskit/rmt/ensembles/density_matrix.py +148 -0
- physicskit/rmt/ensembles/effective_hamiltonian.py +230 -0
- physicskit/rmt/ensembles/embedded.py +207 -0
- physicskit/rmt/ensembles/gaussian.py +153 -0
- physicskit/rmt/ensembles/ginibre.py +110 -0
- physicskit/rmt/ensembles/girko.py +190 -0
- physicskit/rmt/ensembles/graph_laplacian.py +92 -0
- physicskit/rmt/ensembles/haar.py +57 -0
- physicskit/rmt/ensembles/jacobi.py +182 -0
- physicskit/rmt/ensembles/poisson.py +77 -0
- physicskit/rmt/ensembles/polynomial.py +139 -0
- physicskit/rmt/ensembles/pt_symmetric.py +120 -0
- physicskit/rmt/ensembles/single_ring.py +170 -0
- physicskit/rmt/ensembles/sparse.py +95 -0
- physicskit/rmt/ensembles/syk.py +170 -0
- physicskit/rmt/ensembles/truncated_unitary.py +80 -0
- physicskit/rmt/ensembles/universality.py +92 -0
- physicskit/rmt/ensembles/wishart.py +88 -0
- physicskit/rmt/py.typed +0 -0
- physicskit/rmt/spectrum.py +82 -0
- physicskit/rmt/stats/__init__.py +160 -0
- physicskit/rmt/stats/characteristic_polynomial.py +77 -0
- physicskit/rmt/stats/circular_law.py +54 -0
- physicskit/rmt/stats/correlations.py +162 -0
- physicskit/rmt/stats/density.py +70 -0
- physicskit/rmt/stats/entanglement.py +36 -0
- physicskit/rmt/stats/free_probability.py +202 -0
- physicskit/rmt/stats/localization.py +338 -0
- physicskit/rmt/stats/marchenko_pastur.py +55 -0
- physicskit/rmt/stats/pt_symmetric.py +265 -0
- physicskit/rmt/stats/ratios.py +110 -0
- physicskit/rmt/stats/real_ginibre.py +134 -0
- physicskit/rmt/stats/rigidity.py +272 -0
- physicskit/rmt/stats/single_ring.py +95 -0
- physicskit/rmt/stats/spacing.py +150 -0
- physicskit/rmt/stats/tracy_widom.py +175 -0
- physicskit/rmt/stats/truncated_unitary.py +40 -0
- physicskit/rmt/stats/unfolding.py +37 -0
- physicskit/rmt/stats/wachter.py +67 -0
- physicskit/rmt/tests/__init__.py +0 -0
- physicskit/rmt/tests/cache_utils.py +107 -0
- physicskit/rmt/tests/conftest.py +8 -0
- physicskit/rmt/tests/test_banded.py +86 -0
- physicskit/rmt/tests/test_base.py +29 -0
- physicskit/rmt/tests/test_bdg.py +133 -0
- physicskit/rmt/tests/test_characteristic_polynomial.py +50 -0
- physicskit/rmt/tests/test_chiral.py +273 -0
- physicskit/rmt/tests/test_circular.py +225 -0
- physicskit/rmt/tests/test_crossover.py +72 -0
- physicskit/rmt/tests/test_density.py +23 -0
- physicskit/rmt/tests/test_density_matrix.py +181 -0
- physicskit/rmt/tests/test_effective_hamiltonian.py +140 -0
- physicskit/rmt/tests/test_embedded.py +169 -0
- physicskit/rmt/tests/test_free_probability.py +81 -0
- physicskit/rmt/tests/test_gaussian_ensembles.py +22 -0
- physicskit/rmt/tests/test_gaussian_semicircle.py +127 -0
- physicskit/rmt/tests/test_ginibre_circular_law.py +131 -0
- physicskit/rmt/tests/test_girko.py +178 -0
- physicskit/rmt/tests/test_graph_laplacian.py +102 -0
- physicskit/rmt/tests/test_haar.py +118 -0
- physicskit/rmt/tests/test_jacobi_wachter.py +136 -0
- physicskit/rmt/tests/test_localization.py +240 -0
- physicskit/rmt/tests/test_poisson.py +149 -0
- physicskit/rmt/tests/test_polynomial.py +107 -0
- physicskit/rmt/tests/test_pt_symmetric.py +178 -0
- physicskit/rmt/tests/test_random_state.py +19 -0
- physicskit/rmt/tests/test_real_ginibre.py +112 -0
- physicskit/rmt/tests/test_rigidity_universality.py +167 -0
- physicskit/rmt/tests/test_single_ring.py +132 -0
- physicskit/rmt/tests/test_spacing_and_ratios.py +122 -0
- physicskit/rmt/tests/test_sparse.py +71 -0
- physicskit/rmt/tests/test_spectrum.py +27 -0
- physicskit/rmt/tests/test_syk.py +136 -0
- physicskit/rmt/tests/test_tracy_widom.py +113 -0
- physicskit/rmt/tests/test_tridiagonal.py +41 -0
- physicskit/rmt/tests/test_truncated_unitary.py +80 -0
- physicskit/rmt/tests/test_validation_base.py +25 -0
- physicskit/rmt/tests/test_validation_misc.py +67 -0
- physicskit/rmt/tests/test_wishart_marchenko_pastur.py +120 -0
- physicskit/rmt/utils/__init__.py +0 -0
- physicskit/rmt/utils/haar.py +128 -0
- physicskit/rmt/utils/random_state.py +24 -0
- physicskit/rmt/utils/tridiagonal.py +167 -0
- physicskit/rmt/validation/__init__.py +36 -0
- physicskit/rmt/validation/base.py +126 -0
- physicskit/rmt/validation/circular_law.py +80 -0
- physicskit/rmt/validation/marchenko_pastur.py +53 -0
- physicskit/rmt/validation/ratio_distribution.py +53 -0
- physicskit/rmt/validation/real_ginibre.py +60 -0
- physicskit/rmt/validation/sine_kernel.py +57 -0
- physicskit/rmt/validation/single_ring.py +68 -0
- physicskit/rmt/validation/tracy_widom.py +89 -0
- physicskit/rmt/validation/universality.py +100 -0
- physicskit/rmt/validation/wachter.py +52 -0
- physicskit/rmt/validation/wigner_semicircle.py +40 -0
- physicskit/rmt/validation/wigner_surmise.py +58 -0
- physicskit/semiclassical/__init__.py +94 -0
- physicskit/semiclassical/_compat.py +5 -0
- physicskit/semiclassical/core/__init__.py +41 -0
- physicskit/semiclassical/core/gutzwiller.py +215 -0
- physicskit/semiclassical/core/path_integral.py +594 -0
- physicskit/semiclassical/core/propagators.py +579 -0
- physicskit/semiclassical/core/wkb.py +308 -0
- physicskit/semiclassical/systems/__init__.py +13 -0
- physicskit/semiclassical/systems/scarring.py +278 -0
- physicskit/semiclassical/tests/__init__.py +0 -0
- physicskit/semiclassical/tests/test_gutzwiller.py +35 -0
- physicskit/semiclassical/tests/test_path_integral.py +194 -0
- physicskit/semiclassical/tests/test_propagators.py +82 -0
- physicskit/semiclassical/tests/test_scarring.py +43 -0
- physicskit/semiclassical/tests/test_visualizers.py +89 -0
- physicskit/semiclassical/tests/test_wkb.py +30 -0
- physicskit/semiclassical/visualizers/__init__.py +17 -0
- physicskit/semiclassical/visualizers/gutzwiller.py +55 -0
- physicskit/semiclassical/visualizers/path_integral.py +195 -0
- physicskit/semiclassical/visualizers/propagators.py +89 -0
- physicskit/semiclassical/visualizers/scarring.py +146 -0
- physicskit/semiclassical/visualizers/wkb.py +55 -0
- physicskit/statphys/__init__.py +80 -0
- physicskit/statphys/chapters/__init__.py +43 -0
- physicskit/statphys/chapters/ehrenfest_urn.py +112 -0
- physicskit/statphys/chapters/ising_lattice.py +431 -0
- physicskit/statphys/chapters/kpz_growth.py +129 -0
- physicskit/statphys/chapters/molecular_dynamics.py +258 -0
- physicskit/statphys/chapters/nonequilibrium_work.py +146 -0
- physicskit/statphys/chapters/percolation.py +305 -0
- physicskit/statphys/chapters/random_walk.py +142 -0
- physicskit/statphys/chapters/renormalization.py +148 -0
- physicskit/statphys/chapters/sandpile.py +109 -0
- physicskit/statphys/chapters/spin_glass.py +275 -0
- physicskit/statphys/core/__init__.py +10 -0
- physicskit/statphys/core/kpz_engine.py +53 -0
- physicskit/statphys/core/md_engine.py +157 -0
- physicskit/statphys/core/monte_carlo.py +462 -0
- physicskit/statphys/core/random_walk_engine.py +68 -0
- physicskit/statphys/core/sandpile_engine.py +52 -0
- physicskit/statphys/tests/__init__.py +0 -0
- physicskit/statphys/tests/test_dynamics.py +66 -0
- physicskit/statphys/tests/test_ehrenfest_urn.py +44 -0
- physicskit/statphys/tests/test_finite_size_scaling.py +62 -0
- physicskit/statphys/tests/test_interactive.py +33 -0
- physicskit/statphys/tests/test_ising.py +68 -0
- physicskit/statphys/tests/test_kpz.py +55 -0
- physicskit/statphys/tests/test_landau_theory.py +49 -0
- physicskit/statphys/tests/test_md_engine.py +31 -0
- physicskit/statphys/tests/test_molecular_dynamics.py +72 -0
- physicskit/statphys/tests/test_nonequilibrium_work.py +33 -0
- physicskit/statphys/tests/test_partition_function.py +26 -0
- physicskit/statphys/tests/test_percolation.py +116 -0
- physicskit/statphys/tests/test_potts_model.py +46 -0
- physicskit/statphys/tests/test_random_walk.py +50 -0
- physicskit/statphys/tests/test_renormalization.py +44 -0
- physicskit/statphys/tests/test_sandpile.py +44 -0
- physicskit/statphys/tests/test_spin_glass.py +73 -0
- physicskit/statphys/tests/test_thermodynamics.py +121 -0
- physicskit/statphys/tests/test_xy_model.py +45 -0
- physicskit/statphys/utils/__init__.py +1 -0
- physicskit/statphys/utils/dynamics.py +100 -0
- physicskit/statphys/utils/finite_size_scaling.py +171 -0
- physicskit/statphys/utils/landau_theory.py +151 -0
- physicskit/statphys/utils/partition_function.py +109 -0
- physicskit/statphys/utils/thermodynamics.py +356 -0
- physicskit/statphys/visualizers/__init__.py +87 -0
- physicskit/statphys/visualizers/interactive.py +161 -0
- physicskit/statphys/visualizers/jarzynski_render.py +44 -0
- physicskit/statphys/visualizers/kpz_render.py +65 -0
- physicskit/statphys/visualizers/lattice_render.py +212 -0
- physicskit/statphys/visualizers/particle_render.py +121 -0
- physicskit/statphys/visualizers/random_walk_render.py +106 -0
- physicskit/statphys/visualizers/rg_render.py +45 -0
- physicskit/statphys/visualizers/sandpile_render.py +65 -0
- physicskit/statphys/visualizers/spin_glass_render.py +40 -0
- physicskit/statphys/visualizers/urn_render.py +38 -0
- physicskit/statphys/visualizers/vortex_render.py +84 -0
- physicskit/tests/__init__.py +0 -0
- physicskit/tests/test_constants.py +38 -0
- physicskit-0.1.0.dist-info/METADATA +196 -0
- physicskit-0.1.0.dist-info/RECORD +484 -0
- physicskit-0.1.0.dist-info/WHEEL +5 -0
- physicskit-0.1.0.dist-info/licenses/LICENSE +21 -0
- physicskit-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
r"""Quantum optics in the truncated Fock basis: states, Wigner functions, and Jaynes-Cummings dynamics.
|
|
2
|
+
|
|
3
|
+
Light is quantized in terms of the harmonic-oscillator (photon-number, or
|
|
4
|
+
Fock) states :math:`\lvert n\rangle` of a single cavity mode. This module
|
|
5
|
+
works throughout in a Fock basis truncated to a finite dimension
|
|
6
|
+
``cutoff`` -- large enough that the state's amplitude on the highest
|
|
7
|
+
retained level is negligible -- and provides:
|
|
8
|
+
|
|
9
|
+
- constructors for the number, coherent, and squeezed states (built from
|
|
10
|
+
the ladder operators of :mod:`physicskit.quantum.core.operators`);
|
|
11
|
+
- the Wigner quasi-probability distribution, computed from its closed-form
|
|
12
|
+
matrix elements in the Fock basis (Cahill & Glauber, *Phys. Rev.* **177**,
|
|
13
|
+
1857, 1969), using the dimensionless quadratures
|
|
14
|
+
|
|
15
|
+
.. math::
|
|
16
|
+
|
|
17
|
+
\hat x = \frac{\hat a + \hat a^\dagger}{\sqrt2}, \qquad
|
|
18
|
+
\hat p = \frac{\hat a - \hat a^\dagger}{i\sqrt2};
|
|
19
|
+
|
|
20
|
+
- the Jaynes-Cummings model (Jaynes & Cummings, *Proc. IEEE* **51**, 89,
|
|
21
|
+
1963), the fully quantum treatment of a two-level atom coupled to a
|
|
22
|
+
single cavity mode in the rotating-wave approximation, famous for
|
|
23
|
+
predicting vacuum Rabi oscillations and collapse-and-revival -- effects
|
|
24
|
+
with no semiclassical analogue.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
from __future__ import annotations
|
|
28
|
+
|
|
29
|
+
import numpy as np
|
|
30
|
+
from scipy.linalg import expm
|
|
31
|
+
from scipy.special import eval_genlaguerre, gammaln
|
|
32
|
+
|
|
33
|
+
from physicskit.optics._compat import trapz
|
|
34
|
+
from physicskit.quantum.core.operators import annihilation_operator, creation_operator
|
|
35
|
+
|
|
36
|
+
__all__ = [
|
|
37
|
+
"fock_state",
|
|
38
|
+
"coherent_state",
|
|
39
|
+
"squeezed_state",
|
|
40
|
+
"compute_wigner_function",
|
|
41
|
+
"wigner_negativity",
|
|
42
|
+
"JaynesCummingsModel",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def fock_state(n, cutoff):
|
|
47
|
+
r"""The number (Fock) state :math:`\lvert n\rangle`.
|
|
48
|
+
|
|
49
|
+
Parameters
|
|
50
|
+
----------
|
|
51
|
+
n : int
|
|
52
|
+
Photon number.
|
|
53
|
+
cutoff : int
|
|
54
|
+
Dimension of the truncated Fock space.
|
|
55
|
+
|
|
56
|
+
Returns
|
|
57
|
+
-------
|
|
58
|
+
ndarray of shape (cutoff,)
|
|
59
|
+
Complex state vector, all zeros except a ``1`` at index ``n``.
|
|
60
|
+
|
|
61
|
+
Raises
|
|
62
|
+
------
|
|
63
|
+
ValueError
|
|
64
|
+
If ``n`` is negative or ``n >= cutoff``.
|
|
65
|
+
|
|
66
|
+
Examples
|
|
67
|
+
--------
|
|
68
|
+
>>> fock_state(1, 4)
|
|
69
|
+
array([0.+0.j, 1.+0.j, 0.+0.j, 0.+0.j])
|
|
70
|
+
"""
|
|
71
|
+
if n < 0 or n >= cutoff:
|
|
72
|
+
raise ValueError(f"n={n} must satisfy 0 <= n < cutoff={cutoff}.")
|
|
73
|
+
state = np.zeros(cutoff, dtype=complex)
|
|
74
|
+
state[n] = 1.0
|
|
75
|
+
return state
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def coherent_state(alpha, cutoff):
|
|
79
|
+
r"""The coherent state :math:`\lvert\alpha\rangle`, truncated to a finite Fock basis.
|
|
80
|
+
|
|
81
|
+
.. math::
|
|
82
|
+
|
|
83
|
+
\lvert\alpha\rangle = e^{-\lvert\alpha\rvert^2/2}
|
|
84
|
+
\sum_{n=0}^{\infty} \frac{\alpha^n}{\sqrt{n!}}\,\lvert n\rangle
|
|
85
|
+
|
|
86
|
+
The sum is truncated to ``cutoff`` terms and the result renormalized,
|
|
87
|
+
so it is a good approximation only while :math:`\lvert\alpha\rvert^2
|
|
88
|
+
\ll` ``cutoff`` (i.e. the mean photon number is well within the
|
|
89
|
+
truncated space). Amplitudes are built iteratively in log-space via
|
|
90
|
+
:func:`scipy.special.gammaln` to avoid overflow for large ``cutoff``.
|
|
91
|
+
|
|
92
|
+
Parameters
|
|
93
|
+
----------
|
|
94
|
+
alpha : complex
|
|
95
|
+
Coherent-state amplitude.
|
|
96
|
+
cutoff : int
|
|
97
|
+
Dimension of the truncated Fock space.
|
|
98
|
+
|
|
99
|
+
Returns
|
|
100
|
+
-------
|
|
101
|
+
ndarray of shape (cutoff,)
|
|
102
|
+
Complex, L2-normalized state vector.
|
|
103
|
+
|
|
104
|
+
Examples
|
|
105
|
+
--------
|
|
106
|
+
>>> psi = coherent_state(0.0, 8)
|
|
107
|
+
>>> psi
|
|
108
|
+
array([1.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j])
|
|
109
|
+
"""
|
|
110
|
+
alpha = complex(alpha)
|
|
111
|
+
n = np.arange(cutoff)
|
|
112
|
+
r = abs(alpha)
|
|
113
|
+
if r == 0.0:
|
|
114
|
+
log_amp = np.full(cutoff, -np.inf)
|
|
115
|
+
log_amp[0] = 0.0
|
|
116
|
+
else:
|
|
117
|
+
log_amp = -0.5 * r**2 + n * np.log(r) - 0.5 * gammaln(n + 1.0)
|
|
118
|
+
amp = np.exp(log_amp)
|
|
119
|
+
phase = np.exp(1j * n * np.angle(alpha)) if alpha != 0 else np.ones(cutoff)
|
|
120
|
+
psi = (amp * phase).astype(complex)
|
|
121
|
+
psi /= np.linalg.norm(psi)
|
|
122
|
+
return psi
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def squeezed_state(xi, alpha=0.0, cutoff=30):
|
|
126
|
+
r"""The displaced squeezed vacuum state, using the squeeze-then-displace convention.
|
|
127
|
+
|
|
128
|
+
Constructs
|
|
129
|
+
|
|
130
|
+
.. math::
|
|
131
|
+
|
|
132
|
+
\lvert\xi, \alpha\rangle = \hat D(\alpha)\, \hat S(\xi)\, \lvert 0\rangle,
|
|
133
|
+
\qquad
|
|
134
|
+
\hat S(\xi) = \exp\!\left[\frac{\xi^* \hat a^2 - \xi \hat a^{\dagger 2}}{2}\right],
|
|
135
|
+
\qquad
|
|
136
|
+
\hat D(\alpha) = \exp\!\left(\alpha \hat a^\dagger - \alpha^* \hat a\right)
|
|
137
|
+
|
|
138
|
+
i.e. the vacuum is squeezed first and then displaced. (The opposite
|
|
139
|
+
order, displace-then-squeeze, gives a different, also physically valid,
|
|
140
|
+
state -- squeeze-then-displace is the convention adopted here and is
|
|
141
|
+
the more common one in the literature.) The ladder operators are built
|
|
142
|
+
on the same truncated Fock basis, so this is only accurate while the
|
|
143
|
+
squeezed/displaced amplitude is small relative to ``cutoff``.
|
|
144
|
+
|
|
145
|
+
Parameters
|
|
146
|
+
----------
|
|
147
|
+
xi : complex
|
|
148
|
+
Squeezing parameter :math:`\xi = r e^{i\theta}`.
|
|
149
|
+
alpha : complex, default=0.0
|
|
150
|
+
Displacement amplitude.
|
|
151
|
+
cutoff : int, default=30
|
|
152
|
+
Dimension of the truncated Fock space.
|
|
153
|
+
|
|
154
|
+
Returns
|
|
155
|
+
-------
|
|
156
|
+
ndarray of shape (cutoff,)
|
|
157
|
+
Complex, L2-normalized state vector.
|
|
158
|
+
|
|
159
|
+
Examples
|
|
160
|
+
--------
|
|
161
|
+
>>> psi = squeezed_state(0.0, alpha=0.0, cutoff=6)
|
|
162
|
+
>>> psi
|
|
163
|
+
array([1.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j])
|
|
164
|
+
"""
|
|
165
|
+
xi = complex(xi)
|
|
166
|
+
alpha = complex(alpha)
|
|
167
|
+
a = annihilation_operator(cutoff)
|
|
168
|
+
a_dag = creation_operator(cutoff)
|
|
169
|
+
S = expm(0.5 * (np.conj(xi) * (a @ a) - xi * (a_dag @ a_dag)))
|
|
170
|
+
D = expm(alpha * a_dag - np.conj(alpha) * a)
|
|
171
|
+
vac = fock_state(0, cutoff)
|
|
172
|
+
psi = D @ (S @ vac)
|
|
173
|
+
psi = psi / np.linalg.norm(psi)
|
|
174
|
+
return psi
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def _wigner_kernel(n, m, x, p):
|
|
178
|
+
r"""Fock-basis Wigner-function kernel :math:`K_{nm}(x,p)` for :math:`n \le m`.
|
|
179
|
+
|
|
180
|
+
Defined so that :math:`W(x,p) = \sum_{n \le m}\left[\rho_{nm} K_{nm}
|
|
181
|
+
+ \rho_{mn} K_{nm}^*\right]` (with the ``n == m`` term counted once),
|
|
182
|
+
reducing at :math:`n=m` to the well-known diagonal Fock-state Wigner
|
|
183
|
+
function :math:`W_n(x,p) = (-1)^n/\pi\, e^{-(x^2+p^2)} L_n[2(x^2+p^2)]`.
|
|
184
|
+
"""
|
|
185
|
+
s = x**2 + p**2
|
|
186
|
+
z = x - 1j * p
|
|
187
|
+
log_coeff = 0.5 * (gammaln(n + 1.0) - gammaln(m + 1.0))
|
|
188
|
+
coeff = (-1.0) ** n * np.exp(log_coeff)
|
|
189
|
+
return (1.0 / np.pi) * coeff * (np.sqrt(2.0) * z) ** (m - n) * np.exp(-s) * eval_genlaguerre(n, m - n, 2.0 * s)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def compute_wigner_function(state_vector, x_grid, p_grid):
|
|
193
|
+
r"""Wigner quasi-probability distribution of a Fock-basis state.
|
|
194
|
+
|
|
195
|
+
Computed from the density matrix :math:`\rho = \lvert\psi\rangle\langle\psi\rvert`
|
|
196
|
+
and the closed-form Fock-basis Wigner matrix elements,
|
|
197
|
+
|
|
198
|
+
.. math::
|
|
199
|
+
|
|
200
|
+
W(x,p) = \sum_{n,m} \rho_{nm}\, K_{nm}(x,p),
|
|
201
|
+
|
|
202
|
+
with :math:`K_{nm}` built from associated Laguerre polynomials of
|
|
203
|
+
:math:`2(x^2+p^2)` (see :func:`scipy.special.eval_genlaguerre`). Uses
|
|
204
|
+
dimensionless quadratures :math:`x = (a+a^\dagger)/\sqrt2`,
|
|
205
|
+
:math:`p = (a-a^\dagger)/(i\sqrt2)`, for which
|
|
206
|
+
:math:`\iint W(x,p)\,dx\,dp = 1` for any normalized state.
|
|
207
|
+
|
|
208
|
+
Parameters
|
|
209
|
+
----------
|
|
210
|
+
state_vector : ndarray of shape (cutoff,)
|
|
211
|
+
Fock-basis ket.
|
|
212
|
+
x_grid : ndarray of shape (Nx,)
|
|
213
|
+
Grid of :math:`x` quadrature values.
|
|
214
|
+
p_grid : ndarray of shape (Np,)
|
|
215
|
+
Grid of :math:`p` quadrature values.
|
|
216
|
+
|
|
217
|
+
Returns
|
|
218
|
+
-------
|
|
219
|
+
ndarray of shape (Nx, Np)
|
|
220
|
+
Real-valued Wigner function :math:`W(x,p)`.
|
|
221
|
+
|
|
222
|
+
Examples
|
|
223
|
+
--------
|
|
224
|
+
>>> import numpy as np
|
|
225
|
+
>>> vac = fock_state(0, 8)
|
|
226
|
+
>>> xg = np.linspace(-4, 4, 41)
|
|
227
|
+
>>> pg = np.linspace(-4, 4, 41)
|
|
228
|
+
>>> W = compute_wigner_function(vac, xg, pg)
|
|
229
|
+
>>> W.shape
|
|
230
|
+
(41, 41)
|
|
231
|
+
>>> round(float(W[20, 20] * np.pi), 6)
|
|
232
|
+
1.0
|
|
233
|
+
"""
|
|
234
|
+
psi = np.asarray(state_vector, dtype=complex).reshape(-1)
|
|
235
|
+
cutoff = psi.shape[0]
|
|
236
|
+
rho = np.outer(psi, psi.conj())
|
|
237
|
+
x_grid = np.asarray(x_grid, dtype=float)
|
|
238
|
+
p_grid = np.asarray(p_grid, dtype=float)
|
|
239
|
+
X, P = np.meshgrid(x_grid, p_grid, indexing="ij")
|
|
240
|
+
W = np.zeros_like(X, dtype=complex)
|
|
241
|
+
for n in range(cutoff):
|
|
242
|
+
for m in range(n, cutoff):
|
|
243
|
+
K = _wigner_kernel(n, m, X, P)
|
|
244
|
+
if m == n:
|
|
245
|
+
W = W + rho[n, n] * K
|
|
246
|
+
else:
|
|
247
|
+
W = W + rho[n, m] * K + rho[m, n] * np.conj(K)
|
|
248
|
+
return W.real
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
def wigner_negativity(W, x_grid, p_grid):
|
|
252
|
+
r"""Wigner negativity: the integrated negative volume of a Wigner function.
|
|
253
|
+
|
|
254
|
+
.. math::
|
|
255
|
+
|
|
256
|
+
N_W = \iint \max(0, -W(x,p))\; dx\, dp
|
|
257
|
+
|
|
258
|
+
A standard non-classicality diagnostic: zero for classical/Gaussian
|
|
259
|
+
states (coherent, thermal, squeezed vacuum), strictly positive for
|
|
260
|
+
genuinely non-classical states such as Fock states with :math:`n \ge 1`.
|
|
261
|
+
|
|
262
|
+
Parameters
|
|
263
|
+
----------
|
|
264
|
+
W : ndarray of shape (Nx, Np)
|
|
265
|
+
Wigner function, e.g. from :func:`compute_wigner_function`.
|
|
266
|
+
x_grid : ndarray of shape (Nx,)
|
|
267
|
+
Grid of :math:`x` quadrature values.
|
|
268
|
+
p_grid : ndarray of shape (Np,)
|
|
269
|
+
Grid of :math:`p` quadrature values.
|
|
270
|
+
|
|
271
|
+
Returns
|
|
272
|
+
-------
|
|
273
|
+
float
|
|
274
|
+
The (non-negative) integrated negative volume.
|
|
275
|
+
|
|
276
|
+
Examples
|
|
277
|
+
--------
|
|
278
|
+
>>> import numpy as np
|
|
279
|
+
>>> vac = fock_state(0, 8)
|
|
280
|
+
>>> xg = np.linspace(-5, 5, 61)
|
|
281
|
+
>>> pg = np.linspace(-5, 5, 61)
|
|
282
|
+
>>> W = compute_wigner_function(vac, xg, pg)
|
|
283
|
+
>>> wigner_negativity(W, xg, pg)
|
|
284
|
+
0.0
|
|
285
|
+
"""
|
|
286
|
+
negative_part = np.where(W < 0.0, -W, 0.0)
|
|
287
|
+
integral_over_p = trapz(negative_part, p_grid, axis=1)
|
|
288
|
+
return float(trapz(integral_over_p, x_grid))
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
class JaynesCummingsModel:
|
|
292
|
+
r"""The Jaynes-Cummings model: a two-level atom coupled to a single quantized cavity mode.
|
|
293
|
+
|
|
294
|
+
In the rotating-wave approximation, the Hamiltonian is
|
|
295
|
+
|
|
296
|
+
.. math::
|
|
297
|
+
|
|
298
|
+
\hat H = \omega_c\, \hat a^\dagger \hat a \otimes \hat I
|
|
299
|
+
+ \frac{\omega_a}{2}\, \hat I \otimes \hat\sigma_z
|
|
300
|
+
+ g\left(\hat a \otimes \hat\sigma_+ + \hat a^\dagger \otimes \hat\sigma_-\right)
|
|
301
|
+
|
|
302
|
+
with the cavity (dimension ``cutoff``) as the *left* tensor factor and
|
|
303
|
+
the atom (dimension 2, basis :math:`\{\lvert e\rangle, \lvert g\rangle\}`,
|
|
304
|
+
so :math:`\hat\sigma_z = \mathrm{diag}(+1,-1)`, :math:`\hat\sigma_+ =
|
|
305
|
+
\lvert e\rangle\langle g\rvert`, :math:`\hat\sigma_- = \lvert
|
|
306
|
+
g\rangle\langle e\rvert`) as the *right* factor, i.e. ``H = kron(H_cav,
|
|
307
|
+
H_atom)`` terms throughout. A combined basis state :math:`\lvert n,
|
|
308
|
+
e/g\rangle` therefore sits at flat index ``2*n`` (excited) or ``2*n+1``
|
|
309
|
+
(ground) of the ``2*cutoff``-dimensional Hilbert space.
|
|
310
|
+
|
|
311
|
+
Parameters
|
|
312
|
+
----------
|
|
313
|
+
omega_c : float
|
|
314
|
+
Cavity mode frequency.
|
|
315
|
+
omega_a : float
|
|
316
|
+
Atomic transition frequency.
|
|
317
|
+
g : float
|
|
318
|
+
Atom-cavity coupling strength.
|
|
319
|
+
cutoff : int, default=10
|
|
320
|
+
Truncation of the cavity Fock space.
|
|
321
|
+
"""
|
|
322
|
+
|
|
323
|
+
def __init__(self, omega_c, omega_a, g, cutoff=10):
|
|
324
|
+
self.omega_c = omega_c
|
|
325
|
+
self.omega_a = omega_a
|
|
326
|
+
self.g = g
|
|
327
|
+
self.cutoff = cutoff
|
|
328
|
+
|
|
329
|
+
def hamiltonian(self):
|
|
330
|
+
r"""The Jaynes-Cummings Hamiltonian as a dense matrix.
|
|
331
|
+
|
|
332
|
+
Returns
|
|
333
|
+
-------
|
|
334
|
+
ndarray of shape (2*cutoff, 2*cutoff)
|
|
335
|
+
The Hamiltonian :math:`\hat H`, in the ``cavity (x) atom``
|
|
336
|
+
basis ordering documented on the class.
|
|
337
|
+
|
|
338
|
+
Examples
|
|
339
|
+
--------
|
|
340
|
+
>>> import numpy as np
|
|
341
|
+
>>> jc = JaynesCummingsModel(omega_c=1.0, omega_a=1.0, g=0.1, cutoff=3)
|
|
342
|
+
>>> H = jc.hamiltonian()
|
|
343
|
+
>>> H.shape
|
|
344
|
+
(6, 6)
|
|
345
|
+
>>> bool(np.allclose(H, H.conj().T))
|
|
346
|
+
True
|
|
347
|
+
"""
|
|
348
|
+
cutoff = self.cutoff
|
|
349
|
+
a = annihilation_operator(cutoff)
|
|
350
|
+
a_dag = creation_operator(cutoff)
|
|
351
|
+
N = a_dag @ a
|
|
352
|
+
I2 = np.eye(2, dtype=complex)
|
|
353
|
+
I_cav = np.eye(cutoff, dtype=complex)
|
|
354
|
+
sigma_z = np.diag([1.0, -1.0]).astype(complex)
|
|
355
|
+
sigma_plus = np.array([[0.0, 1.0], [0.0, 0.0]], dtype=complex) # |e><g|
|
|
356
|
+
sigma_minus = np.array([[0.0, 0.0], [1.0, 0.0]], dtype=complex) # |g><e|
|
|
357
|
+
H = self.omega_c * np.kron(N, I2) + 0.5 * self.omega_a * np.kron(I_cav, sigma_z) + self.g * (np.kron(a, sigma_plus) + np.kron(a_dag, sigma_minus))
|
|
358
|
+
return H
|
|
359
|
+
|
|
360
|
+
def evolve(self, psi0, t_array):
|
|
361
|
+
r"""Time-evolve a state under the Jaynes-Cummings Hamiltonian.
|
|
362
|
+
|
|
363
|
+
Diagonalizes :math:`\hat H` once and reconstructs
|
|
364
|
+
:math:`\lvert\psi(t)\rangle = e^{-i\hat H t}\lvert\psi_0\rangle` at
|
|
365
|
+
every requested time from the eigendecomposition, which is much
|
|
366
|
+
faster than exponentiating :math:`\hat H` separately for each
|
|
367
|
+
``t``.
|
|
368
|
+
|
|
369
|
+
Parameters
|
|
370
|
+
----------
|
|
371
|
+
psi0 : ndarray of shape (2*cutoff,)
|
|
372
|
+
Initial state.
|
|
373
|
+
t_array : ndarray of shape (T,)
|
|
374
|
+
Times at which to evaluate the evolved state.
|
|
375
|
+
|
|
376
|
+
Returns
|
|
377
|
+
-------
|
|
378
|
+
ndarray of shape (T, 2*cutoff)
|
|
379
|
+
Complex states :math:`\lvert\psi(t)\rangle` at each requested time.
|
|
380
|
+
"""
|
|
381
|
+
H = self.hamiltonian()
|
|
382
|
+
eigvals, eigvecs = np.linalg.eigh(H)
|
|
383
|
+
psi0 = np.asarray(psi0, dtype=complex).reshape(-1)
|
|
384
|
+
c = eigvecs.conj().T @ psi0
|
|
385
|
+
t_array = np.asarray(t_array, dtype=float)
|
|
386
|
+
phase = np.exp(-1j * np.outer(t_array, eigvals))
|
|
387
|
+
coeffs_t = phase * c[np.newaxis, :]
|
|
388
|
+
return coeffs_t @ eigvecs.T
|
|
389
|
+
|
|
390
|
+
def excited_state_population(self, t_array, n_photons=0):
|
|
391
|
+
r"""Atomic excited-state population :math:`P_e(t)` starting from :math:`\lvert e, n\rangle`.
|
|
392
|
+
|
|
393
|
+
Starts from the initial state :math:`\lvert e, n_\text{photons}\rangle`
|
|
394
|
+
(atom excited, ``n_photons`` photons in the cavity) and returns
|
|
395
|
+
|
|
396
|
+
.. math::
|
|
397
|
+
|
|
398
|
+
P_e(t) = \sum_n \left\lvert \langle e, n \rvert \psi(t)\rangle \right\rvert^2.
|
|
399
|
+
|
|
400
|
+
On resonance (:math:`\omega_c = \omega_a`) with ``n_photons=0``,
|
|
401
|
+
this reduces to the textbook vacuum Rabi formula :math:`P_e(t) =
|
|
402
|
+
\cos^2(gt)`.
|
|
403
|
+
|
|
404
|
+
Parameters
|
|
405
|
+
----------
|
|
406
|
+
t_array : ndarray of shape (T,)
|
|
407
|
+
Times at which to evaluate the population.
|
|
408
|
+
n_photons : int, default=0
|
|
409
|
+
Initial photon number (with the atom excited).
|
|
410
|
+
|
|
411
|
+
Returns
|
|
412
|
+
-------
|
|
413
|
+
ndarray of shape (T,)
|
|
414
|
+
Real-valued excited-state population at each time.
|
|
415
|
+
|
|
416
|
+
Examples
|
|
417
|
+
--------
|
|
418
|
+
>>> import numpy as np
|
|
419
|
+
>>> jc = JaynesCummingsModel(omega_c=1.0, omega_a=1.0, g=0.5, cutoff=10)
|
|
420
|
+
>>> t = np.array([0.0, np.pi / 2 / 0.5])
|
|
421
|
+
>>> Pe = jc.excited_state_population(t, n_photons=0)
|
|
422
|
+
>>> np.round(Pe, 6)
|
|
423
|
+
array([1., 0.])
|
|
424
|
+
"""
|
|
425
|
+
psi0 = fock_state(2 * n_photons, 2 * self.cutoff)
|
|
426
|
+
psi_t = self.evolve(psi0, t_array)
|
|
427
|
+
excited_amplitudes = psi_t[:, 0::2]
|
|
428
|
+
return np.sum(np.abs(excited_amplitudes) ** 2, axis=1).real
|