Skip to content

Substitute function definitions in SymPy expressions #26575

Closed Answered by oscarbenjamin
vladislavstrmlt asked this question in Q&A
Discussion options

You must be logged in to vote

You can do this with replace:

In [7]: a = Wild('a')

In [8]: f(x+y).replace(f(a), a+2)
Out[8]: x + y + 2

In [9]: equation.replace(f(a), a + 2)
Out[9]: True

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by vladislavstrmlt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants