3 years ago
%pylab inline
import numpy as np
#from sincfit import *
from scipy.optimize import root

import matplotlib.pyplot as plt
import matplotlib as mpl
Populating the interactive namespace from numpy and matplotlib 

I would have done:

$y\left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right) = y(\alpha)$

$\frac{\partial y}{\partial \Delta_\perp} = \frac{dy}{d\alpha} \frac{\partial \alpha}{\partial \Delta_\perp} = y'(\alpha) \frac{\partial}{\partial \Delta_\perp}\left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right) = \frac{2\Delta_{||}}{(\Delta_\perp + \Delta_{||})^2} y'(\alpha)$

$\frac{\partial y}{\partial \Delta_{||}} = \frac{dy}{d\alpha} \frac{\partial \alpha}{\partial \Delta_{||}} = y'(\alpha) \frac{\partial}{\partial \Delta_{||}}\left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right) = \frac{-2\Delta_\perp}{(\Delta_\perp + \Delta_{||})^2} y'(\alpha)$

and

$\frac{\partial}{\partial \Delta_\perp} \sqrt{\Delta_\perp + \Delta_{||}} = \frac{\partial}{\partial \Delta_{||}} \sqrt{\Delta_\perp + \Delta_{||}} = \frac{1}{2\sqrt{\Delta_\perp + \Delta_{||}}}$

you can then use:

\frac{\partial}{\partial \alpha} y\left( \alpha \right) = \frac{\partial}{\partial \alpha}\left( 1 + \alpha \right)^{\frac{1}{2}} - \frac{1}{\pi} \int_{-\infty}^{\infty} ds \left[ \frac{\partial}{\partial \alpha} 1 - \frac{\partial}{\partial \alpha} \sqrt{\frac{1 + s^2}{\alpha}} \cdot \arctan\left(\frac{\alpha}{1 + s^2}\right)^{\frac{1}{2}} - \sqrt{\frac{1 + s^2}{\alpha}} \cdot \frac{\partial}{\partial \alpha}\arctan\left(\frac{\alpha}{1 + s^2}\right)^{\frac{1}{2}} \right]$$\frac{\partial}{\partial \alpha} y\left( \alpha \right) = \frac{1}{2(1 + \alpha)^{\frac{1}{2}}} - \frac{1}{\pi} \int_{-\infty}^{\infty} ds \left[ \sqrt{\frac{1+s^2}{4 \alpha^{{3}}}} \cdot \arctan\left( \sqrt{\frac{\alpha}{1 + s^2}}\right) - \sqrt{\frac{1 + s^2}{\alpha}} \cdot \frac{1}{1 + \frac{\alpha}{1+s^2}}\right] therefore:$$\frac{\partial y}{\partial \Delta_\perp} = \frac{2 \Delta_{||}}{(\Delta_\perp + \Delta_{||})^2} \cdot \frac{1}{2(1 + \left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right))^{\frac{1}{2}}} - \frac{1}{\pi} \int_{-\infty}^{\infty} ds \left[ \sqrt{\frac{1+s^2}{2 \left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right)^{{3}}}} \cdot \arctan\left( \sqrt{\frac{\left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right)}{1 + s^2}}\right) - \sqrt{\frac{1 + s^2}{\left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right)}} \cdot \frac{1}{1 + \frac{\left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right)}{1+s^2}}\right]\frac{\partial y}{\partial \Delta_{||}} = \frac{-2 \Delta_{\perp}}{(\Delta_\perp + \Delta_{||})^2} \cdot \frac{1}{2(1 + \left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right))^{\frac{1}{2}}} - \frac{1}{\pi} \int_{-\infty}^{\infty} ds \left[ \sqrt{\frac{1+s^2}{2 \left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right)^{{3}}}} \cdot \arctan\left( \sqrt{\frac{\left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right)}{1 + s^2}}\right) - \sqrt{\frac{1 + s^2}{\left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right)}} \cdot \frac{1}{1 + \frac{\left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right)}{1+s^2}}\right] Further:

\frac{\partial D_{sing}}{\partial \Delta_{\perp / \parallel}} = \frac{Q^3 k_B T}{\sqrt{2}\pi} \left[ \frac{\partial}{\partial \Delta_{\perp / \parallel}}\sqrt{\frac{\Delta_{\perp} + \Delta_{\parallel}}{J Q^2}} \cdot y\left( \frac{\Delta_{\perp} -
\Delta_{\parallel}}{\Delta_{\perp} + \Delta_{\parallel}} \right) + \sqrt{\frac{\Delta_{\perp} + \Delta_{\parallel}}{J Q^2}} \cdot \frac{\partial}{\partial \Delta_{\perp / \parallel}} y\left( \frac{\Delta_{\perp} - \Delta_{\parallel}}{\Delta_{\perp} + \Delta_{\parallel}} \right) \right]\



