A numerical method of harmonic analysis