# Tag Info

## New answers tagged python

0

I think that you can use convolve() from scipy.signal. As mentioned in a previous question, you can take advantage that the Fourier Transform of a convolution represents a product.

2

If you are familiar with einsum, maybe this explanation does it: axes[0] and axes[1] specify the locations of the repeated letters in the parameters of einsum. For instance, np.tensordot(a, b, axes=[(0,2),(3,1)]) corresponds to np.einsum('ijkl,mkni', a, b) Indeed, 'ijkl'[(0,2)] == 'ik' == 'mkni'[(3,1)], and all the other letters are distinct.

4

Very interesting question! LAPACK-inspired adaptive strategy This reminds me of a bug that was found in a LAPACK routine (rank-revealing QR) related to 'downdating' norms: essentially, you are given the norm of a vector v, and you want to compute at each iteration in O(1) the norm of the same vector after chopping off its initial entry: v[1:], v[2:], ... (...

1

There are few issues in your code. The main one is that, in the P(x) function, return np.exp(-(beta*E(x))) should be return np.exp(-(beta*x)). Then you should increase the maxdr value. I reckon a value of 0.01 should be enough. These two changes are enough to get a plot that looks realistic. A couple of additional points: In general, attempting to move ...

0

As far as I can see, you are not applying any bias to your simulation. The only place where the bias Q comes into play is in the calcEnergy method, which is never called by your code. In general, the bias need to be used in the actual MC code when you compute the acceptance probability of your move.

7

Your lattice consists of 5 x 5 x 5 = 125 spins, so your number of Montecarlo steps to reach equilibrium should be >> 125, because you randomly picking a site and flipping it, so random numbers should uniformly generated so that it will cover whole lattice. For much finer measurement of thermodynamic quantities, you should take more number of points between ...

5

I sincerely thank @Daniel Shapero for directing me towards this answer. Discontinuity in the specific heat or susceptibility curves to be visible significantly, you should take much more finer measurements for large number of sweeps, say, I ran the simulation for 1024 steps for system to reach equilibrium 1024 steps for sparse averaging/to measure specific ...

1

I think your approach is very good. Several studies show that doing something stays deeper in memory than reading about it and testing things for yourself will give you a good intuitive feeling. Now, to your questions: Is MATLAB capable of all this? Yes, it has strong numerical and GUI capabilities If not, what is? As mentioned by Abdullah Ali Sivas, you ...

1

You are trying to solve this matrix ODE system as: $$A \mathbf{x}^{'}(r) = -B \mathbf{x}(r)$$ where: $\mathbf{x}^{'}(r) = \frac{d \mathbf{x}}{dr}$. If $A$ is invertible: $$\mathbf{x}^{'}(r) = -A^{-1} B \mathbf{x}(r)$$ The general solution is: $$\mathbf{x}(r) = \sum_{i=1}^{n} c_{i} \exp{(\lambda_{i} r)} \mathbf{u}_{i}$$ Where $\lambda_{i}$ and \$\mathbf{...

5

Your code has a few issues. First of all, recasting the equations you wrote you have the following relations: $$v_{n + 1/2} = v_{n - 1/2} - \omega_02 x_n \Delta t\\ x_{n + 1} = x_n + v_{n + 1/2} \Delta t$$ which is not what you implemented. The two lines where you do a step forward should read: v[i+1] = v[i] + (-w**2) * x[i] * dt x[i+1] = v[i+1] * dt + ...

Top 50 recent answers are included