Wednesday, October 16, 2024

Experiment

 Ran a litle experiment, with a Unitary operator to which I imparted a roation of 1.2 rads 

around the y-axis(Bloch Sphere). I then ran qiskit's phase estimation function to see if

I could retrieve that value. Below (code from Meta, analysis form Perplexity):

                                                                               




So I am hiting it with my Unitary at 1.2 on pi, and my estimate at 2.3706... rads

on 2pi.

Need to work through the precision issue next...

                                                        *     *     *
From Meta:

Order finding and phase estimation are two closely related but distinct quantum algorithms used in quantum computing.
Order Finding:
Order finding is a problem where you're given a function f(x) that periodic with period r, i.e., f(x) = f(x+r), and you want to find the period r. Mathematically, this can be represented as:
f(x) = f(x+r) for all x
The goal is to find the smallest positive integer r such that the above equation holds.
In the context of Shor's algorithm, order finding is used to factorize large numbers. Specifically, given a number N, you want to find the order r of a random number a modulo N, which satisfies:
a^r ≡ 1 (mod N)
Phase Estimation:
Phase estimation is a more general problem where you're given a unitary operator U and a state |ψsuch that:
U|ψ= e^(iφ)|ψ
Here, φ is an eigenvalue (or phase) associated with the eigenstate |ψ. The goal is to estimate the phase φ with high precision.
In other words, phase estimation aims to find the eigenvalue φ of the unitary operator U, which can be represented as:
U = e^(iφ)
Key differences:
  1. Problem statement: Order finding focuses on finding the period of a periodic function, whereas phase estimation aims to estimate the eigenvalue (phase) of a unitary operator.
  2. Mathematical structure: Order finding deals with periodic functions and modular arithmetic, whereas phase estimation involves linear algebra and eigenvalue decomposition.
  3. Quantum implementation: Order finding typically uses the Quantum Fourier Transform (QFT), while phase estimation employs the Quantum Phase Estimation (QPE) algorithm, which relies on the QFT and additional control logic.
  4. Precision: Phase estimation aims to provide a high-precision estimate of the phase φ, whereas order finding typically seeks to find the exact period r.
Relationship between Order Finding and Phase Estimation:
Order finding can be reduced to phase estimation. Specifically, given an order-finding problem, you can construct a unitary operator U such that:
U|x= |x+a (mod r)
where |xis a computational basis state and a is the number whose order you want to find.
By applying phase estimation to this unitary operator, you can estimate the phase φ, which corresponds to the order r. This connection allows you to use phase estimation algorithms to solve order-finding problems.
In summary, while order finding and phase estimation are distinct problems, they are intimately connected. Phase estimation provides a more general framework that encompasses order finding as a special case.

*     *     *
Part of my discussion with Perplexity, when the code had fewer qubits and shots:

What are my results telling me? {'100': 431, '111': 409, '101': 12, '011': 21, '000': 102, '110': 15, '010': 26, '001': 8}
Answer
Great question! Let's interpret these results from your Quantum Phase Estimation (QPE) experiment.The output you've received is a dictionary where:
  • The keys are binary strings representing the measured states of the estimation qubits.
  • The values are the number of times each state was measured out of 1024 total shots.
To interpret this:
  1. Binary to Decimal Conversion:
    Each binary string represents a fraction of 2π. To convert, divide the decimal equivalent by 2^3 (as you used 3 qubits for estimation).
    • '100' = 4/8 = 0.5
    • '111' = 7/8 = 0.875
    • '101' = 5/8 = 0.625
    • '011' = 3/8 = 0.375
    • '000' = 0/8 = 0
    • '110' = 6/8 = 0.75
    • '010' = 2/8 = 0.25
    • '001' = 1/8 = 0.125
  2. Analyzing Frequencies:
    The two most frequent outcomes are:
    • '100' (431 times): represents 0.5 * 2π = π
    • '111' (409 times): represents 0.875 * 2π = 1.75π
  3. Interpreting the Phase:
    The high frequency of these two outcomes suggests that the true phase is likely between π and 1.75π.
  4. Precision and Uncertainty:
    The spread of results across different bit strings indicates some uncertainty in the estimation, which is normal due to the probabilistic nature of quantum measurements and the limited number of estimation qubits.
  5. Relation to Input:
    You applied an Ry(1.2) rotation in your unitary. The phase of this rotation is approximately 0.6π, which falls within the range suggested by your most frequent outcomes.
Conclusion:
Your results are indicating that the phase of your unitary operation is most likely between π and 1.75π, with a strong suggestion towards π (represented by '100'). This is consistent with the Ry(1.2) rotation you applied, though the estimation isn't perfect due to the limited number of qubits and shots used in the estimation process.To improve precision, you could:
  1. Increase the number of estimation qubits
  2. Increase the number of shots
  3. Use post-processing techniques to refine the estimate
Remember, QPE provides an approximation, and the accuracy improves with more qubits and measurements.
   



No comments: