Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vector fields on the sphere #552

Closed
FedeClaudi opened this issue Nov 10, 2022 · 5 comments
Closed

Vector fields on the sphere #552

FedeClaudi opened this issue Nov 10, 2022 · 5 comments

Comments

@FedeClaudi
Copy link
Contributor

Hi all,

Thank you for the great work on the sphere.

I was wandering if you had some example code or suggestion for how to define vector fields on the 2-sphere manifold in a way that works well with Manifolds.jl?

Thank you,
Federico

@kellertuer
Copy link
Member

kellertuer commented Nov 10, 2022

Hi,
since the usual representation (both for points and tangent vectors) is in $\mathbb R^3$ it is enough to just define a function that maps a vector to a vector.

For example

using Manifolds
M = Sphere(2)
f(p) = [p[2], -p[1], 0]
p = [1.0, 0.0, 0.0]

Here f is defined in a little lazy way, but especially for all points on the sphere M.

You have also tools to check that all works as expected, that is

is_point(M,p)
f(p)
is_vector(M, p, f(p))

if you are unsure you actually defined a vector field.
Is that what you need?

edit/PS: thanks for the kind words, if you miss anything on the sphere, or any other manifold, let us know :)

@mateuszbaran
Copy link
Member

Hi,
Ronny's suggestion is one way to define a vector field. Another option is to define one in a chart. We don't have a fixed interface for that but I'd like to add one when it turns out to be needed.

By the way, what do you intend to do with those vector fields? Right now in Manifolds.jl all we do is evaluating them.

@FedeClaudi
Copy link
Contributor Author

FedeClaudi commented Nov 10, 2022

Hi thank you both for getting back to me so quickly.

Explaining in detail what I need this for would require a lengthy background as its part of a larger project. But briefly the values of tangent vectors on the manifold go into defining the connectivity of a neural network in a neuroscience project I'm working on.
So given a bunch of points I need to evaluate a few different vector fields at that point.

@kellertuer that would work, I guess what I'm after is a way to define f "implicitly" in the sense that is_vector(M, p, f(p)) is not required at f will always give a tangent vector. Perhaps defining a scalar function on S and evaluating it's gradient? Or maybe as linear combinations of the $\partial x^i$ of the charts coortdinates function?

@kellertuer
Copy link
Member

the is_vector is not required in this case, that is just for debugging reasons and the f I did define always yields a vector function. My function f could also be a gradient of some function. For gradients (of scalar functions on a manifold) we also have some AD support. Or I do not understand what you mean by implicitly.

For the very last question – that is what @mateuszbaran proposes, but you can do that a little bit easier as long as you know a basis for each tangent space, see for example https://juliamanifolds.github.io/ManifoldsBase.jl/stable/bases.html

@kellertuer
Copy link
Member

Since this is not a bug/enhancement – I will move this over to discussions.

@JuliaManifolds JuliaManifolds locked and limited conversation to collaborators Apr 4, 2023
@kellertuer kellertuer converted this issue into discussion #590 Apr 4, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants