Skip to content

Instantly share code, notes, and snippets.

@astrojuanlu
Created September 22, 2013 19:34
Show Gist options
  • Select an option

  • Save astrojuanlu/6663026 to your computer and use it in GitHub Desktop.

Select an option

Save astrojuanlu/6663026 to your computer and use it in GitHub Desktop.
SymPy example session
In [1]: from sympy import symbols
In [2]: x, y = symbols('x, y')
In [3]: c, d = symbols('c, d')
In [4]: x ** 2 + 2 * y
Out[4]:
2
x + 2⋅y
In [5]: _.subs([(x, 24 + 6 * c), (y, 2 * 25 / d)])
Out[5]:
2 100
(6⋅c + 24) + ───
d
In [6]: _.subs([(c, 1), (d, 4)])
Out[6]: 925
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment