No project description provided
Project description
Onicescu Energy
A Python package for computing Onicescu's Informational Energy, particularly useful in quantum physics and information theory applications.
Overview
The onicescu_energy package provides a simple function to calculate Onicescu's Informational Energy for a given probability distribution. This measure quantifies the concentration or dispersion within a distribution and is defined as:
$$ E = \sum_{i=1}^{n} p_i^2 $$
For continuous distributions, it adapts to:
$$ E = \int [\rho(x)]^2 , dx $$
This concept is particularly relevant in quantum mechanics, where it can be used to analyze the localization properties of quantum states.
Installation
Install the package via pip:
pip install onicescu_energy
Dependencies
- NumPy: A fundamental package for numerical computations in Python.
Usage
Import the necessary modules and the onicescu_energy function:
import numpy as np
from onicescu_energy import onicescu_energy
Computing Onicescu's Informational Energy
For a discrete probability distribution:
# Example discrete probability distribution
probabilities = np.array([0.2, 0.5, 0.3])
# Calculate Onicescu's Informational Energy
E = onicescu_energy(probabilities)
print(f"Onicescu's Informational Energy: {E}")
Computing for Quantum States
Suppose you have a quantum state represented by a wavefunction, and you want to compute the informational energy.
# Define the probability density function |(x)|²
def probability_density(x):
# Example: |(x)|² = 2/L * sin²(nπx/L)
L = 1.0 # Width of the potential well
n = 1 # Energy level
return (2 / L) * np.sin(n * np.pi * x / L)**2
# Generate a range of x values
x_values = np.linspace(0, 1, 1000)
dx = x_values[1] - x_values[0]
# Compute the probability densities
prob_densities = probability_density(x_values)
# For continuous distributions, approximate the integral
E = onicescu_energy(prob_densities) * dx
print(f"Onicescu's Informational Energy for the quantum state: {E}")
Function Definition
The onicescu_energy function computes the informational energy for a given array of probabilities or probability densities.
def onicescu_energy(probabilities):
"""
Calculates Onicescu's Informational Energy.
Parameters:
probabilities (numpy.array): An array of probabilities or probability densities.
Returns:
float: The calculated informational energy.
"""
return np.sum(probabilities**2)
Important Notes
-
Ensure that the probabilities or probability densities provided are properly normalized.
-
Discrete distributions: Probabilities should sum up to 1.
-
Continuous distributions: The integral of the probability density over the entire space should be 1.
-
-
When working with continuous distributions, multiplying by the differential element (e.g.,
dx) is necessary to approximate the integral.
License
This project is licensed under the MIT License.
Author
[Daia Alexandru]
Contribution
Contributions are welcome! Please feel free to submit issues or pull requests.
Contact
For any questions or inquiries, please contact your.email@example.com.
Acknowledgments
- Inspired by the work on Onicescu's Informational Energy in quantum physics.
- Special thanks to the open-source community for providing the tools that make this package possible.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kinetic_energy-0.2.tar.gz.
File metadata
- Download URL: kinetic_energy-0.2.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5de38086123d688f953ae7bfac23c58e5028807459856fe3c65370878e3ce69a
|
|
| MD5 |
55c0c207367c921ff9cc6f1c64a65d81
|
|
| BLAKE2b-256 |
532b4733a8431c015b107fd0bcb4c987bee32de9afe47b03efce8b9be2940f55
|
File details
Details for the file kinetic_energy-0.2-py3-none-any.whl.
File metadata
- Download URL: kinetic_energy-0.2-py3-none-any.whl
- Upload date:
- Size: 2.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28156d57609e953d78383e5b82de4711d20840decc5eb58593ff8b2a208b1d23
|
|
| MD5 |
b453c050d55d801e8bf88eca45ee9629
|
|
| BLAKE2b-256 |
729b0ee46f6a3de466811cc617618e72125282e887e2db269b2bba5b4a798f87
|