Ask Your Question
0

How to define a vector field over a chart?

asked 2023-11-26 12:04:46 +0100

pfeifhns gravatar image

updated 2023-11-26 15:46:27 +0100

eric_g gravatar image

Hello, I have the following code in sage:

E.<x,y,z> = EuclideanSpace()
CA = E.cartesian_coordinates(); CA
BP.<r, θ, ϕ> = E.chart()
BP_to_CA = BP.transition_map(CA, [r * sin(θ) * cos(ϕ), r * sin(θ) * sin(ϕ), r * cos(θ)])
g = E.metric()

E.set_default_chart(BP)
E.set_default_frame(BP.frame())
show( g.display() )
show( g.display_comp())

f = E.scalar_field({BP: function('F')(r, θ, ϕ)}, name='f')
f.display(BP)
f.laplacian().expr(BP).factor()

The transition map here is for spherical coordinates, I want to use it for other coordiante systems, so I don't want to use the spherical coordinates in sagemath. So I can define a scalar field and use gradient / laplacian-functions. Works fine. In order to calculate divergence and curl, I need to define a vector field. How can I do this? Thank's for your effort

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2023-11-26 16:02:14 +0100

eric_g gravatar image

updated 2023-11-26 16:29:26 +0100

You can define a vector field by providing its components in the default frame like this:

v = E.vector_field((function('v_r')(r, θ, ϕ), 
                    function('v_θ')(r, θ, ϕ), 
                    function('v_ϕ')(r, θ, ϕ)),
                   name='v')

and then compute its divergence and curl via

v.divergence().display()

and

v.curl().display()

See https://doc.sagemath.org/html/en/refe... and https://doc.sagemath.org/html/en/refe... for more details.

edit flag offensive delete link more

Comments

Thank you for your comment. Unfortunately this doesn't work. I get the error message "no starting chart could be found to compute the expression in the Chart (E^3, (x, y, z))"

pfeifhns gravatar imagepfeifhns ( 2023-11-26 17:13:03 +0100 )edit

It works for me with SageMath 10.1. Which version of SageMath are you using? What is your operating system?

eric_g gravatar imageeric_g ( 2023-11-26 18:48:18 +0100 )edit

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: 2023-11-26 12:04:46 +0100

Seen: 71 times

Last updated: Nov 26 '23