Monday, September 30, 2024

Transform_1

 Before looking at the Quantum Fourier Transform, decided to get clear about the Fourier 

Transform within mathematics. It's a complicated matter. Did pick up a few interesting things 

on Day 1 of this problem.


Microsoft Word - Fourier Analysis Notes.doc (stanford.edu)                          

                                                  *      *      *

COPILOT

Fourier analysis; how can a non periodic function exhibit frequency?


Great question! Fourier analysis can indeed be applied to non-periodic functions to analyze their frequency components. This is done using the Fourier transform, which is a more general tool compared to the Fourier series.

Here’s a simplified explanation:

Fourier Series vs. Fourier Transform:

Fourier Series is used for periodic functions and represents them as a sum of sine and cosine functions with discrete frequencies.

Fourier Transform extends this concept to non-periodic functions, transforming them into a continuous spectrum of frequencies.

Frequency Representation:

Even if a function is not periodic, it can still be decomposed into a sum of sine and cosine functions with different frequencies. The Fourier transform provides a way to represent any function in terms of its frequency components.

Mathematical Insight:

For a non-periodic function ( f(t) ), the Fourier transform ( F(\omega) ) is given by:F(ω)=∫−∞∞​f(t)e−iωtdt

This integral transforms the time-domain function ( f(t) ) into a frequency-domain function ( F(\omega) ), where ( \omega ) represents the angular frequency.

Practical Applications:

This approach is widely used in signal processing, physics, and engineering to analyze the frequency content of signals that do not repeat over time1

By using the Fourier transform, we can understand and analyze the frequency characteristics of non-periodic functions, which is crucial for various scientific and engineering applications.

Does this help clarify things? Feel free to ask if you have more questions!


Fourier analysis; what is the difference between frequency and period?

In the context of Fourier analysis and waveforms, frequency and period are two fundamental concepts that are closely related but distinct:

  • Frequency refers to the number of complete cycles of a waveform that occur in one second. It is measured in Hertz (Hz). For example, if a wave completes 5 cycles in one second, its frequency is 5 Hz.

  • Period is the duration of time it takes for one complete cycle of the waveform to occur. It is measured in seconds (s). For instance, if one cycle of a wave takes 0.2 seconds, the period is 0.2 s.

The relationship between frequency ((f)) and period ((T)) is given by the formula:

This means that frequency is the reciprocal of the period and vice versa12

In simpler terms, if the frequency of a wave increases, the period decreases, and if the frequency decreases, the period increases. This inverse relationship is crucial in understanding wave behavior in Fourier analysis.

Does this help clarify the difference for you? If you have more questions about Fourier analysis or anything else, feel free to ask!

                                                                   *      *     *

Also discovered how-to create an orthonormal basis between any two vectors. Neat!!

ChatGpt:

                                                                  




                                                                               




           

                                                                                 




Sunday, September 29, 2024

More_Fun

 Below, code to look at Phase Estimation. One is even free to change the number of qubits used...

                                                                      



How it works:

The example code, with 3 control qubits, comes in at .75. I can reduce the number of qubits

to 2 and still get this result. If I increase the number if qubits to 4, I will do well to increase

the number of trials as well. At 4, then, my estimate goes to .6875.

As the number of qubits - and trials - grows, the program looks for the mode of the 

most_probable set. The odds may  be around 40% but they are the best of the lot, and the

'mode' zeroes in on the value we are looking for.

                                                              3 control qubits:




Not to get too carried away, the expected load on current quantum machines is between

5 and 20 qubits, and up to 20000 runs!!


Ended up with a problem when there is a single output case (index 0). Below,

for theta .5:

                                                         







Saturday, September 28, 2024

Game of Numbers

 Clearly, the results of the Phase Estimation procedure are dictated by the play

of numbers under different constraints.

Fro theta at .9:

                                                                   



For theta at .3:

                                                                                



If I ask for theta at .75, I get:
*     *     *


Applying the transformation twice ups the frequency:


Twice and with another qubit:


The general Phase Estimation procedure uses as many qubits and repeats as necessary

for the precision required. With an eye to computational costs...








Friday, September 27, 2024

Run-Through

 From Meta:

Qiskit 1.2, Phase Estimation; what does the value for theta - between 0 and 1 - represent?

https://meta.ai/s/DaTdepPbkVNL6XNB/

What is the purpose of controlled-U operations?

https://meta.ai/s/VNzHE4AuRrGWmY91/

Qiskit Code from IBMLearn, showing the procedure for theta=.7:





With theta set to .7, I.m getting 901 counts out of 1024 for 11. What does this mean?

In the context of Quantum Phase Estimation (QPE), the output (11, 901/1024) provides valuable information:
Interpretation:
11: This is the estimated value of the phase θ, represented as a binary fraction.
901/1024: This is the probability (or confidence) of measuring the estimated value 11.
Binary fraction to decimal conversion:
To interpret the estimated phase θ, convert the binary fraction 11 to a decimal:
11 (binary) = 3/4 = 0.75 (decimal)
Comparison to actual θ:
You set θ = 0.7. The estimated value 0.75 is close to the actual value.
Accuracy and precision:
The difference between estimated (0.75) and actual (0.7) θ values indicates an error of ≈ 0.05 (or 7%).
The high probability (901/1024 ≈ 88%) suggests that the estimation is reliable.
Implications:
This result demonstrates the Quantum Phase Estimation algorithm's ability to accurately estimate the phase θ:
The estimated value is close to the actual value.
The probability indicates a high confidence in the estimation.
Factors influencing accuracy:
Keep in mind that:
Number of qubits
Number of controlled-U operations
Measurement noise
Algorithmic limitations
can affect the accuracy of the estimation.
Would you like to explore ways to improve accuracy or discuss other QPE aspects?


