I'm trying to figure out a way to algorithmically get the amplitude and phase of a function that has sinusoidal terms in the Maxima computer algebra system. This only applies to steady state (as t -> infinity and the transients decay). For example, a trivial case would be:
f(t) = 1 / w * sin(w * t + theta) + exp(-a * t) + 8
In this case, the gain would be 1 / w, the phase offset would be theta, and we would ignore the transient term exp(-a * t) because we only care about the steady state gain and phase delay, and exp(-a * t) -> 0 as t -> infinity. We would also ignore the "+ 8" term because it's just a DC offset. The way I've been taught to do it in my engineering classes requires a lot of heuristics and tedious rearranging of equations to get them in a form similar to the above, where the answer is obvious just from looking at it.
Does anyone know of a general, algorithmic method of finding the gain and phase delay assuming they exist, given that I have the full power of a computer algebra system (and the standard functions that one would expect a CAS to have) to throw at it? Although I will likely be implementing it in Maxima, I would certainly appreciate generic answers explained just in terms of math.
Edit: I thought it was abundantly clear from my example that I want the answer symbolically, in terms of w. w is really supposed to be omega, and represents the frequency of the input. What I'm really asking is whether there are any standard math operations that will produce the gain and phase terms without a bunch of heuristic, manual equation rearranging.