mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-14 19:43:41 +02:00
Added method second_deriv, set standard case for first deriv to symmetric
This commit is contained in:
parent
c07f0629fa
commit
5bd0fae19e
1 changed files with 14 additions and 1 deletions
|
@ -173,7 +173,7 @@ class Corr:
|
||||||
sp_vec = sp_vec/np.sqrt(sp_vec@sp_vec)
|
sp_vec = sp_vec/np.sqrt(sp_vec@sp_vec)
|
||||||
return sp_vec
|
return sp_vec
|
||||||
|
|
||||||
def deriv(self, symmetric=False): #Defaults to forward derivative f'(t)=f(t+1)-f(t)
|
def deriv(self, symmetric=True): #Defaults to forward symmetric derivative
|
||||||
if not symmetric:
|
if not symmetric:
|
||||||
newcontent = []
|
newcontent = []
|
||||||
for t in range(self.T - 1):
|
for t in range(self.T - 1):
|
||||||
|
@ -195,6 +195,19 @@ class Corr:
|
||||||
raise Exception("Derivative is undefined at all timeslices")
|
raise Exception("Derivative is undefined at all timeslices")
|
||||||
return Corr(newcontent, padding_back=1, padding_front=1)
|
return Corr(newcontent, padding_back=1, padding_front=1)
|
||||||
|
|
||||||
|
|
||||||
|
def second_deriv(self):
|
||||||
|
newcontent = []
|
||||||
|
for t in range(1, self.T-1):
|
||||||
|
if (self.content[t-1] is None) or (self.content[t+1] is None):
|
||||||
|
newcontent.append(None)
|
||||||
|
else:
|
||||||
|
newcontent.append((self.content[t + 1] - 2 * self.content[t] + self.content[t - 1]))
|
||||||
|
if(all([x is None for x in newcontent])):
|
||||||
|
raise Exception("Derivative is undefined at all timeslices")
|
||||||
|
return Corr(newcontent, padding_back=1, padding_front=1)
|
||||||
|
|
||||||
|
|
||||||
#effective mass at every timeslice
|
#effective mass at every timeslice
|
||||||
def m_eff(self, periodic=False):
|
def m_eff(self, periodic=False):
|
||||||
if self.N != 1:
|
if self.N != 1:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue