  Cyclic codes have efficient encoding and decoding algorithms. The decoding
error probability and the undetected error probability are usually bounded by
or given from the weight distributions of the codes. Most researches are about
the determination of the weight distributions of cyclic codes with few
nonzeros, by using quadratic form and exponential sum but limited to low
moments. In this paper, we focus on the application of higher moments of the
exponential sum to determine the weight distributions of a class of ternary
cyclic codes with three nonzeros, combining with not only quadratic form but
also MacWilliams' identities. Another application of this paper is to emphasize
the computer algebra system Magma for the investigation of the higher moments.
In the end, the result is verified by one example using Matlab.
