plotting modulus of complex function



On 2012-05-04, Bart Vandewoestyne <Bart.Vandewoestyne at telenet.be> wrote:

> The real reason why I wanted to look at the Ge(s) function is that I 
> want to understand its behavior for s->0.  If I plot its modulus, i see 
> a quite smooth behavior between 1e-7 and 1e-1, but for values lower than 
> 1e-7 the abs(Ge(s)) function seems to go up again???

Try replacing the ordinary floats (approx. 16 digits) with bigfloats
(variable number of digits). I replaced the floats with bigfloats in
your script as shown by the diff in the PS. Increasing fpprec (50, 100,
200) yields results that seem to converge to approximately 2.3b-4 as s
goes to 0. (Usual disclaimer about numerical results applies.)

Note that if you change fpprec, you probably have to reconstruct Ge and
Gm because some arithmetic has already been carried out by the time you
get around to defining the functions.

By the way, after replacing the floats, you can still apply plot2d to
the function, but since the plotting code wants floats, it's not
an entirely accurate representation of the function. So to investigate
the behavior close to s = 0, I think you can try something like:

foo(s):=abs(Ge(s))$
for n thru 16 do print(bfloat(foo(1.0b0/10^n)))$

Hope this helps, it's an interesting problem.

Robert Dodier

PS.
$ diff -u bartscript.mac bartscript_bigfloat.mac 
--- bartscript.mac	2012-05-04 08:45:16.000000000 -0600
+++ bartscript_bigfloat.mac	2012-05-04 08:56:20.000000000 -0600
@@ -18,14 +18,15 @@
 assum(d>0)$
 */
 
-d: 1e-3$
-f: 10e9$
+fpprec : 50;
+d: 1b-3$
+f: 10^9$
 omega: 2*%pi*f$
-e0: 8.8541878176e-12$
-mu0: 4e-7*%pi$
+e0: 8.8541878176b-12$
+mu0: 4b-7*%pi$
 v0: 1/sqrt(e0*mu0)$
 k0: 2*%pi*f/v0$
-esub: 12.9*e0$
+esub: 12.9b0*e0$
 
 Z_TE_sub(s) := %i*omega*mu0/(k0*sqrt(s^2-esub/e0))$
 Z_TE_0(s)   := %i*omega*mu0/(k0*sqrt(s^2-1))$