complex numbers and parametric curves

I would like to be able to plot a 2d parametric plot of zeta(t+I), -2 <= t <= 2, where I is the square root of -1.

But complex numbers and parametric plots seem to barf at each other.

I tried many variants of the following code:

parametric_plot( (zeta(t+I).real(), zeta(t +I).imag()), (t, -2, 2))

But I get the following kind of response:

TypeError: Unable to convert 1.00000000000000*I to float; use abs() or real_part() as desired

edit retag close merge delete

Sort by ยป oldest newest most voted
more

Ok, thank you. But this shows that parametric_plot doesn't work very well...?

( 2012-02-28 05:39:24 +0200 )edit

I cannot say for sure because I haven't check that but using line is not equivalent to using parametric_plot as I would expect parametric_plot to use finer drawing techniques than just a collection of connected lines.

You could the 'lambda trick' use instead : parametric_plot ((lambda t : zeta (I + t) . real (), lambda t : zeta (I + t) . imag ()), (t, -2 , 2))

The drawback is that this computes the value of the function twice which isn't very elegant.

The lambda trick is necessary every time you need to use a complex function with drawing/solving equations with sage. This is possible that optimization techniques relying on formal expression expect these expressions to be real valued.

more