Finite-element solution of arbitrarily nonlinear, graded-index slab waveguides