Equilibrium equations for piezoelectric and ferroelectgric materials