# What is the right way to calculate <A><A>?

How should we calculate $$\langle A\rangle \langle A\rangle$$ from data on dipole moments? It is a term in an equation for calculating something else. Some example data:

x      y      z         Total
26.78  -6.31  27.17     38.67
26.80  -5.79  27.33     38.72
26.75  -5.28  27.415    38.67
26.63  -4.79  27.41     38.52
26.45  -4.34  27.36     38.31


The <> symbol means "average." On each row, Total is the square root of the sum of squares of the x, y and z. Each row is a new time.

It is part of an expression to calculate variance $$\big(\langle A \cdot A\rangle - \langle A\rangle \langle A\rangle\big)$$. We are confused because someone has suggested that np.var(Total) from Python or a corresponding function from Matlab are not the way to calculate it because they eliminate any negative signs on component values and make $$\langle A\rangle \langle A\rangle$$ too large.

Is this true? Should we use np.mean(x)**2+np.mean(y)**2+np.mean(z)**2 for $$\langle A\rangle \langle A\rangle$$ instead?

• Let's continue this conversation in chat. May 10 at 18:38

The dipole moment is typically a vector quantity, and the "total dipole moment" which is the $$A$$ in your question description and the black arrow in the figure below, is the vector sum of all constituent dipole moments the system (red arrows in the figure below):

In your case you have vectors such as: $$26.78 \, \hat{x} -6.31\, \hat{y} + 27.17\, \hat{z}$$, which ought to represent the black arrow in the above figure.

To get the length of the black arrow, you would calculate:

$$\tag{1} A = \sqrt{x^2 + y^2 + z^2},$$

in which the $$x,y$$ and $$z$$ values correspond exactly to the x, y, and z columns in your table (I've confirmed that you have calculated at least the first one correctly).

Next you want the time-averaged value of $$A$$, which is denoted by $$\langle A \rangle$$. Since each row in your table represents one point in time, you would simply add the values in each column and divide the totals by the number of time steps for which you have data.

I did this in Octave online since it's the fastest way for me to do the calculation, and doesn't require importing NymPy or typing extra np. characters but you can easily do it in Python too:

mean([38.67 38.72 38.67 38.52 38.31])
ans = 38.578


Therefore we have $$\langle A \rangle = 38.578$$ and $$\langle A \rangle \langle A \rangle \equiv \langle A \rangle ^2 = 38.578^2 = 1488$$.

Notice that $$\langle A \rangle ^2$$ is not the same as $$\langle A^2 \rangle$$, as explained here for the specific case of dipole moments.

• thank you for your help, that is a very clear explanation. Using Total sounds right and I don't know why it would not be or why using the components would be a better method. I'll leave the question open for a little longer in case anyone else sees something I have not.
– Ant
May 12 at 10:34
• thought about it a little more. I am confident you're right. Thank you very much.
– Ant
May 12 at 11:43