Given an equation of constants, will simplify both sides, returning the steps and the result of the equation e.g. 'True' or 'False'
775403
function solveConstantEquation(equation, debug, steps=[]) {
  const compareFunction = COMPARATOR_TO_FUNCTION[equation.comparator];

  if (!compareFunction) {
    throw Error('Unexpected comparator');
  }

  steps = addSimplificationSteps(steps, equation, true, debug);
  if (steps.length > 0) {
    const lastStep = steps[steps.length - 1];
    equation = Equation.createEquationFromString(
      lastStep.newEquation.print(), equation.comparator);
  }

  // If the left or right side didn't have any steps, unnecessary parens
  // might not have been removed, so do that now.
  equation.leftNode = removeUnnecessaryParens(equation.leftNode);
  equation.rightNode = removeUnnecessaryParens(equation.rightNode);

  if (!Node.Type.isConstantOrConstantFraction(equation.leftNode, true) ||
      !Node.Type.isConstantOrConstantFraction(equation.rightNode, true)) {
    throw Error('Expected both nodes to be constants, instead got: ' +
                equation.print());
  }

  const leftValue = equation.leftNode.eval();
  const rightValue = equation.rightNode.eval();
  let changeType;
  if (compareFunction(leftValue, rightValue)) {
    changeType = ChangeTypes.STATEMENT_IS_TRUE;
  }
  else {
    changeType = ChangeTypes.STATEMENT_IS_FALSE;
  }

  // there's no oldEquation or change groups because nothing actually changes
  // here, it's just a final step that states the solution
  const equationStatus = new EquationStatus(changeType, null, equation);
  if (debug) {
    logSteps(equationStatus);
  }
  steps.push(equationStatus);
  return steps;
}
501413
def diff_info(data):
    
    def get_diff(l):
        diff = 0
        for no1, no2 in iter_steps(l, steps=2):
            diff += abs(no1 - no2)
        return diff

    data1 = data[2:]
    diff1 = get_diff(data1)

    data2 = data[1:-1]
    diff2 = get_diff(data2)

    return diff1, diff2
906352
def isclose(a, b, rtol=1e-5, atol=1e-8):
    """"""
    return abs(a - b) < (atol + rtol * abs(b))
318560
function simplifySigns(fraction) {
  if (!Node.Type.isOperator(fraction) || fraction.op !== '/') {
    return Node.Status.noChange(fraction);
  }
  const oldFraction = clone(fraction);
  let numerator = fraction.args[0];
  let denominator = fraction.args[1];
  // The denominator should never be negative.
  if (Negative.isNegative(denominator)) {
    denominator = Negative.negate(denominator);
    const changeType = Negative.isNegative(numerator) ?
      ChangeTypes.CANCEL_MINUSES :
      ChangeTypes.SIMPLIFY_SIGNS;
    numerator = Negative.negate(numerator);
    const newFraction = Node.Creator.operator('/', [numerator, denominator]);
    return Node.Status.nodeChanged(changeType, oldFraction, newFraction);
  }
  else {
    return Node.Status.noChange(fraction);
  }
}
350273
def simplify(self):
        
        if self.iscanonical:
            return self

        expr = self.cancel()
        if not isinstance(expr, self.__class__):
            return expr.simplify()

        if expr.args[0] in (self.TRUE, self.FALSE,):
            return expr.args[0].dual

        expr = self.__class__(expr.args[0].simplify())
        expr.iscanonical = True
        return expr
678871
def step(self, t, x_im1, v_im1_2, dt):
        

        x_i = x_im1 + v_im1_2 * dt
        F_i = self.F(t, np.vstack((x_i, v_im1_2)), *self._func_args)
        a_i = F_i[self.ndim:]

        v_i = v_im1_2 + a_i * dt / 2
        v_ip1_2 = v_i + a_i * dt / 2

        return x_i, v_i, v_ip1_2
1257946
def OneHot(*xs, simplify=True, conj=True):
    
    xs = [Expression.box(x).node for x in xs]
    terms = list()
    if conj:
        for x0, x1 in itertools.combinations(xs, 2):
            terms.append(exprnode.or_(exprnode.not_(x0),
                                      exprnode.not_(x1)))
        terms.append(exprnode.or_(*xs))
        y = exprnode.and_(*terms)
    else:
        for i, xi in enumerate(xs):
            zeros = [exprnode.not_(x) for x in xs[:i] + xs[i+1:]]
            terms.append(exprnode.and_(xi, *zeros))
        y = exprnode.or_(*terms)
    if simplify:
        y = y.simplify()
    return _expr(y)
