code: def main():
      t = ReferenceSimplex(2)
      fe = Lagrange(2, 2)
  
      u = 0
      # compute u = sum_i u_i N_i
      us = []
      for i in range(0, fe.nbf()):
          ui = Symbol("u_%d" % i)
          us.append(ui)
          u += ui * fe.N[i]
  
      J = zeros(fe.nbf())
      for i in range(0, fe.nbf()):
          Fi = u * fe.N[i]
          print(Fi)
          for j in range(0, fe.nbf()):
              uj = us[j]
              integrands = diff(Fi, uj)
              print(integrands)
              J[j, i] = t.integrate(integrands)
  
      pprint(J)
  
file_path: sympy/examples/advanced/fem.py
imports: from sympy import symbols, Symbol, factorial, Rational, zeros, eye, integrate, diff, pprint, reduced
label_desc: Use image node_id 4 for calling a global function with example usage: main() without return types