The wave automaton for the time-dependent Schrödinger, classical wave and Klein-Gordon equations