\frac{\partial D_{sing}}{\partial \Delta_{\perp / \parallel}} = \frac{Q^3 k_B T}{\sqrt{2}\pi} \left[\sqrt{\frac{1}{(\Delta_{\perp} + \Delta_{\parallel})\cdot J Q^2}} \cdot y\left( \frac{\Delta_{\perp} -
\Delta_{\parallel}}{\Delta_{\perp} + \Delta_{\parallel}} \right) + \sqrt{\frac{\Delta_{\perp} + \Delta_{\parallel}}{J Q^2}} \cdot \frac{\partial}{\partial \Delta_{\perp / \parallel}} y\left( \frac{\Delta_{\perp} - \Delta_{\parallel}}{\Delta_{\perp} + \Delta_{\parallel}} \right) \right]\

$and so:$

\frac{\partial D_{sing}}{\partial \Delta_{\perp}} = \frac{Q^3 k_B T}{\sqrt{2}\pi} \left[\sqrt{\frac{1}{(\Delta_{\perp} +
\Delta_{\parallel})\cdot J Q^2}} \cdot y\left( \frac{\Delta_{\perp} - \Delta_{\parallel}}{\Delta_{\perp} + \Delta_{\parallel}} \right) +
\sqrt{\frac{\Delta_{\perp} + \Delta_{\parallel}}{J Q^2}} \cdot \left( \frac{2 \Delta_{||}}{(\Delta_\perp + \Delta_{||})^2} \cdot \frac{1}{2(1 + \left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right))^{\frac{1}{2}}} - \frac{1}{\pi} \int_{-\infty}^{\infty} ds
\left[ \sqrt{\frac{1+s^2}{2 \left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right)^{{3}}}} \cdot \arctan\left( \sqrt{\frac{\left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right)}{1 + s^2}}\right) - \sqrt{\frac{1 + s^2}{\left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right)}} \cdot \frac{1}{1 + \frac{\left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right)}{1+s^2}}\right] \right) \right]



\frac{\partial D_{sing}}{\partial \Delta_{\parallel}} = \frac{Q^3 k_B T}{\sqrt{2}\pi} \left[\sqrt{\frac{1}{(\Delta_{\perp} +
\Delta_{\parallel})\cdot J Q^2}} \cdot y\left( \frac{\Delta_{\perp} - \Delta_{\parallel}}{\Delta_{\perp} + \Delta_{\parallel}} \right) +
\sqrt{\frac{\Delta_{\perp} + \Delta_{\parallel}}{J Q^2}} \cdot \left( \frac{-2 \Delta_{\perp}}{(\Delta_\perp + \Delta_{||})^2} \cdot \frac{1}{2(1 + \left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right))^{\frac{1}{2}}} - \frac{1}{\pi} \int_{-\infty}^{\infty} ds
\left[ \sqrt{\frac{1+s^2}{2 \left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right)^{{3}}}} \cdot \arctan\left( \sqrt{\frac{\left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right)}{1 + s^2}}\right) - \sqrt{\frac{1 + s^2}{\left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right)}} \cdot \frac{1}{1 + \frac{\left(\frac{\Delta_\perp - \Delta_{||}}{\Delta_\perp + \Delta_{||}}\right)}{1+s^2}}\right] \right) \right]


def yalpha(alpha):
if alpha==0:
return 1

else:
svals=np.linspace(-10000,10000,10000000,endpoint=True)
sqas=np.lib.scimath.sqrt(alpha/(1+svals**2))
toint=1-1/sqas*np.arctan(sqas)
integ=np.trapz(toint,svals)
return np.real(np.sqrt(1+alpha)-integ/np.pi)

def yaprime(alpha):
dalpha = 1e-6
if np.abs(alpha) < dalpha:
return 1/6

return np.real(0.5*(yalpha(alpha+dalpha)-yalpha(alpha-dalpha))/dalpha)
def yprime_ana(alpha):
svals=np.linspace(-10000,10000,10000000,endpoint=True)
sqas=np.lib.scimath.sqrt(alpha/(1+svals**2))
#toint=1-1/sqas*np.arctan(sqas)
pre = (1/2)*(1/(np.lib.scimath.sqrt(1 +alpha)))
toint = ((1/2/alpha)*(1/sqas)*np.arctan(sqas)-(1/sqas)*(1/(1+sqas**2)))
integ=np.trapz(toint,svals)
return np.real(pre-integ/np.pi)

M$_0$ = $\chi_0$ $\cdot$ H

M$_0$ = $\chi_0$ $\cdot$ $\frac{B}{\mu_0}$ = $\frac{\mu_B}{f.u.} \dot \phi_0$

M$_0$ = $\frac{\chi_0 \cdot f.u.}{\mu_B \cdot \mu_0}$ $\cdot$ B