# Is it possible to plot a manifold from it's metric / line element in Mathematica?

i'm very new to using Mathematica and mostly just trying to work out what it can or can't do. I'm doing a course on differential geometry and was wondering if there might be a better way for me to visualise a lot of the abstract objects and forms that we're dealing with.

For example, if I have a line element such as $$ds^2 = (-x^2+y^2)dx^2+(2xy)dxdy+(2x^2+y^2)dy^2$$

is this enough information alone for Mathematica to extraploate the underlying geometry? and if so how? or does it need more input than just this?

• What is the question here? What do you want to describe? Write the code and we will discuss. – Alex Trounev Nov 17 '19 at 17:51
• Uh, well, a line element describes infinitesimal movement across a surface. So on a plane it would just be $ds^2 = dx^2 + dy^2$, for example; but it's not unique since $ds^2 = dr^2 + r^2d\theta^2$ also describes the same plane but in polar coordinates. So, ostensibly there's a way to use a line element to plot out the surface it's describing, regardless of your coordinate system. And my question is, is there a way to do that in Mathematica? I don't know what code to use, because like I said I'm new to using mathematica. – W I Barton Nov 17 '19 at 20:11
• Read the tutorial on page ref/entity/Surface – Alex Trounev Nov 17 '19 at 21:17
• Same question in math.SE: math.stackexchange.com/questions/2613078/… – Michael E2 Nov 17 '19 at 22:13
• Is that minus sign correct and in the right spot? You have a metric that's changing signature from Riemannian to Lorentzian as x and y vary, which sure doesn't seem right. – Itai Seggev Nov 20 '19 at 23:59

As I briefly describe here, you can define your own geometry from the metric tensor (expressed as a matrix) and do various computations with it. I'm going to assume the minus sign is an error and you meant to put in a Riemannian metric. Despite the name, this function works with Lorentizan metrics so you could put the minus sign as an overall factor for $$dx^2$$ and it would work.

vars = {x,y}

patch =
SymbolicTensorsRiemannianGeometryPatch[
SymbolicTensorsTensor[{{-x^2 + y^2, x y}, {x y, 2 x^2 + y^2}},
{SymbolicTensorsCotangentBasis[vars], SymbolicTensorsCotangentBasis[vars]}], vars];

Simplify[patch["RicciTensor", vars]]

(* SymbolicTensorsTensor[
{{-((-2*x^6 - 2*x^4*y^2 + x^2*y^4 + y^6)/(2*x^4 + 2*x^2*y^2 + y^4)^2),
(2*x^5*y - x*y^5)/(2*x^4 + 2*x^2*y^2 + y^4)^2},
{(2*x^5*y - x*y^5)/(2*x^4 + 2*x^2*y^2 + y^4)^2,
(4*x^6 + 2*x^4*y^2 - 2*x^2*y^4 - y^6)/(2*x^4 + 2*x^2*y^2 + y^4)^2}},
{SymbolicTensorsCotangentBasis[{x, y}], SymbolicTensorsCotangentBasis[{x, y}]}] *)


and

Simplify[Laplacian[f[x, y], vars, patch]]

(* (1/(2*x^4 + 2*x^2*y^2 + y^4)^2)*((4*x^4*y - y^5)*Derivative[0, 1][f][x, y] +
(2*x^6 + 4*x^4*y^2 + 3*x^2*y^4 + y^6)*Derivative[0, 2][f][x, y] -
2*x^5*Derivative[1, 0][f][x, y] + 3*x*y^4*Derivative[1, 0][f][x, y] -
4*x^5*y*Derivative[1, 1][f][x, y] - 4*x^3*y^3*Derivative[1, 1][f][x, y] -
2*x*y^5*Derivative[1, 1][f][x, y] + 4*x^6*Derivative[2, 0][f][x, y] +
6*x^4*y^2*Derivative[2, 0][f][x, y] + 4*x^2*y^4*Derivative[2, 0][f][x, y] +
y^6*Derivative[2, 0][f][x, y]) *)
`

OTOH, even a two dimensional Riemannian geometry may require more than three dimensions to be embdedded in $$\mathbb{E}^n$$ (never mind a Lorentzian geometry, which clearly can't be embedded in Euclidean space). So I don't think there is any automatic "create visualization" algorithm. There certainly isn't a built-in Mathematica function for it.

• Sorry for the delay, I kinda forgot about this for a week or so and then asked my Geometry Professor about it. He explained a bit more to me about Riemann curvature, measures, and Christoffel symbols; and I've done a bit more of my own googling into covariant derivatives and so on, so you answer makes more sense to me now. Thanks for you input! I'll try some things out in mathematica the next chance I get. Though I suppose my immediate follow-up question would be about whether there's a way to calculate the curvature, or if there might still be a way to "plot out" a surface using it's metric? – W I Barton Nov 30 '19 at 0:17