import numpy
import sympy

import amod1
import amod2

n1 = {'f': lambda x:'first f',
      'g': lambda x:'first g'}
n2 = {'f': lambda x:'second f',
      'g': lambda x:'second g'}

f = sympy.Function('f')
g = sympy.Function('g')
x = sympy.Symbol('x')

# just the dictionary on its own
if1 = sympy.lambdify(x, f(x), modules=(n1,))
print 'f(x) before dict;', if1(1)
if2 = sympy.lambdify(x, g(x), modules=(n2,))
print 'f(x) after dict;', if1(1)
# with a string - wrong
if1 = sympy.lambdify(x, f(x), modules=(n1, "sympy"))
print 'f(x) before dict, string;', if1(1)
if2 = sympy.lambdify(x, g(x), modules=(n2, "sympy"))
print 'f(x) after dict, string;', if1(1)
# just the dictionary on its own again
if1 = sympy.lambdify(x, f(x), modules=(n1,))
print 'f(x) before dict;', if1(1)
if2 = sympy.lambdify(x, g(x), modules=(n2,))
print 'f(x) after dict;', if1(1)
# with any module
if1 = sympy.lambdify(x, f(x), modules=(n1, amod1))
print 'f(x) before dict, module;', if1(1)
if2 = sympy.lambdify(x, g(x), modules=(n2, amod1))
print 'f(x) after dict, module;', if1(1)
