Ask Your Question

div, grad and curl once again

asked 2018-01-26 15:24:04 -0600

quantum_leopard gravatar image

updated 2018-01-28 15:27:20 -0600

tmonteil gravatar image

HI, and sorry to badger people who are all working to give us a terrific maths tool for no cost, but there's a big need for div, grad and curl in many applications, such as electromagnetics, quantum theory, fluid flow, etc.

Specifically, my wish list would be, if s is a scalar field, and v a vector one,

grad (s) in cartesians, polars, cylindricals and sphericals

div (v) over the same coordinate systems

curl (v) over the same coordinate systems


grad(grad(s)) over these four systems, the spherical one being quite tricky anyway

Is there any cance of some kind person implementing (and documenting) these?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2018-01-27 07:19:40 -0600

eric_g gravatar image

As suggested in @tmonteil 's answer, all necessary material is in the manifolds part, but it needs to be made explicit for the end user. For instance, there should be a function EuclideanSpace so that

sage: E = EuclideanSpace(3)

creates the 3-dimensional Euclidean space as a smooth manifold endowed with a Riemannian flat metric. Then one could do things like

sage: v = E.vector_field([-x*z, x+z, y^2])
sage: c = v.curl()
sage: d = v.div()
sage: spher = E.spherical_frame()  # orthonormal frame associated with spherical coordinates
sage: c.display(spher)

This was on my todo list for a while... @quantum_leopard 's question acts as an efficient reminder: I'm on it ;-) I will report here (with a Trac ticket number) when the code is ready.

edit flag offensive delete link more


That would be awesome !

tmonteil gravatar imagetmonteil ( 2018-01-27 08:22:11 -0600 )edit

Let me add a confirmed_bug tag to add some motivation in fixing that :P

tmonteil gravatar imagetmonteil ( 2018-01-28 15:28:00 -0600 )edit

That would be great. Thank you!

quantum_leopard gravatar imagequantum_leopard ( 2018-01-30 15:18:02 -0600 )edit

This is now tickets #24622 and #24623. Things are split in two tickets for the ease of the reviewer(s). Note that the code is not ready yet (it should be within a few days).

eric_g gravatar imageeric_g ( 2018-01-31 04:28:25 -0600 )edit

Here is some update: the first ticket, #24622, is ready for review. It already implements the operators grad, div, curl, laplacian and dalembertian, as you can see on this demo Jupyter notebook.

eric_g gravatar imageeric_g ( 2018-02-11 11:15:02 -0600 )edit

answered 2018-01-27 04:51:03 -0600

tmonteil gravatar image

updated 2018-01-27 04:52:33 -0600

I think all the material for this is available in the manifolds module, in particular changes of coordinates, though the operators are not explicitely written. This is a very good idea to implement this, and include it in Sage. Do not hesitate to try that module and report how far you can go with that. If you want to turn a chance into a reality, to you might consider becoming the kind person implementing these ;)

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


Asked: 2018-01-26 15:24:04 -0600

Seen: 53 times

Last updated: Jan 27