An atom is an expression with no subexpressions.īut not: Add, Mul, Pow, … singleton # class. Atom ( * args ) #Ī parent class for atomic things. Substitution of subexpressions as defined by the objects themselves. Replacement capable of doing wildcard-like matching, parsing of match, and conditional replacements subs If the keyword simultaneous is True, the subexpressions will not beĮvaluated until all the substitutions have been made. Resulting sorted list is then processed as an iterable container In this case the old/new pairs will be sorted by op count and inĬase of a tie, by number of args and the default_sort_key. o a dict or set whose key/value items correspond to old/new pairs. Patterns possibly affecting replacements already made. Replacements are processed in the order given with successive The iterable may be o an iterable container with (old, new) pairs. Substitutes old for new in an expression after sympifying args. sort_key ()) subs ( * args, ** kwargs ) # > S ( "" ) > sorted ( _, key = lambda x : x. The list of possible combinations of queries and replacement values Setting this to False accepts a match of 0 while setting it TrueĪccepts all matches that have a 0 in them. Values are received for each Wild that appears in the match pattern. It will be set to True so the match will only succeed if all non-zero Is being used to match subexpressions and the exact flag is None In addition, if an expression containing more than one Wild symbol Problems, simultaneous can be set to False. The defaultĪpproach is to do the replacement in a simultaneous fashion soĬhanges made are targeted only once. Subexpressions from the bottom to the top of the tree. Traverses an expression tree and performs replacement of matching The returned value will be self.xreplace(map) otherwise it should If the expression itself does not match the query, then Was a sub-expression found with query and new is the replacement If map = True then also return the mapping where old Replace matching subexpressions of self with value. See the refine function in sympy.assumptions replace ( query, value, map = False, simultaneous = True, exact = None ) # rcall ( z ) x + 2*z refine ( assumption = True ) # > from sympy import Lambda > from sympy.abc import x, y, z > ( x + Lambda ( y, 2 * y )). This is a convenience function that allows one to create objects fromĪny iterable, without having to convert to a list or tuple first. classmethod fromiter ( args, ** assumptions ) # To which it will perform a derivative those areīound variables, too, so it has its own free_symbols method.Īny other method that uses bound variables should implement aįree_symbols method. Derivative keeps track of symbols with respect Which are bound variables, so Integral has a method to return all Integrals use Symbols for the dummy variables Eg: IndexedBase(‘I’).free_symbolsįor most expressions, all symbols are free symbols. Return from the atoms of self those which are free symbols. dummy_eq ( x ** 2 + y, y ) False find ( query, group = False ) #įind all subexpressions matching a query. extended_negative # extended_nonnegative # extended_positive # extended_nonpositive # extended_nonzero #Īs without the extended part, but also including infinity withĬorresponding sign, e.g., extended_positive includes oo hermitian # antihermitian # Object can have only positive (nonpositive) values. Object can have only negative (nonnegative) Object absolute value is bounded (arbitrarily large). Object value cannot be represented exactly by Rational, see. Object is a real number that is not zero. Object is a positive integer that has at least one positiveĭivisor other than 1 or the number itself. No positive divisors other than 1 and itself. Object is a natural number greater than 1 that has Object can have only values from the set of Please note that 0 is not considered to be an Number multiplied by the imaginary unit I. Object value is a number that can be written as a real Object commutes with any other object with Here follows a list of possible assumption names: commutative # For example, a symbol that has a propertyīeing integer, is also real, complex, etc. May or may not be positive so a value of None is returned for x.is_positive.īy default, all symbolic values are in the largest set in the given context When the property cannot be determined (or when a method is not
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |