Harmonic Oscillation using Gaussian Quadrature

252 Views Asked by At

Assume that the potential is symmetric with respect to zero and the system has amplitude $a$ suppose that the potential $V(x)=x^4$ and the mass of the particle is $m=1.$ Write a java function that calculates the period of the oscillator for given amplitude $a$ using Gaussian quadrature with $N=20$ points.

Relevant equations: $$E_{\text{total energy}} = \frac12 m(\frac{dx}{dt})^2+V_{potential}(x)$$

and the period will be $$T_{period}=\sqrt{8m}\int^a_0\frac{dx}{\sqrt{V(a)-V(x)}},$$

but I don't have much experience with numerical methods so I am having difficulty proceeding.

1

There are 1 best solutions below

11
On BEST ANSWER

We are asked:

Assume that the potential is symmetric with respect to zero and the system has amplitude $a$ suppose that the potential $V(x)=x^4$ and the mass of the particle is $m=1.$ Write a java function that calculates the period of the oscillator for given amplitude $a$ using Gaussian quadrature with $N=20$ points.

We want to find the period using Gaussian Quadrature with $N=20$ points, $m = 1$, $a = a$: $$T_{period}=\sqrt{8m}\int^a_0\frac{dx}{\sqrt{V(a)-V(x)}} = \sqrt{8m}\int^a_0\frac{dx}{\sqrt{a^4-x^4}}$$

First, refer to this website for the Abscissae and Weights for the case $N = 20$ as those are needed for the calculation.

For Gaussian Quadrature (see examples if this is not clear so you understand the algorithm), we have to make a change of variables since we are not integrating over $(-1, 1)$, so we have:

$$\displaystyle \int_r^s f(x)~dx = \sum_{i=1}^n c_i \left(\dfrac{s-r}{2}\right) f\left(\dfrac{(s-r)x_i+(s+r)}{2}\right) = \sum_{i=1}^n c_i \left( \dfrac a2 \right) f\left(\dfrac{a(x_i+1)}{2}\right)$$

So, for your particular problem, this reduces to:

$$ \sum_{i=1}^n c_i \left( \dfrac a2 \right) f\left(\dfrac{a(x_i+1)}{2}\right) = \sum_{i=1}^{20} c_i \left( \dfrac a2 \right) \dfrac{\sqrt{8}}{\sqrt{a^4-\left(\dfrac{a(x_i+1)}{2}\right)^4}}$$

where the $c_i$ are the weights and $x_i$ are the abscissae from the linked website ($N=20$).

This leads to the result:

$$\displaystyle \sqrt{8}\int^a_0\frac{dx}{\sqrt{a^4-x^4}} = \frac{3.648094084043220866317961523913682543919262381332 }{a}$$

The exact result for this integral is given by:

$\displaystyle \sqrt{8}\int^a_0\dfrac{dx}{\sqrt{a^4-x^4}} = \dfrac{2 \sqrt{2 \pi } \Gamma \left(\dfrac{5}{4}\right)}{a \Gamma \left(\dfrac{3}{4}\right)}=\dfrac{3.7081493546027438368677006943905200924351976470435}{a}$

For example, if we compare the exact result to the Gaussian Quadrature result for $a = 5$, we get:

$$\mbox{Exact}~ = 0.74162987092054876737354013887810401848703952940871$$

versus

$$\mbox{Gaussian}~ = 0.729618816808644173263592304782736508783852476266$$

For the Java, you might look at Gaussian Quadrature Methods, but this is a problem that I cannot help you with since that code needs mods and I am not the person to talk to that.