Piecewise polynomial electronic wavefunctions