Mathematical modeling of metamaterials