import numpy as np
import sympy
from sympy import lambdify
from sympy import sympify
import scipy
from scipy.optimize import curve_fit
from scipy.integrate import quad
import scipy.stats as stats
import matplotlib.pyplot as plt

import re
import math
from math import atan
from cmath import sqrt

x = sympy.symbols('x', real=True)
s = sympy.symbols('s', real=True)
t = sympy.symbols('t', real=True)
u = sympy.symbols('u', real=True)
M_pi = sympy.symbols('M_pi', real=True, positive=True)
F_pi = sympy.symbols('F_pi', real=True)
JBart = sympy.symbols('JBart', real=True)
JBaru = sympy.symbols('JBaru', real=True)
JBars = sympy.symbols('JBars', real=True)
a = sympy.symbols('a', real=True)
b = sympy.symbols('b', real=True)
n = sympy.symbols('n', real=True)
alpha = sympy.symbols('alpha', real=True)
beta = sympy.symbols('beta', real=True) 
gamma = sympy.symbols('gamma', real=True)   
delta = sympy.symbols('delta', real=True) 
lambda1 =  sympy.symbols('lambda1', real=True) 
lambda2 =  sympy.symbols('lambda2', real=True)
c = sympy.symbols('c', real=True)
A_x = sympy.symbols('A_x', real=True)
B_x = sympy.symbols('B_x', real=True)
C_x = sympy.symbols('C_x', real=True)
D_x = sympy.symbols('D_x', real=True)
E_x = sympy.symbols('E_x', real=True)
F_x = sympy.symbols('F_x', real=True)

#Constants needed for numerical integration
M_pi = 0.138
#q = 3.5
#M_eta = q*0.138
M_eta = 0.54786
eps  = 2e-5  
eps1 = 2e-5
epsj = 0.001j
#eps, eps1, epsj need to be "fine tuned" for some numerical integrations. 
#"fine tuning" is being done in appropriete files. for the rest of needed
#functions, these values will work well
M_minus = (M_eta - M_pi)**2 
M_plus = (M_eta + M_pi)**2
deltaP = M_eta**2 - M_pi**2

#Constants needed for fit
A_00 = 1.06420688*3 # 3xA_x from op2 fit
s_0 = (3*M_pi**2 + M_eta**2)/3
alpha = 1.352 
beta = 1.253
F_pi = 92.4e-3
pi = np.pi
lambda1 = -0.01
lambda2 = 0.0175