In SymPy we have objects that are not Symbol(s) but should behave like
symbols.
Examples: Indexed, MatrixElement, sympy.physics.units.Quantity,
RandomSymbol, etc...
There are some issue related, for example:
In [1]: A = IndexedBase("A")
In [2]: Order(A[i])
Out[2]: O(A[i]; (A, i) → (0, 0))
In [3]: Order(A[i]).args
Out[3]: (A[i], (A, 0), (i, 0))
In [5]: Order(A[i], A[i]).args
Out[5]: (A[i], (A[i], 0))
I would expect output 3 an output 5 to be the same, but it's not the case.
Output 3 is due to the fact that *A[i].free_symbols* gives *{A, i}*,
therefore *Order* interprets *A[i]* as an expression of *A *and *i*.
Similar issues appear in the calculations of derivatives, limits, series,
equation solvers and so on. It seems that in most cases they trace back to
the behaviour of *.free_symbols* and *.has( )*, which is well defined for
expressions of Symbol, but in case of symbol-like objects could produce the
wrong behaviour.
I suggest to create some extra methods, let's say *.free_symbols_in_expr*
and *.has_in_expr( )*, they should act corresponding to the previous
methods, with the exception of stopping the recursion once an expression
atom has been reached. For example, *A[i]* can be put in an expression, but
its arguments (A and i) are no subparts of the expression anymore,
therefore *A[i].free_symbols_in_expr* should return *{A[i]}*.
*Order( ... )* could be changed to use these new methods and make output 3
and 5 equivalent.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/c7fb8c69-6d39-44c0-aa99-0f69f537b5d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.