def iso_triangle(element_nodes, xi, eta): from numpy import array from numpy import sum from numpy.linalg import det from numpy.linalg import inv shape = array([1.0 - xi - eta,xi,eta]) shape_dxi = array([-1.0,1.0,0.0]) shape_deta = array([-1.0,0.0,1.0]) x = element_nodes[:, 0] y = element_nodes[:, 1] jacobi = array([[sum(shape_dxi * x), sum(shape_dxi * y)],[sum(shape_deta * x), sum(shape_deta * y)]]) jacobian = det(jacobi) inverted_jacobi = inv(jacobi) shape_dx = inverted_jacobi[0, 0] * shape_dxi + inverted_jacobi[0, 1] * shape_deta shape_dy = inverted_jacobi[1, 0] * shape_dxi + inverted_jacobi[1, 1] * shape_deta return jacobian, shape, shape_dx, shape_dy