当前位置: 首页>>代码示例>>Python>>正文


Python sympy.__version__方法代码示例

本文整理汇总了Python中sympy.__version__方法的典型用法代码示例。如果您正苦于以下问题:Python sympy.__version__方法的具体用法?Python sympy.__version__怎么用?Python sympy.__version__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sympy的用法示例。


在下文中一共展示了sympy.__version__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_pynumber

# 需要导入模块: import sympy [as 别名]
# 或者: from sympy import __version__ [as 别名]
def test_pynumber():
    a = sympy.FF(7)(3)
    b = sympify(a)

    assert isinstance(b, PyNumber)

    a = a + 1
    b = b + 1
    assert isinstance(b, PyNumber)
    assert b == a                  # Check equality via SymEngine
    assert a == b                  # Check equality via SymPy

    a = 1 - a
    b = 1 - b
    assert isinstance(b, PyNumber)
    assert b == a                  # Check equality via SymEngine
    assert a == b                  # Check equality via SymPy

    a = 2 * a
    b = 2 * b
    assert isinstance(b, PyNumber)
    assert b == a                  # Check equality via SymEngine
    assert a == b                  # Check equality via SymPy

    if sympy.__version__ != '1.2':
        a = 2 / a
        b = 2 / b
        assert isinstance(b, PyNumber)
        assert b == a                  # Check equality via SymEngine
        assert a == b                  # Check equality via SymPy

    x = Symbol("x")
    b = x * sympy.FF(7)(3)
    assert isinstance(b, Mul)

    b = b / x
    assert isinstance(b, PyNumber) 
开发者ID:symengine,项目名称:symengine.py,代码行数:39,代码来源:test_sympy_conv.py

示例2: lambdify_with_vector_args

# 需要导入模块: import sympy [as 别名]
# 或者: from sympy import __version__ [as 别名]
def lambdify_with_vector_args(args, expr, modules=DEFAULT_LAMBDIFY_MODULES):
    """
    A wrapper around sympy's lambdify where process_vector_args is used so
    generated callable can take arguments as either vector or individual
    components

    Parameters
    ----------
    args : list-like of sympy symbols
        Input arguments to the expression to call
    expr : sympy expression
        Expression to turn into a callable for numeric evaluation
    modules : list
        See lambdify documentation; passed directly as modules keyword.

    """
    new_args = process_vector_args(args)

    if sp.__version__ < '1.1' and hasattr(expr, '__len__'):
        expr = sp.Matrix(expr)

    f = sp.lambdify(new_args, expr, modules=modules)

    def lambda_function_with_vector_args(*func_args):
        new_func_args = process_vector_args(func_args)
        return np.array(f(*new_func_args))
    lambda_function_with_vector_args.__doc__ = f.__doc__
    return lambda_function_with_vector_args 
开发者ID:simupy,项目名称:simupy,代码行数:30,代码来源:symbolic.py

示例3: about

# 需要导入模块: import sympy [as 别名]
# 或者: from sympy import __version__ [as 别名]
def about():
    """Strawberry Fields information.

    Prints the installed version numbers for SF and its dependencies,
    and some system info. Please include this information in bug reports.

    **Example:**

    .. code-block:: pycon

        >>> sf.about()
        Strawberry Fields: a Python library for continuous-variable quantum circuits.
        Copyright 2018-2020 Xanadu Quantum Technologies Inc.

        Python version:            3.6.8
        Platform info:             Linux-5.0.0-36-generic-x86_64-with-debian-buster-sid
        Installation path:         /home/josh/Dropbox/Work/Xanadu/sf_cloud/strawberryfields
        Strawberry Fields version: 0.12.0-dev
        Numpy version:             1.17.4
        Scipy version:             1.3.0
        Sympy version:             1.5
        NetworkX version:          2.4
        The Walrus version:        0.10.0
        Blackbird version:         0.2.1
        TensorFlow version:        2.0.0
    """
    # pylint: disable=import-outside-toplevel
    import sys
    import platform
    import os
    import numpy
    import scipy
    import sympy
    import networkx
    import thewalrus
    import blackbird

    # a QuTiP-style infobox
    print("\nStrawberry Fields: a Python library for continuous-variable quantum circuits.")
    print("Copyright 2018-2020 Xanadu Quantum Technologies Inc.\n")

    print("Python version:            {}.{}.{}".format(*sys.version_info[0:3]))
    print("Platform info:             {}".format(platform.platform()))
    print("Installation path:         {}".format(os.path.dirname(__file__)))
    print("Strawberry Fields version: {}".format(__version__))
    print("Numpy version:             {}".format(numpy.__version__))
    print("Scipy version:             {}".format(scipy.__version__))
    print("SymPy version:             {}".format(sympy.__version__))
    print("NetworkX version:          {}".format(networkx.__version__))
    print("The Walrus version:        {}".format(thewalrus.__version__))
    print("Blackbird version:         {}".format(blackbird.__version__))

    try:
        import tensorflow

        tf_version = tensorflow.__version__
    except ImportError:
        tf_version = None

    print("TensorFlow version:        {}".format(tf_version)) 
开发者ID:XanaduAI,项目名称:strawberryfields,代码行数:62,代码来源:__init__.py

示例4: run

# 需要导入模块: import sympy [as 别名]
# 或者: from sympy import __version__ [as 别名]
def run(self):
    required, optional = [], []
    try:
      import astropy
      astropy_version = astropy.__version__
      if LooseVersion(astropy_version) < LooseVersion('1.0'):
        required.append('astropy 1.0+')
    except:
      required.append('astropy')
    try:
      import scipy
      scipy_version = scipy.__version__
      if LooseVersion(scipy_version) < LooseVersion('0.1'):
        required.append('scipy 0.1+')
    except:
      required.append('scipy')
    try:
      import matplotlib
      mpl_version = matplotlib.__version__
      if LooseVersion(mpl_version) < LooseVersion('1.4.3'):
        optional.append('matplotlib 1.4.3+')
    except:
      optional.append('matplotlib')
    try:
      import sympy
      sympy_version = sympy.__version__
      if LooseVersion(sympy_version) < LooseVersion('1.0'):
        optional.append('sympy 1.0+')
    except:
      optional.append('sympy')

    if required == []:
      print('All required import dependencies satisfied.')
    else:
      print('NOTE: while all the build dependencies are satisfied, the following import dependencies')
      print('      are still missing: %s.' % required)
      print('      You will not be able to import phoebe before you install those dependencies.')

    if optional == []:
      print('All optional import dependencies satisfied.')
    else:
      print('NOTE: while all the build dependencies are satisfied, the following optional dependencies')
      print('      are still missing: %s.' % optional)
      print('      Some of the core phoebe functionality will be missing until you install those dependencies.') 
开发者ID:phoebe-project,项目名称:phoebe2,代码行数:46,代码来源:setup.py


注:本文中的sympy.__version__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。