本文整理汇总了Python中sympy.core.logic.fuzzy_and函数的典型用法代码示例。如果您正苦于以下问题:Python fuzzy_and函数的具体用法?Python fuzzy_and怎么用?Python fuzzy_and使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fuzzy_and函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: cond
def cond():
d = self._smat
yield self.is_square
if len(d) <= self.rows:
yield fuzzy_and(d[i, i].is_real for i, j in d if i == j)
else:
yield fuzzy_and(d[i, i].is_real for i in range(self.rows) if (i, i) in d)
yield fuzzy_and(((self[i, j] - self[j, i].conjugate()).is_zero if (j, i) in d else False) for (i, j) in d)
开发者ID:pabloferz,项目名称:sympy,代码行数:8,代码来源:sparse.py
示例2: test_fuzzy_and
def test_fuzzy_and():
assert fuzzy_and([T, T]) == T
assert fuzzy_and([T, F]) == F
assert fuzzy_and([T, U]) == U
assert fuzzy_and([F, F]) == F
assert fuzzy_and([F, U]) == F
assert fuzzy_and([U, U]) == U
assert [fuzzy_and([w]) for w in [U, T, F]] == [U, T, F]
assert fuzzy_and([T, F, U]) == F
assert fuzzy_and([]) == T
raises(TypeError, lambda: fuzzy_and())
开发者ID:Bercio,项目名称:sympy,代码行数:11,代码来源:test_logic.py
示例3: __new__
def __new__(cls, *args):
n = args[BinomialDistribution._argnames.index('n')]
p = args[BinomialDistribution._argnames.index('p')]
n_sym = sympify(n)
p_sym = sympify(p)
if fuzzy_not(fuzzy_and((n_sym.is_integer, n_sym.is_nonnegative))):
raise ValueError("'n' must be positive integer. n = %s." % str(n))
elif fuzzy_not(fuzzy_and((p_sym.is_nonnegative, (p_sym - 1).is_nonpositive))):
raise ValueError("'p' must be: 0 <= p <= 1 . p = %s" % str(p))
else:
return super(BinomialDistribution, cls).__new__(cls, *args)
开发者ID:cmarqu,项目名称:sympy,代码行数:12,代码来源:frv_types.py
示例4: _old_assump_replacer
def _old_assump_replacer(obj):
# Things to be careful of:
# - real means real or infinite in the old assumptions.
# - nonzero does not imply real in the old assumptions.
# - finite means finite and not zero in the old assumptions.
if not isinstance(obj, AppliedPredicate):
return obj
e = obj.args[0]
ret = None
if obj.func == Q.positive:
ret = fuzzy_and([e.is_finite, e.is_positive])
if obj.func == Q.zero:
ret = e.is_zero
if obj.func == Q.negative:
ret = fuzzy_and([e.is_finite, e.is_negative])
if obj.func == Q.nonpositive:
ret = fuzzy_and([e.is_finite, e.is_nonpositive])
if obj.func == Q.nonzero:
ret = fuzzy_and([e.is_nonzero, e.is_finite])
if obj.func == Q.nonnegative:
ret = fuzzy_and([fuzzy_or([e.is_zero, e.is_finite]),
e.is_nonnegative])
if obj.func == Q.rational:
ret = e.is_rational
if obj.func == Q.irrational:
ret = e.is_irrational
if obj.func == Q.even:
ret = e.is_even
if obj.func == Q.odd:
ret = e.is_odd
if obj.func == Q.integer:
ret = e.is_integer
if obj.func == Q.imaginary:
ret = e.is_imaginary
if obj.func == Q.commutative:
ret = e.is_commutative
if ret is None:
return obj
return ret
开发者ID:Davidjohnwilson,项目名称:sympy,代码行数:44,代码来源:sathandlers.py
示例5: _from_args
def _from_args(cls, args, is_commutative=None):
"""Create new instance with already-processed args"""
if len(args) == 0:
return cls.identity
elif len(args) == 1:
return args[0]
obj = super(AssocOp, cls).__new__(cls, *args)
if is_commutative is None:
is_commutative = fuzzy_and(a.is_commutative for a in args)
obj.is_commutative = is_commutative
return obj
开发者ID:AStorus,项目名称:sympy,代码行数:12,代码来源:operations.py
示例6: _eval_is_real
def _eval_is_real(self):
x = self.args[0]
if len(self.args) == 1:
k = S.Zero
else:
k = self.args[1]
if k.is_zero:
return (x + 1/S.Exp1).is_positive
elif (k + 1).is_zero:
from sympy.core.logic import fuzzy_and
return fuzzy_and([x.is_negative, (x + 1/S.Exp1).is_positive])
elif k.is_nonzero and (k + 1).is_nonzero:
return False
开发者ID:AdrianPotter,项目名称:sympy,代码行数:13,代码来源:exponential.py
示例7: is_hermitian
def is_hermitian(self):
"""Checks if the matrix is Hermitian.
In a Hermitian matrix element i,j is the complex conjugate of
element j,i.
Examples
========
>>> from sympy.matrices import SparseMatrix
>>> from sympy import I
>>> from sympy.abc import x
>>> a = SparseMatrix([[1, I], [-I, 1]])
>>> a
Matrix([
[ 1, I],
[-I, 1]])
>>> a.is_hermitian
True
>>> a[0, 0] = 2*I
>>> a.is_hermitian
False
>>> a[0, 0] = x
>>> a.is_hermitian
>>> a[0, 1] = a[1, 0]*I
>>> a.is_hermitian
False
"""
def cond():
d = self._smat
yield self.is_square
if len(d) <= self.rows:
yield fuzzy_and(
d[i, i].is_real for i, j in d if i == j)
else:
yield fuzzy_and(
d[i, i].is_real for i in range(self.rows) if (i, i) in d)
yield fuzzy_and(
((self[i, j] - self[j, i].conjugate()).is_zero
if (j, i) in d else False) for (i, j) in d)
return fuzzy_and(i for i in cond())
开发者ID:chaffra,项目名称:sympy,代码行数:41,代码来源:sparse.py
示例8: test_fuzzy_and
def test_fuzzy_and():
assert fuzzy_and(*[T, T]) == T
assert fuzzy_and(*[T, F]) == F
assert fuzzy_and(*[T, U]) == U
assert fuzzy_and(*[F, F]) == F
assert fuzzy_and(*[F, U]) == F
assert fuzzy_and(*[U, U]) == U
assert fuzzy_and([T, T]) == T
assert fuzzy_and([T, F]) == F
assert fuzzy_and([T, U]) == U
assert fuzzy_and([F, F]) == F
assert fuzzy_and([F, U]) == F
assert fuzzy_and([U, U]) == U
assert [fuzzy_and(w) for w in [U, T, F]] == [U, T, F]
raises(ValueError, lambda: fuzzy_and([]))
raises(ValueError, lambda: fuzzy_and())
开发者ID:QuaBoo,项目名称:sympy,代码行数:16,代码来源:test_logic.py
示例9: _eval_is_nonnegative
def _eval_is_nonnegative(self):
return fuzzy_and(a.is_nonnegative for a in self.args)
开发者ID:baoqchau,项目名称:sympy,代码行数:2,代码来源:miscellaneous.py
示例10: _eval_is_integer
def _eval_is_integer(self):
from sympy.core.logic import fuzzy_and, fuzzy_not
p, q = self.args
if fuzzy_and([p.is_integer, q.is_integer, fuzzy_not(q.is_zero)]):
return True
开发者ID:bjodah,项目名称:sympy,代码行数:5,代码来源:mod.py
示例11: _eval_is_integer
def _eval_is_integer(self):
from sympy.core.logic import fuzzy_and
p, q = self.args
return fuzzy_and([p.is_integer, q.is_integer, q.is_nonzero])
开发者ID:EuanFree,项目名称:sympy,代码行数:4,代码来源:mod.py
示例12: MatMul_elements
def MatMul_elements(matrix_predicate, scalar_predicate, expr, assumptions):
d = sift(expr.args, lambda x: isinstance(x, MatrixExpr))
factors, matrices = d[False], d[True]
return fuzzy_and([
test_closed_group(Basic(*factors), assumptions, scalar_predicate),
test_closed_group(Basic(*matrices), assumptions, matrix_predicate)])
开发者ID:Lenqth,项目名称:sympy,代码行数:6,代码来源:matrices.py
示例13: is_real
def is_real(self):
return fuzzy_and(arg.is_real for arg in self.args)
开发者ID:AALEKH,项目名称:sympy,代码行数:2,代码来源:miscellaneous.py
示例14: Basic
def Basic(expr, assumptions):
return fuzzy_and([fuzzy_not(ask(Q.nonzero(expr), assumptions)),
ask(Q.real(expr), assumptions)])
开发者ID:A-turing-machine,项目名称:sympy,代码行数:3,代码来源:order.py
示例15: test_fuzzy_and
def test_fuzzy_and():
assert fuzzy_and(*[T, T]) == T
assert fuzzy_and(*[T, F]) == F
assert fuzzy_and(*[T, U]) == U
assert fuzzy_and(*[F, F]) == F
assert fuzzy_and(*[F, U]) == F
assert fuzzy_and(*[U, U]) == U
assert fuzzy_and([T, T]) == T
assert fuzzy_and([T, F]) == F
assert fuzzy_and([T, U]) == U
assert fuzzy_and([F, F]) == F
assert fuzzy_and([F, U]) == F
assert fuzzy_and([U, U]) == U
开发者ID:sympy,项目名称:sympy,代码行数:13,代码来源:test_logic.py
示例16: _eval_is_integer
def _eval_is_integer(self):
return fuzzy_and([self.args[0].is_integer, self.args[0].is_positive])
开发者ID:artcompiler,项目名称:artcompiler.github.com,代码行数:2,代码来源:factor_.py
示例17: _eval_is_positive
def _eval_is_positive(self):
return fuzzy_and((self.args[0].is_integer,
(self.args[0] + 1).is_nonnegative))
开发者ID:glyg,项目名称:sympy,代码行数:3,代码来源:factorials.py
示例18: _eval_is_integer
def _eval_is_integer(self):
return fuzzy_and((self.args[0].is_integer, self.args[1].is_integer,
self.args[1].is_nonnegative))
开发者ID:AlexanderKulka,项目名称:sympy,代码行数:3,代码来源:factorials.py
示例19: _eval_is_positive
def _eval_is_positive(self):
return fuzzy_and(a.is_positive for a in self.args)
开发者ID:baoqchau,项目名称:sympy,代码行数:2,代码来源:miscellaneous.py
注:本文中的sympy.core.logic.fuzzy_and函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论