1209136
def ystep(self):
        """

        AXU = self.AX + self.U
        self.Y[..., 0:-1] = sp.prox_l2(AXU[..., 0:-1], self.mu/self.rho)
        self.Y[..., -1] = sp.prox_l1(AXU[..., -1],
                                     (self.lmbda/self.rho) * self.Wl1)
212602
def xstep(self):
        
        """

        self.YU[:] = self.Y - self.U

        b = self.DSf + self.rho*sl.rfftn(self.YU, None, self.cri.axisN)
        if self.cri.Cd == 1:
            self.Xf[:] = sl.solvedbi_sm(self.Df, self.mu + self.rho,
                                        b, self.c, self.cri.axisM)
        else:
            self.Xf[:] = sl.solvemdbi_ism(self.Df, self.mu + self.rho, b,
                                          self.cri.axisM, self.cri.axisC)

        self.X = sl.irfftn(self.Xf, self.cri.Nv, self.cri.axisN)

        if self.opt['LinSolveCheck']:
            Dop = lambda x: sl.inner(self.Df, x, axis=self.cri.axisM)
            if self.cri.Cd == 1:
                DHop = lambda x: np.conj(self.Df) * x
            else:
                DHop = lambda x: sl.inner(np.conj(self.Df), x,
                                          axis=self.cri.axisC)
            ax = DHop(Dop(self.Xf)) + (self.mu + self.rho)*self.Xf
            self.xrrs = sl.rrs(ax, b)
        else:
            self.xrrs = None
1344520
def TRM(f,a,b):
    
    m = float(a) * math.tanh(float(b) * float(f))
    return float(m)
1149879
def par_xstep(i):
    

    """
    global mp_X
    global mp_DX
    YU0f = sl.rfftn(mp_Y0[[i]] - mp_U0[[i]], mp_Nv, mp_axisN)
    YU1f = sl.rfftn(mp_Y1[mp_grp[i]:mp_grp[i+1]] -
                    1/mp_alpha*mp_U1[mp_grp[i]:mp_grp[i+1]], mp_Nv, mp_axisN)
    if mp_Cd == 1:
        b = np.conj(mp_Df[mp_grp[i]:mp_grp[i+1]]) * YU0f + mp_alpha**2*YU1f
        Xf = sl.solvedbi_sm(mp_Df[mp_grp[i]:mp_grp[i+1]], mp_alpha**2, b,
                            mp_cache[i], axis=mp_axisM)
    else:
        b = sl.inner(np.conj(mp_Df[mp_grp[i]:mp_grp[i+1]]), YU0f,
                     axis=mp_C) + mp_alpha**2*YU1f
        Xf = sl.solvemdbi_ism(mp_Df[mp_grp[i]:mp_grp[i+1]], mp_alpha**2, b,
                              mp_axisM, mp_axisC)
    mp_X[mp_grp[i]:mp_grp[i+1]] = sl.irfftn(Xf, mp_Nv,
                                            mp_axisN)
    mp_DX[i] = sl.irfftn(sl.inner(mp_Df[mp_grp[i]:mp_grp[i+1]], Xf,
                                  mp_axisM), mp_Nv, mp_axisN)
711706
function(a, b){
			return (a._x < b._x + b._w && a._y < b._y + b._h 
					&& a._x + a._w > b._x && a._y + a._h > b._y)
		}
657725
def simplify(self):
        
        expr = self.expr
        self.expr = _cancel_mul(expr, self.registry)
        return self
492652
def equation(operation, firstnum, secondnum):
    
    if operation == 'plus':
        return firstnum + secondnum
    elif operation == 'minus':
        return firstnum - secondnum
    elif operation == 'multiply':
        return firstnum * secondnum
    elif operation == 'divide':
        if not secondnum == 0:
            return firstnum / secondnum
        raise ZeroDivisionError("Unable to divide by 0.")
    raise ValueError('Invalid operation provided.')
164521
def step(self, y, u, t, h):
		
		k1 = h * self.func(t, y, u)
		k2 = h * self.func(t + .5*h, y + .5*h*k1, u)
		k3 = h * self.func(t + .5*h, y + .5*h*k2, u)
		k4 = h * self.func(t + h, y + h*k3, u)
		return y + (k1 + 2*k2 + 2*k3 + k4) / 6.0
254259
def combination_step(self):
        

        # Update t step
        tprv = self.t
        self.t = 0.5 * float(1. + np.sqrt(1. + 4. * tprv**2))

        # Update Y
        if not self.opt['FastSolve']:
            self.Yfprv = self.Yf.copy()
        self.Yf = self.Xf + ((tprv - 1.) / self.t) * (self.Xf - self.Xfprv)
115263
boolean eq(ECoordinate v) // ==
	{
		return Math.abs(m_value - v.m_value) <= m_eps + v.m_eps;
	}