A method is presented for the determination of complex-valued compression and shear elastic moduli of polymers for ultrasound applications. The resulting values, which are scarcely reported in the literature, are found with uncertainties typically around 1% (real part) and 6% (imaginary part). The method involves a setup consisting of a cm-radius, mm-thick polymer ring glued concentrically to a disk-shaped piezoelectric transducer. The ultrasound electrical impedance spectrum of the transducer is computed numerically and fitted to measured values as an inverse problem in a wide frequency range, typically from 500 Hz to 5 MHz, both on and off resonance. The method was validated experimentally by ultrasonic through-transmission around 1.9 MHz. Experimentally, the method is arguably simple and low cost, and it is not limited to specific geometries and crystal symmetries. Moreover, by involving off-resonance frequencies, it allows for determining the imaginary parts of the elastic moduli, equivalent to attenuation coefficients. Finally, the method has no obvious frequency limitations before severe attenuation sets in above 100 MHz.