def sech(array): output = [] if ArraySizer(array)[0] > 1: for row in array: row_vals = [] for value in row: try: row_vals.append(float(mpmath.sech(value))) except (OverflowError): if value > 0: row_vals.append(1) else: row_vals.append(-1) output.append(row_vals) return output else: row_vals = [] for value in array: try: row_vals.append(float(mpmath.sech(value))) except (OverflowError): if value > 0: row_vals.append(1) else: row_vals.append(0) return row_vals
def logpdf(x, loc=0, scale=1): """ Logarithm of the PDF of the logistic distribution. """ with mpmath.extradps(5): x = mpmath.mpf(x) loc = mpmath.mpf(loc) scale = mpmath.mpf(scale) z = (x - loc) / scale logp = 2 * mpmath.log(mpmath.sech(z / 2)) - mpmath.log(4 * scale) return logp
def pdf(x, loc=0, scale=1): """ PDF of the logistic distribution. """ with mpmath.extradps(5): x = mpmath.mpf(x) loc = mpmath.mpf(loc) scale = mpmath.mpf(scale) z = (x - loc) / scale p = mpmath.sech(z / 2)**2 / (4 * scale) return p
def DDs(self, x): return -2 * pow(mpmath.sech(x), 2) * mpmath.tanh(x)
def Ds(self, x): return pow(mpmath.sech(x), 2)
def sech(x): y = np.zeros_like(x) for i in range(0, len(x)): y[i] = mpmath.sech(math.pi/2*x[i])/2 return y
def eval(self, z): return mpmath.sech(z)
k_b = 1.380649e-23 # (JK^-1) Boltzmann constant from nist lambda_sf = 1.4e-9 #(m) spin flip length theta_she = 0.3 # spinn hall angle ###################### MTJ dimensions ###################### w_mtj = 40e-9 #(m) l_mtj = 120e-9 #(m) t_mtj = 1.5e-9 #(m) a_mtj = (cp.pi/4.0)*l_mtj*w_mtj # cross sectional area of MTJ v_mtj = a_mtj*t_mtj ###################### SHM1 dimensions ###################### ### SHM1 w_shm1 = 120e-9 #(m) l_shm1 = 80e-9 #(m) t_shm1 = 2.8e-9 #(m) a_shm1 = w_shm1*t_shm1 # (m^2) P_she1 = (a_mtj/a_shm1)*theta_she*(1-float(mpmath.sech(t_shm1/lambda_sf))) ### SHM2 w_shm2 = 150e-9 #(m) l_shm2 = 100e-9 #(m) t_shm2 = 2.8e-9 #(m) a_shm2 = w_shm2*t_shm2 # (m^2) P_she2 = (a_mtj/a_shm2)*theta_she*(1-float(mpmath.sech(t_shm2/lambda_sf))) ###################### Thermal field ###################### N_s = 2*M_s*v_mtj/(gamma*hbar) # number of spins I_sf = q_e*gamma*mu_0*M_s*N_s# scaling factor for spin current v_sd = cp.sqrt((2*alpha*k_b*temp)/(mu_0*(M_s**2)*v_mtj)) # standard deviation of thermal field ###################### Spin current ###################### I_c = -200e-6 # (A) # I_c = -35e-6 # (A) I_s = P_she1*I_c # spin current H_k = 2*delta*k_b*temp/(v_mtj*mu_0*M_s)
def eval(self, z): return mpmath.sech(z)
# -*- coding: utf-8 -*- """ Created by libsedmlscript v0.0.1 """ from sed_roadrunner import model, task, plot from mpmath import sech #---------------------------------------------- sech(0.5)
def dFx(self, x): return mp.sech(x)**2