Solving physics problems for which we know the equations, boundary conditions and symmetries can be done by deep learning. The constraints can be either imposed as terms in a loss function or used to formulate a neural ansatz. In the present case study, we calculate the induced field inside and outside a dielectric cube placed in a uniform electric field, wherein the dielectric mismatch at edges and corners of the cube makes accurate calculations numerically challenging. The electric potential is expressed as an ansatz incorporating neural networks with known leading order behaviors and symmetries and the Laplace's equation is then solved with boundary conditions at the dielectric interface by minimizing a loss function. The loss function ensures that both Laplace's equation and boundary conditions are satisfied everywhere inside a large solution domain. We study how the electric potential inside and outside a quasi-cubic particle evolves through a sequence of shapes from a sphere to a cube. The neural network being differentiable, it is straightforward to calculate the electric field over the whole domain, the induced surface charge distribution and the polarizability. The neural network being retentive, one can efficiently follow how the field changes upon particle's shape or dielectric constant by iterating from any previously converged solution. The present work's objective is two-fold, first to show how an a priori knowledge can be incorporated into neural networks to achieve efficient learning and second to apply the method and study how the induced field and polarizability change when a dielectric particle progressively changes its shape from a sphere to a cube.