Author: Derek Hinch*
License: MIT
Abstract
This paper explores the concepts of Hilbert space and superposition using quaternions and the Haar wavelet transform. By applying the Haar wavelet transform to a sequence of quaternions, we illustrate the principles of superposition and transformation within a Hilbert space, demonstrating how these mathematical tools interact to process and analyze multidimensional data.
Keywords: Hilbert space, superposition, quaternions, Haar wavelet transform, signal processing
Hilbert space is a fundamental concept in quantum mechanics, providing a framework for describing quantum states and their evolution. Quaternions, which extend complex numbers to four dimensions, are particularly useful in representing rotations and orientations in three-dimensional space. By applying the Haar wavelet transform to a sequence of quaternions, we can illustrate the principles of superposition and transformation within a Hilbert space, demonstrating how these mathematical tools interact to process and analyze multidimensional data.
We will use a simple 1D array representing a sequence of quaternion values, and we will transform this array step-by-step, discussing the implications of each step. This step-by-step approach allows us to clearly see how the Haar wavelet transform operates on quaternion data, breaking it down into simpler components and then reconstructing it. Each transformation step involves mathematical operations that adhere to the properties of Hilbert space, ensuring orthogonality and completeness. By examining these operations in detail, we gain insights into the practical applications of Hilbert space and superposition in areas such as signal processing and data compression.
We start with a 1D array of quaternion values. Quaternions are hypercomplex numbers that consist of one real part and three imaginary parts, making them suitable for representing rotations in three-dimensional space. In our example, we define a sequence of quaternions, each initialized with specific values for its real and imaginary components. This setup provides a foundation for applying mathematical transformations, enabling us to explore the properties of quaternions within a Hilbert space framework.
Here’s the initial setup for our quaternions. By initializing a sequence of quaternions, we create a dataset that can be manipulated using the Haar wavelet transform - a quantum mechanical wave function operation which can be performed on radio waves, or memory arrays - with the same interferometric results. This process involves defining basic operations for quaternions, such as addition, subtraction, and multiplication, which are essential for performing wavelet transformations. These operations maintain the algebraic structure of quaternions, allowing us to explore their behavior under various transformations and understand how they interact within a Hilbert space.
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
class Quaternion:
def __init__(self, w=0, x=0, y=0, z=0):
self._w = w
self._x = x
self._y = y
self._z = z
@property
def w(self):
return self._w
@property
def x(self):
return self._x
@property
def y(self):
return self._y
@property
def z(self):
return self._z
@property
def i(self):
return self._x
@property
def j(self):
return self._y
@property
def k(self):
return self._z
def __add__(self, other):
return Quaternion(
self._w + other.w, self._x + other.x, self._y + other.y, self._z + other.z
)
def __sub__(self, other):
return Quaternion(
self._w - other.w, self._x - other.x, self._y - other.y, self._z - other.z
)
def __mul__(self, other):
if isinstance(other, Quaternion):
return Quaternion(
self._w * other.w
- self._x * other.x
- self._y * other.y
- self._z * other.z,
self._w * other.x
+ self._x * other.w
+ self._y * other.z
- self._z * other.y,
self._w * other.y
- self._x * other.z
+ self._y * other.w
+ self._z * other.x,
self._w * other.z
+ self._x * other.y
- self._y * other.x
+ self._z * other.w,
)
else:
return Quaternion(
self._w * other, self._x * other, self._y * other, self._z * other
)
def __truediv__(self, other):
if isinstance(other, Quaternion):
raise ValueError("Division of two quaternions is not defined")
else:
return Quaternion(
self._w / other, self._x / other, self._y / other, self._z / other
)
def __repr__(self):
return f"Quaternion({self._w}, {self._x}, {self._y}, {self._z})"
The Haar step function computes the sum and difference of adjacent quaternions, normalized by the square root of 2. This normalization ensures that the transformed quaternions maintain the properties of orthogonality and completeness, which are essential characteristics of a Hilbert space. By computing these sums and differences, we effectively decompose the original sequence of quaternions into simpler components, each representing a different aspect of the data's structure.
def haar_step(data):
output = np.zeros_like(data)
step_size = len(data) // 2
for i in range(step_size):
output[i] = (data[2 * i] + data[2 * i + 1]) / np.sqrt(2)
output[step_size + i] = (data[2 * i] - data[2 * i + 1]) / np.sqrt(2)
return output
The forward Haar wavelet transform recursively applies the Haar step function. This recursive application breaks down the quaternion sequence into progressively simpler components, each level of transformation reducing the data's complexity. The process continues until the data is fully transformed, resulting in a set of quaternions that capture the essential features of the original sequence. This transformation illustrates the concept of superposition, where each transformed quaternion is a linear combination of the original quaternions, providing a new perspective on the data's structure.
def haar_wavelet_transform(data):
transformed_data = data.copy()
n = data.shape[0]
while n > 1:
transformed_data[:n] = haar_step(transformed_data[:n])
n //= 2
return transformed_data
The inverse Haar step function reconstructs the original quaternions from the sum and difference components. This reconstruction process reverses the transformations applied by the forward Haar wavelet transform, combining the decomposed components to recover the original sequence. By applying the inverse Haar step function, we can verify the accuracy of the transformation process, ensuring that the original data is faithfully reconstructed from its transformed state.
def inverse_haar_step(data):
output = np.zeros_like(data)
step_size = len(data) // 2
for i in range(step_size):
output[2 * i] = (data[i] + data[step_size + i]) / np.sqrt(2)
output[2 * i + 1] = (data[i] - data[step_size + i]) / np.sqrt(2)
return output
The inverse Haar wavelet transform recursively applies the inverse Haar step function. This recursive process gradually rebuilds the original quaternion sequence, reversing the decomposition steps of the forward transform. The ability to reconstruct the original data from its transformed state demonstrates the effectiveness of the Haar wavelet transform in preserving the essential features of the data. It also highlights the role of Hilbert space in maintaining the orthogonality and completeness of the transformed quaternions, ensuring that the information encoded in the original sequence is not lost during the transformation process.
def inverse_haar_wavelet_transform(data):
transformed_data = data.copy()
n = 1
while n < len(data):
transformed_data[: 2 * n] = inverse_haar_step(transformed_data[: 2 * n])
n *= 2
return transformed_data
The original ndarray is a 4x4x3 array of random values, representing our initial dataset.
Original ndarray:
[[[0.17108749 0.74730157 0.81456496]
[0.11834511 0.756388 0.93561223]
[0.42528618 0.88812708 0.16246567]
[0.4141704 0.6431628 0.99499186]]
[[0.18059336 0.82656672 0.58886813]
[0.60559195 0.3516699 0.52432823]
[0.45565229 0.29531657 0.53838467]
[0.81144927 0.57049318 0.98462492]]
[[0.19894203 0.03719871 0.10699515]
[0.27061364 0.88215679 0.86336904]
[0.61354116 0.45418324 0.94085069]
[0.43742338 0.58786731 0.29469359]]
[[0.22126712 0.84089624 0.46772325]
[0.83539459 0.62923346 0.69464911]
[0.85477376 0.69008712 0.54765774]
[0.65941279 0.86337545 0.34413278]]]
The transformed image is obtained by applying the Haar wavelet transform to each row and column of the original ndarray, treated as sequences of quaternions.
Transformed Image:
[[[Quaternion(0.0, 1.8183861313213396, 0.0, 0.0)
Quaternion(0.0, 2.516006034644307, 0.0, 0.0)
Quaternion(0.0, 2.450978003618762, 0.0, 0.0)]
[Quaternion(0.0, -0.517468483591332, 0.0, 0.0)
Quaternion(0.0, 0.01969965879606793, 0.0, 0.0)
Quaternion(0.0, 0.04707704900467379, 0.0, 0.0)]
[Quaternion(0.0, -0.3740790382120023, 0.0, 0.0)
Quaternion(0.0, -0.059214851953658644, 0.0, 0.0)
Quaternion(0.0, -0.36762733214169596, 0.0, 0.0)]
[Quaternion(0.0, 0.009474367796654297, 0.0, 0.0)
Quaternion(0.0, -0.11921280769276808, 0.0, 0.0)
Quaternion(0.0, -0.15170423519826035, 0.0, 0.0)]]
[[Quaternion(0.0, -0.22729810570459097, 0.0, 0.0)
Quaternion(0.0, 0.02350687361981803, 0.0, 0.0)
Quaternion(0.0, 0.32094232834073183, 0.0, 0.0)]
[Quaternion(0.0, 0.001998368171893097, 0.0, 0.0)
Quaternion(0.0, 0.12271361804763803, 0.0, 0.0)
Quaternion(0.0, 0.04437616620475411, 0.0, 0.0)]
[Quaternion(0.0, 0.11085415049751966, 0.0, 0.0)
Quaternion(0.0, 0.38859254569546386, 0.0, 0.0)
Quaternion(0.0, 0.3276705894976036, 0.0, 0.0)]
[Quaternion(0.0, -0.25320077241423905, 0.0, 0.0)
Quaternion(0.0, 0.09784946013440182, 0.0, 0.0)
Quaternion(0.0, -0.7525201804504196, 0.0, 0.0)]]
[[Quaternion(0.0, -0.32682394266671977, 0.0, 0.0)
Quaternion(0.0, 0.3503477538880169, 0.0, 0.0)
Quaternion(0.0, 0.09596455546415991, 0.0, 0.0)]
[Quaternion(0.0, -0.024433277662273694, 0.0, 0.0)
Quaternion(0.0, -0.12021776401935595, 0.0, 0.0)
Quaternion(0.0, 0.35444889904905297, 0.0, 0.0)]
[Quaternion(0.0, 0.23887048491269802, 0.0, 0.0)
Quaternion(0.0, -0.24199162248440764, 0.0, 0.0)
Quaternion(0.0, -0.092793585343132, 0.0, 0.0)]
[Quaternion(0.0, 0.18345638179759688, 0.0, 0.0)
Quaternion(0.0, 0.2600704462713139, 0.0, 0.0)
Quaternion(0.0, -0.1931429683818973, 0.0, 0.0)]]
[[Quaternion(0.0, -0.3713470434057326, 0.0, 0.0)
Quaternion(0.0, -0.37553954362863307, 0.0, 0.0)
Quaternion(0.0, 0.0536501685947966, 0.0, 0.0)]
[Quaternion(0.0, -0.04379962076064145, 0.0, 0.0)
Quaternion(0.0, -0.01391663300630635, 0.0, 0.0)
Quaternion(0.0, -0.18942044793855056, 0.0, 0.0)]
[Quaternion(0.0, 0.27122792866066403, 0.0, 0.0)
Quaternion(0.0, -0.5283104323263585, 0.0, 0.0)
Quaternion(0.0, -0.2647240151735292, 0.0, 0.0)]
[Quaternion(0.0, -0.009621592452338509, 0.0, 0.0)
Quaternion(0.0, 0.019802133657957688, 0.0, 0.0)
Quaternion(0.0, 0.22131606800016781, 0.0, 0.0)]]]
The reduced quaternion is obtained by averaging the components of the quaternions in the original ndarray.
Reduced Quaternion:
Quaternion(0.0, 0.4545965328303351, 0.629001508661077, 0.6127445009046906)
The restored image is obtained by applying the inverse Haar wavelet transform to the transformed image. This process reconstructs the original data from the transformed state.
Restored Image:
[[[0.17108749 0.74730157 0.81456496]
[0.11834511 0.756388 0.93561223]
[0.42528618 0.88812708 0.16246567]
[0.4141704 0.6431628 0.99499186]]
[[0.18059336 0.82656672 0.58886813]
[0.60559195 0.3516699 0.52432823]
[0.45565229 0.29531657 0.53838467]
[0.81144927 0.57049318 0.98462492]]
[[0.19894203 0.03719871 0.10699515]
[0.27061364 0.88215679 0.86336904]
[0.61354116 0.45418324 0.94085069]
[0.43742338 0.58786731 0.29469359]]
[[0.22126712 0.84089624 0.46772325]
[0.83539459 0.62923346 0.69464911]
[0.85477376 0.69008712 0.54765774]
[0.65941279 0.86337545 0.34413278]]]
The reconstructed ndarray is created by filling the original array dimensions with the components of the reduced quaternion.
Reconstructed ndarray:
[[[0.45459653 0.62900151 0.6127445 ]
[0.45459653 0.62900151 0.6127445 ]
[0.45459653 0.62900151 0.6127445 ]
[0.45459653 0.62900151 0.6127445 ]]
[[0.45459653 0.62900151 0.6127445 ]
[0.45459653 0.629
00151 0.6127445 ]
[0.45459653 0.62900151 0.6127445 ]
[0.45459653 0.62900151 0.6127445 ]]
[[0.45459653 0.62900151 0.6127445 ]
[0.45459653 0.62900151 0.6127445 ]
[0.45459653 0.62900151 0.6127445 ]
[0.45459653 0.62900151 0.6127445 ]]
[[0.45459653 0.62900151 0.6127445 ]
[0.45459653 0.62900151 0.6127445 ]
[0.45459653 0.62900151 0.6127445 ]
[0.45459653 0.62900151 0.6127445 ]]]
By transforming quaternions using the Haar wavelet transform, we effectively create and manipulate superpositions in a Hilbert space. The non-commutative nature of quaternion algebra allows us to perform complex transformations and operations that preserve more structural information compared to traditional linear methods. This approach provides a robust framework for advanced signal processing, particularly in applications involving rotations and orientations in 3D space.
- Fashandi, M. (2018). Quaternionic continuous wavelet transform on a quaternionic Hilbert space. Revista de la Real Academia de Ciencias Exactas, Físicas y Naturales. Serie A. Matemáticas, 112, 1049-1057. https://doi.org/10.1007/S13398-017-0409-4
- Hemmat, A. A., Thirulogasanthar, K., & Krzyżak, A. (2016). Discretization of quaternionic continuous wavelet transforms. Journal of Geometry and Physics, 117, 36-49. https://doi.org/10.1016/j.geomphys.2017.02.013
- Hemmat, A. A., Thirulogasanthar, K., & Krzyżak, A. (2017). Discretization of quaternionic continuous wavelet transforms. Journal of Geometry and Physics, 117, 36-49. https://doi.org/10.1016/J.GEOMPHYS.2017.02.013
- Ali, S. T., & Thirulogasanthar, K. (2014). The Quaternionic Affine Group and Related Continuous Wavelet Transforms on Complex and Quaternionic Hilbert Spaces. arXiv: Mathematical Physics. https://doi.org/10.1063/1.4881716
- Schwartz, C. (2007). Relativistic Quaternionic Wave Equation II. Journal of Mathematical Physics, 48, 052303-052303. https://doi.org/10.1063/1.2735441
- Zhao, J., & Peng, L. (2007). Quaternion-valued admissible wavelets and orthogonal decomposition of L2(IG(2), ℍ). Frontiers of Mathematics in China, 2, 491-499. https://doi.org/10.1007/s11464-007-0030-5