-
Notifications
You must be signed in to change notification settings - Fork 1
Home
wolfgang_302 edited this page Dec 20, 2017
·
2 revisions
Welcome to the fun-expr wiki!
fun-expr contains a python module fun_expr to create sympy functions from a given expression, i.e.
(By the way: Does someone know, how to write latex code inside a github-wiki?)
Usually it is recommended to use expressions for this:
from sympy import *
init_printing()
a,x = symbols('a,x')
expr = a*x**2
# i.e.:
expr.subs(x,2) # returns 4*a
but i prefer to create a function:
from sympy import *
init_printing()
from fun_expr import Function_from_Expression as FE
a,x = symbols('a,x')
f = FE(x, a*x**2)
# i.e.:
f(2) # returns 4*a
I think, jupyter-notebooks and sympy are great tools to explore math interactively. But i think, if a student is just learning the concept of functions, it is confusing to write expressions like
expr.subs(x,2)
instead of
f(2)
More examples how to use Function_from_Expression can be found in the docs-section of this repo.