TransWikia.com

tikz-3d/pgfplots: How to draw/plot curved spacetime?

TeX - LaTeX Asked by DaHaStacEx on June 6, 2021

Since I try to write a short introduction to tensors for physics students, I mentioned the Einstein’s field equations (as a motivation).
Therefore, I wanted to create a tikzpicture/pgfplots of curved spacetime.
First, I created a 3d plot that looks familiar with the most common picture of curved spacetime

documentclass[tikz]{standalone}
usepackage{pgfplots}
pgfplotsset{compat = newest}

begin{document}

begin{tikzpicture}
  begin{axis}[
    unit vector ratio*=1 1 1,
    hide axis = true,
    x domain = -1.5:1.5,
    zmin = -2.5,
    zmax = 2.5
    ]    
    addplot3 [
        surf, 
        faceted color = lightgray,
        fill = white, 
        line width = 0.1pt,
        samples = 50] {-1.5*exp(-0.5*(x^2+y^2))};

  end{axis}
end{tikzpicture}

end{document}

which gives me

enter image description here

But actually, this is not the best representation for curved spacetime, since this picture only shows the curvature in one direction (here, along the z-axis).
A much better visualization would be something
like this (YouTube Animation) or this.

I found that something like usepgfmodule{nonlineartransformations} might help here, but I am still a beginner when it comes to tikz/pgfplots.

Thank you in advance for all your answers!

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP