Ask Your Question
2

How to visualise complex functions on a disk?

asked 2017-12-04 10:08:48 +0100

nebuckandazzer gravatar image

updated 2017-12-04 10:12:48 +0100

Let $f$ be a function on the unit disk $\mathbb{D}$. I want to look at the images of $f(\mathbb{D})$?

How to do this?

How to see the contours of $|f(z)|$?

How to see the argument (if possible)?

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted
2

answered 2017-12-05 14:38:15 +0100

Sébastien gravatar image

updated 2017-12-06 17:54:17 +0100

There use to be a very nice gallery of examples of complex valued functions drawn using mpmath library available in Sage through SymPy, but it is too bad, the link is now broken. Maybe it can be restored by exporting the google code repository?

UPDATE: Thanks to Samuel Lelièvre and Fredrik Johansson, the gallery is back online: http://mpmath.org/gallery/

edit flag offensive delete link more

Comments

matplotlib graphs may be nice and come in handy. However, you have to be aware that they are not Sage "graphical objects" : you are on your own when it comes to using them.

Second point : the current 3D abilities of matplotlib are a bit limited. Especially, there is no, as far as I know, dynamic rendering, allowing scaling/rotation as allowed by the dynamic viewers used by Sage. What you get is a static image, similar to what Tachyon gives you.

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2017-12-05 18:31:05 +0100 )edit
1

Hi @Sébastien, the gallery is now back from brokenland, see http://mpmath.org/gallery/ -- it's a bit thanks to your answer, which prompted me to ask the mpmath list about the gallery, which made Fredrik Johansson revive it. Many thanks to Ask Sage, to @nebuckandazzer, to @Sébastien, to the mpmath list, and to Fredrik!

slelievre gravatar imageslelievre ( 2017-12-06 15:25:44 +0100 )edit

That is really sweet; if possible maybe it should be added to the Sage documentation as a link as well. Is it faster than complex_plot (I don't recall if that uses mpmath generically under the hood when possible)?

kcrisman gravatar imagekcrisman ( 2017-12-06 20:11:08 +0100 )edit
2

answered 2017-12-04 19:29:19 +0100

Emmanuel Charpentier gravatar image

There is a nice complex_plot function which maps the argument of the function's value to the color of the representative point, and its modulus to tthe brightness. This may or may not be what you want.

Yon can also give a 3D representation using a colored 3D surface, mapping modulus to z and argument to color. The proble is, of course, what to do with poles ?

I have written this a couple times already, but not yet filed a ticket for that. If you're interested, I may post my code here, but don't expect miracles : it will be _s-l-o-w_...

edit flag offensive delete link more

Comments

Great, i did not know about that one ! For the other, which ticket is that ?

tmonteil gravatar imagetmonteil ( 2017-12-05 11:44:28 +0100 )edit

No ticket yet. I'll keep you posted here... But I already have my load of late tickets...

The problem is that 3D surface coloring and the ability to let "holes" in them are founded on _undocumented_ abilities of our 3D infrastructure. Writing new code using them is risky if those features remain undocumented.

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2017-12-05 18:30:39 +0100 )edit

@Emmanuel Charpentier, open the ticket anyway, and another ticket for documenting the features.

slelievre gravatar imageslelievre ( 2017-12-06 09:07:43 +0100 )edit

Done : this is Trac#24335, depending on Trac#24331.

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2017-12-07 11:14:18 +0100 )edit
1

answered 2017-12-04 10:54:30 +0100

tmonteil gravatar image

You should give more details on how is your function defined, the answer depends on this. Let me assume that you have a symbolic function like:

f(x,y) = cos(x+I*y)

You can see its norm as follows:

plot3d(lambda x,y: abs(f(x,y)),[-5,5],[-1,1])

You can see its argument as follows (note that you will have a discontinuity at -pi=pi):

plot3d(lambda x,y: arg(f(x,y)),[-5,5],[-1,1])
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

1 follower

Stats

Asked: 2017-12-04 10:08:48 +0100

Seen: 992 times

Last updated: Dec 06 '17