Ask Your Question

# 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

## 2 Answers

Sort by » oldest newest most voted
more

## Comments

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

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

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2012-02-26 04:09:02 +0200

Seen: 827 times

Last updated: Feb 26 '12