Composer Video-tutorial

Learning goals:

  1. Set up a Spatial Dimension, and connect it to a plot (Spatial Dimension, Position Plot)
  2. Make a Comment and save/load your scene (Comment, scene save / load)
  3. Create an analytic wave function and plot it with a potential (Analytic Wave Function, Potential)
  4. Calculate and compare the numerical ground state wave function with the analytic expression (Hamiltonian, Hamiltonian Operator, Spectrum, Linear Combination, State Comparison Plot, Overlap)
  5. Calculate <$x$>, $\sigma_x$, $\sigma_x^2$ (Position Operator, Expectation Value, Standard Deviation, Variance)
  6. Parameterise $x_0$  (Scalar Input)

VO 0:

Hello and welcome to this Composer tutorial.

In this video we will explore the basic functionality of the Composer application.


VO 1:

To get started, right click anywhere on the canvas to bring up the node catalogue.

To create a node, simply click an item in the catalogue.

You can also search for specific nodes by typing in the 'Filter' text field.

Now we have created a Spatial Dimension node and a Position Plot node.

The Spatial Dimension node is fundamental to Composer, and the Position Plot node is a great visualisation tool.

A node can have inputs, outputs, and contextual options.

Inputs are located on the left side of the node and Outputs are located on the right side of the node.

Contextual options are shown within the node itself.

For now, let us turn off some options in the Position Plot node.

Some nodes has only Outputs, such as the Spatial Dimension node, and some nodes has only Inputs, such as the Position Plot node.

To connect two nodes, click and drag the Output from the Sender node to a valid Input of the Receiving node.

Notice how we can change the $x$-axis of the Position Plot node by connecting a Spatial Dimension.

A connection can only be established if the Input and Output is of the same type.

When two nodes are connected, changes made in the Sender node is automatically propagated through the relevant connections.

You can click and drag nodes around the canvas. This is does not break connections between nodes.


Vo 2:

The Comment node can be useful if you want to share your work.

Nodes can be resized by dragging the bottom right corner.

To save the current scene, press the 'Save' button and give it a name.

To load a scene, press the 'Load' button and navigate to the scene you want to open.

Note that the current scene is discarded when the 'Load' button is pressed. Be sure you do not lose any unsaved changes!!


VO 3:

To create a an analytic wave function node, bring up the node catalogue and click it.

Note how the node contains a red area with the text: "Missing inputs: x; Bad Expression!;"

The red area indicates an error, and the text explains what the error is.

When a node is in an error state, it will not propagate new information through its Output connections

To fix the "Missing input" error, connect the Spatial Dimension node to the wave function node.

The text field is an expression parser where you can write a mathematical expression for the wave function.

Suppose we want to create the ground state for a particle of unit mass in a harmonic oscillator with unit $\omega$.

The expression is then simply $\exp(-x^2/2)$. Note how the $x$ is supplied by the Spatial Dimension!

Press 'Enter' or de-select the text field to update the node.

Note how the error area has now turned into a warning area.

When a node is an warning state it can still propagate new information through its Output connections.

We will ignore the warnings for now.

To plot the wave function, drag the Output into the appropriate Input on the Position Plot node.

Note how the wave function was automatically normalised on the range defined by the Spatial Dimension.

We can also plot the real and imaginary part of $\psi$.

We can also change the phase of the wave function.

Finally let us also create and plot the Potential.

Create a Potential node, connect the Spatial Dimension, fill in the expression, and connect it to the Position Plot.


VO 4:

We have seen how to create the analytical ground state of the harmonic oscillator.

Now we want to numerically calculate the eigenstates of the harmonic oscillator.

In other words we want to diagonalise the Hamiltonian operator, ie. finding its Spectrum.

First we create a Hamiltonian node and connect the Potential.

Connecting the Spatial Dimension is required to calculate the kinetic energy $T$. This is done under the hood.

We then create a Hamiltonian Operator node and attach the Hamiltonian.

Finally create a Spectrum node and attach the Hamiltonian Operator.

The reason for the intermediate Hamiltonian Operator node is simply to convert the Hamiltonian to the appropriate Operator type expected by the Spectrum node.

The Spectrum node Outputs the first $n+1$ Eigenstates and Eigenvalues in lists where "n" is the number of excited states to be calculated. The ground state is always calculated.

We can extract the ground state from the list by creating a Linear Combination node.

This node lets you create linear combinations $\sum_i^n c_i \psi_i$ of the input list by specifying the complex weight coefficients.

First let us create a linear combination of the ground state and the first excited state with equal weight and plot it.

This node can also auto-normalise the wave function. You can also explicitly normalise the coefficients by clicking "Normalize coeff.".

Clicking the "Reset coeff." is a shortcut to the first state in the list.

Let us now compare the analytical ground state to the numerical ground state.

For this we can create a State Comparison Plot and attach both wave functions. The two wave functions are exactly overlapping!

We can also calculate the inner product of the wave functions by creating an Overlap node and attaching the wave functions. The Overlap node confirms that the wave functions are exactly the same.

To check that the ground state and the first excited state are orthogonal, simply set $c_0=0$ and $c_1=1$. The Overlap is now vanishingly small.



It is easy to calculate the expectation value, standard deviation, and variance of an operator with respect to any state.

Simply create the corresponding nodes and connect a wave function and an operator.

In this example we calculate these quantities for the $x$ operator.

Create an x Operator node, connect the Spatial Dimension, and connect the x Operator node to the three nodes of interest.

The Position Plot can also show the  $\pm \sigma_x$.



Until now we have looked at a harmonic potential centred on $0$

Suppose now we that we want to examine the case where oscillator potential is offset by $x_0$

This would require us to go through each node where $x_0$ should be and make the according changes manually.

To make this process a lot easier, we can parameterise the $x_0$ value in a Scalar Input node.

Then, we can attach the Scalar Input where needed as optional input.

In fact, the warnings raised by the potential and the wave function tells us that the optional inputs are not connected.

When the Scalar Input is connected, the ingoing value is stored in the variable "a" and can be used in the expression.

Note that the warning for the optional input "a" has now disappeared.

If we had used the bottom most input, the value would have been stored in the variable "b" instead