Saturday, May 25, 2024

StandingWaves

 Moving on today to Sharma lessons 4 and 5 on elements of Quantum Computing.

Standing waves, such as microwaves, are used to drive qubits!!

https://upload.wikimedia.org/wikipedia/commons/e/e0/StationaryStatesAnimation.gif

Three wavefunction solutions to the Time-Dependent Schrödinger equation for a harmonic oscillator. Left: The real part (blue) and imaginary part (red) of the wavefunction. Right: The probability of finding the particle at a certain position. The top two rows are the lowest two energy eigenstates, and the bottom is the superposition state , which is not an energy eigenstate. The right column illustrates why energy eigenstates are also called "stationary states".

Standing waves do not move in space; they just oscillate.

source: Wikipedia

                                                                    *     *     *

I was asked about what the Hamiltonian is in the Schrodinger equation. The term

Hamiltonian is an analogy to what it is in Hamltonian mechanics. Below:

The Hamiltonian in Quantum Mechanics (gsu.edu)

From the Russian-language Wikipedia:


                                                          *     *     *

For those doing Sharma 4; qiskit has been recently updated and minor

changes need to be made to access Aer simulator.

The old code:            

                                                                              ...


The new code:

                                           


    

                   

From Sharma lesson 5:


The old code:

                                                       
The new code:
                                                                            

Got help from Gemini with this code...

Friday, May 24, 2024

Eigen_calcs

 It is still impossible for me to call Bing/Chat from the sidebar on the Edge

browser but I can access things by asking for Copilot.


Below, copilot is re-doing the Math is Fun example on eigenvalue and eigenvector.

                                                



There is python code to do this same calculation:



                                                                              




*     *     *

The last viewed possibility is the tensor product, which involves multiplying

to matrices, not necessarily of the same dimensions. 

The tensor product multiplies the second matrix by every element of the first matrix

                                                                                     





  • In quantum mechanics, the tensor product represents the combined state of two quantum systems. For example, the state of a composite system consisting of two particles is described by their tensor product state.
  • In quantum computing, tensor products are essential for representing quantum gates and quantum circuits. Quantum gates act on tensor products of qubits to perform quantum operations

Thursday, May 23, 2024

Perplexed

 Finished Sharma lesson 3, with the help of Meta ai. Below

Inner Product:

                                         


                                                                                    

Normalized vector:

                                                                         

Outer Product:

                                                                      



Requirements:

                                                                   

*     *    *
I did get curious about how using the conjugate values of the second vector

makes the Inner Product commutative. It does mathematically, but why do I

need this feature. So far, it has to do with the fact that quantum physics vectors are not

in 3-d space but in a Hilbert space (ie possibly infinite). So a whole system of 

measurement needs to be built around this feature...


Danger

 On the Ukraine conflict, can't help but being struck with flashing 

lights indicating danger. We seem to be reaching a critical mass of 

intention signaling that spells disaster: Russia starting tactical

nuclear arms exercises ont the Ukraine border, the West arguing

for troop 'presence' from NATO countries.


Last time Russia signalled - by amassing troops on the Ukraine border - 

it wasn't a signal at all, but the real thing: they invaded. As for the West,

they all jumped in like lemmings, on the other side of that 'war', with the

rhetoric to match. Russia cannot be allowed to 'win'.


In a fundamental sense, there's a lot of blabber on both sides. Russia argues

from history, nostalgic for greater territory. The West knows better, territory

is not the game but access is. The West stands on moral invincibiity: 'We have always

won, we will again, rationality if not God is on our side" . Russia, in turn, calls the

West mindless and intransigent, not open to consider so much as the plight of

Russian speaking populations within Ukraine, an obvious linguistic minority...


Let us at least make a little progress on signaling. Western countries can speak

outside of their roles as NATO members, showing a preference for what a solution

might look like. We like to pontificate that we are the adults in the room; let's

give them a does of sanity.  Let Russia react to THAT!!


                                              *     *     *

         


Wednesday, May 22, 2024

Linear A

 Worked through the major part of the Matrices lesson. The standard

definition of operations on matrices, and those on complex numbers

are not identical in all respects.

Determinant:

Transpose:

Cofactors:


Adjoint:


Inverse:



                                                                         *   *   *
Copilot checking that a matrix with complex numbers is Hermitian ie it is equal to its

own adjoint.
                                                                           
Copilot checking if a matrix is unitary:

                                                                              

                                                                                      

                                                      *     *     *
Having worked through section 1 of the linear algebre, I managed to

code a unicity test for myself:

                                                               

The conjugate transpose is also noted A†

                                                *     *     *
Another important matrix for quantum Computing is the Hermitian matrix.

                                                        








Tuesday, May 21, 2024

Indentation

 Python can be picky about  not just correct indentation, but how

it is done ie with tabs vs one space at a time with arrows or spacebar. 

I asked ChatGPT to explain the issue:

Sure, I can explain that! In Python, indentation is crucial because it denotes the structure of the code. It's used to indicate blocks of code like loops, conditionals, and function definitions.


When you say "aligns with backspace or arrows," I assume you're referring to how you indent your code, either by pressing the spacebar or using the tab key. Python allows both spaces and tabs for indentation, but mixing them can cause issues. 


The problem arises when you use a mixture of spaces and tabs for indentation within the same file or block of code. Python expects consistency in indentation style. If you use spaces for one indentation level and tabs for another, Python might interpret them differently, leading to indentation errors.


For example, consider the following code:


```python

def example_function():

    if True:

        print("Indented with spaces")

    else:

        print("Indented with tabs")

```


This code uses spaces for indentation. If you mix spaces and tabs like this:


```python

def example_function():

    if True:

→       print("Indented with spaces")

    else:

→       print("Indented with tabs")

```


The arrow symbol (→) represents a tab. This mix of spaces and tabs can lead to indentation errors because Python treats tabs and spaces differently, and it's not always easy to see the difference in your text editor.


To avoid this issue, it's best to pick one indentation style (either spaces or tabs) and stick with it consistently throughout your codebase. Most Python style guides recommend using spaces for indentation, typically four spaces per level. This choice ensures consistent behavior across different editors and environments. Many text editors can be configured to automatically convert tabs to spaces to help maintain consistency.

I tested this for myself. The first block of code uses spaces only, the second a mix:

                                                                        

I redid the spacing using spaces only:

                                                                    




Continuation

 I'm a bit apprehensive about this next QC lesson from the Sharma series:

it is a romp through Linear Algebra, which can get a .ittle mind-bending.

I do know how to work with vectors nad matrices, but eigenvalues will be

new for me.


On the plus side, the subsequent two lessons I already have some experience 

with from doing the first few  IBM qiskit tutorial. Just clearing things up for me.

The one possible probem is updating the code to reflect changes since thelessons

were put together. But then, that is the purpose of the whole exercise for me; using

python easily as I explore QC.


Onward!!