Compatibility differential/difference equations in classical beam problems with the characteristic sets method