Ask Your Question
0

complex numbers and parametric curves

asked 2012-02-26 04:09:02 +0100

bbartlett gravatar image

updated 2012-02-26 04:10:31 +0100

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 flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2012-02-26 08:27:58 +0100

achrzesz gravatar image
edit flag offensive delete link more

Comments

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

bbartlett gravatar imagebbartlett ( 2012-02-28 05:39:24 +0100 )edit
0

answered 2017-04-05 14:12:00 +0100

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.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

Stats

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

Seen: 1,196 times

Last updated: Feb 26 '12