The steady oscillatory irrotational motion of an inviscid incompressible fluid is described by a boundary-value problem of elliptic type. A variational form of this problem has been made here the basis of a numerical method. The problem is simplified assuming that the amplitudes of the generated waves are small compared with their wave lengths. The numerical satisfaction of the radiation boundary condition has been investigated. Some sample problems with known solutions have been treated first in order to test the method. All the results for two-dimensional motion and for heaving motion of an axisymmetric body in infinite or finite depths show very good agreement with existing results. In addition, some diffraction problems in two dimensions with homogeneous fluid or stratified fluids are solved, and also a problem with nonuniform depth.