code: def same_transformation(element1, element2, basis_change):
      """
      Matrices can be thought of as representations of linear mappings
      between two (coordinate-free) vector spaces represented in
      particular bases.
  
      Hence, a MatrixGroup instance with matrix.shape = (ndim, ndim)
      represents a linear transformation L on a vector space of
      dimension ndim, in a given coordinate system.
  
      This function asks the question:
  
      Do the two elements of a MatrixGroup (element1, element2)
      represent the same linear mapping if basis_change represents the
      change of basis between the two?
  
      element1.coords = change_basis(element2, basis_change).coords
  
      """
      newelement = change_basis(element1, basis_change)
      return (
          np.allclose(newelement.matrix, element2.matrix)
          and newelement.coords == element2.coords
      )
  
imports: import numpy
  from nipy.core.api import AffineTransform, CoordinateSystem
  from nipy.core.reference.coordinate_map import compose
  from nipy.core.reference.coordinate_map import product
label_desc: Use image node_id 3 for calling a global function with example usage: same_transformation(element1, element2, basis_change) and returns: unknown