Computation of higher order spatial derivatives in the multiscale expansion of electromagnetic field problems