Ask Your Question

Revision history [back]

Not sure exactly how to explain the problem you get when plotting, but here is a way to get an actual plot.

After defining gd as in the question, the following gets you a plot:

tau = 2 * RDF.pi()
plt3 = plot(lambda x: gd.subs({omega: QQ(x)}), (tau*0.98e3, tau*1.02e3))

With this, I get a plot which looks gently curved (not an M shape).


The trick with RDF.pi() avoids keeping a symbolic pi lying around.

The other trick is to substitute rational values into gd, so that gd(x) is computed as a rational, returning a rational number (computed in arbitrary precision); this rational can then be transformed into a floating point number for plotting.

The naive plotting uses a floating-point omega, so that the various terms in the numerator and denominator are computed separately as floating point numbers, and approximation errors get out of control with the high powers of omega in numerator and denominator.