How to use the symengine.Mul function in symengine

To help you get started, we’ve selected a few symengine examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github biosustain / optlang / optlang / symbolics.py View on Github external
import operator
    from six.moves import reduce

    optlang._USING_SYMENGINE = True

    Integer = symengine.Integer
    Real = symengine.RealDouble
    Basic = symengine.Basic
    Number = symengine.Number
    Zero = Integer(0)
    One = Integer(1)
    NegativeOne = Integer(-1)
    sympify = symengine.sympy_compat.sympify

    Add = symengine.Add
    Mul = symengine.Mul
    Pow = symengine.sympy_compat.Pow

    class Symbol(symengine_Symbol):
        def __new__(cls, name, *args, **kwargs):
            if not isinstance(name, six.string_types):
                raise TypeError("name should be a string, not %s" % repr(type(name)))

            return symengine_Symbol.__new__(cls, name)

        def __init__(self, name, *args, **kwargs):
            super(Symbol, self).__init__(name)
            self._name = name

        def __repr__(self):
            return self._name
github biosustain / optlang / src / optlang / symbols / symengine_facade.py View on Github external
from __future__ import absolute_import

import symengine

Integer = symengine.Integer
Real = symengine.RealNumber
Basic = symengine.Basic
Number = symengine.Number
Zero = Integer(0)
One = Integer(1)
NegativeOne = Integer(-1)
sympify = symengine.sympify

Add = symengine.Add
Mul = symengine.Mul
Pow = symengine.Pow


class UniqueSymbol(symengine.Symbol):
    """
    Present a uniform facade to the ``symengine.Symbol`` class.

    ``symengine.Symbol`` already creates unique objects even when they have
    the same name. The use of ``__slots__`` is propagated.

    Attributes
    ----------
    name : str
        The name of the symbol.

    Warnings