def entropy_sharp(self,mu,h0): b = 1.0; mmu = np.mean(mu); if mmu+entropy(mu) > 1+h0: b = findroot((lambda a: mmu+entropy(np.power(mu,a))-(1+h0))); if b < 0.0: b = 1.0; return np.power(mu,b);
def multiplier(eta): x = findroot(lambda l: m.u(m.u_inverse((l + eta * (1 - m.sigma)) ** (-1)), m.u_prime_of_n_inverse( - (l + eta * (1 + m.gamma)) ** (-1))) - udev, 0.001, 10) return x
def Rci(cl,xref,xdat,res=1e3): if not xref: xref = max(xdat) Rbnds = [min(xdat),xref] else: Rbnds = [xref,max(xdat)] kde = gaussian_kde(xdat) def cumprob(xbnd): xgrid = np.linspace(xref,xbnd,res) ydat = kde(xgrid) return abs(0.5*cl-abs(prob(ydat,xgrid))) rootR = findroot(cumprob,bounds=tuple(Rbnds),method='bounded',options={'xatol':1e-3}) xbndR = rootR.x return xbndR
def ypoint(self, y): root = findroot(lambda y2: self._BezierFunction(y2)[1]-y, 0, 1) return self._BezierFunction(root)
def xpoint(self, x): root = findroot(lambda x2: self._BezierFunction(x2)[0]-x, 0, 1) return self._BezierFunction(root)
def ypoint(self, y): root = findroot(lambda y2: self._BezierFunction(y2)[1] - y, 0, 1) return self._BezierFunction(root)
def xpoint(self, x): root = findroot(lambda x2: self._BezierFunction(x2)[0] - x, 0, 1) return self._BezierFunction(root)