Qiskit phase estimation keeps the values of the jumps on the unit circle to x*pi/4...


Perp_continued

                                                                                   



https://www.perplexity.ai/search/what-code-would-you-suggest-to-CWt94PG0Qq.UPZi5dQLHBg#0


                                                                              








Thursday, September 26, 2024

Measurement

 

Was curious why running my circuit form Quantum composer was getting different results
then running the circuit from python code. Below:
You
Qiskit 1.2; if I put together a 3 qubit circuit, and run the mesaure_all() command, how is that different 

from measuring each qubit individually?


Copilot

When you use the measure_all() command in a 3-qubit circuit, it measures all qubits simultaneously and collapses the entire quantum state into a classical state. This means you get a single outcome that represents the state of all three qubits at the moment of measurement.

On the other hand, measuring each qubit individually involves measuring one qubit at a time. This can affect the overall quantum state differently because each measurement collapses the state of the measured qubit, potentially altering the state of the remaining qubits due to quantum entanglement or superposition12.

In summary:

  • measure_all(): Measures all qubits at once, collapsing the entire state.
  • Individual measurements: Measures qubits one by one, potentially altering the state of the remaining qubits with each measurement.

Does that help clarify things? Feel free to ask if you have more questions about quantum circuits!

                                                        *     *     *

So there we have it; the code being generated from my circuit on Composer was asking

for individual measurements, whereas the one from standard code was using measure_all().

On individual measurements, everything collapsed to zero...


This might be a why the QFTinverse is so useful in the Phase Eastimation Protocol!!

                                                         *     *     *

Meta produced a very useful piece of code for me, yesterday. It is something of a game,

where one can change the basis on which one wants one's circuits to be measured.(This is

for use starting from a fourier state, but one can disactivate that particular aspect!!)


                                                                     



                                                                          




*     *     *
Below, measurement in the Z_basis with Perplexity:

                                                                 





                                                                         *     *     *

Measurement in the X-basis with Perplexity:

                                                                       




https://www.perplexity.ai/search/qiskit-1-2-what-code-would-you-4a71LaRsTY6_dBDZOmoqig#5
















                                                                                   






 

Wednesday, September 25, 2024

BinaryDs

 Express 0.679 as a binary decimal

To express the decimal 0.679 as a binary decimal, we can use the method of multiplying by 2 and extracting the integer part.


1. **Multiply by 2:**  

   \( 0.679 \times 2 = 1.358 \)  

   Integer part: **1**


2. **Take the fractional part (0.358) and multiply by 2:**  

   \( 0.358 \times 2 = 0.716 \)  

   Integer part: **0**


3. **Take the fractional part (0.716) and multiply by 2:**  

   \( 0.716 \times 2 = 1.432 \)  

   Integer part: **1**


4. **Take the fractional part (0.432) and multiply by 2:**  

   \( 0.432 \times 2 = 0.864 \)  

   Integer part: **0**


5. **Take the fractional part (0.864) and multiply by 2:**  

   \( 0.864 \times 2 = 1.728 \)  

   Integer part: **1**


6. **Take the fractional part (0.728) and multiply by 2:**  

   \( 0.728 \times 2 = 1.456 \)  

   Integer part: **1**


7. **Take the fractional part (0.456) and multiply by 2:**  

   \( 0.456 \times 2 = 0.912 \)  

   Integer part: **0**


8. **Take the fractional part (0.912) and multiply by 2:**  

   \( 0.912 \times 2 = 1.824 \)  

   Integer part: **1**


9. **Take the fractional part (0.824) and multiply by 2:**  

   \( 0.824 \times 2 = 1.648 \)  

   Integer part: **1**


10. **Take the fractional part (0.648) and multiply by 2:**  

   \( 0.648 \times 2 = 1.296 \)  

   Integer part: **1**


11. **Take the fractional part (0.296) and multiply by 2:**  

   \( 0.296 \times 2 = 0.592 \)  

   Integer part: **0**


12. **Finally, \( 0.592 \times 2 = 1.184 \)**  

   Integer part: **1**


Gathering the integer parts from each step gives us the binary representation:


**0.679 (decimal) ≈ 0.1010111101 (binary) rounding after 10 bits.**


In summary, the binary decimal approximation of 0.679 is approximately **0.1010111101**. 

Chatty

 The results from running my (Perplexity) circuit were in this morning, but not

at all what I expected. Below, from the IBM site. 

                                                                          




                                                                                      

All clocking in at 0. Which tells me I might do better running this on a more optimized

circuit. So I amrunning it again on qiskit code, which should come in this afternoon...

                                                    *     *     *

Found a resource on the web which is helpful to me. Sometimes it is the simplest

assumptions underlying an explanation that trips one up. So phase estimation is not 

probabilistic. Phase itself (θ) is defined between zero and 1 on 2 pi,

with 1 as a limiting term which one never actually reaches. So it is an estimation in the

sense that one's decimal approach gets ever more precise, as one adds qubits. We are

dealing with decimal qubits, so that .11 is .75 as a base 10 decimal!!



 https://www.ryanlarose.com/uploads/1/1/5/8/115879647/quic03-phase-estimation.pdf

                                                                 *     *     *       


https://sl.bing.net/bmxTJ5eWLoO


https://sl.bing.net/iuPdUA9zHSm

                                                              *     *     *

Wasn't getting anything from QuantumComposer (zeros for eac of the three qubits) so

ran one last time, this time with the circuit as code. The result: