M1 - First Metric
Last updated
In this example, we'll learn the basics of metrics.
gridSize = [1 10 10 10];
gridScaling = [1 1 1 1];
MyFirstMetric = metricGet_Minkowski(gridSize, gridScaling);Check out the properties of the metric struct
fieldnames(MyFirstMetric)This one is simple. The .type property of this tensor is "metric". This identifies this tensor object as a metric.
MyFirstMetric.typeThis property specifies what form the tensor is in. A metric tensor index can either be "covariant" ( gμν ) or "contravariant" ( gμν ).
MyFirstMetric.indexThe tensor contains the values for metric at each point in space and time for each tensor component. The tensor object is a 4x4 cell array. Each cell contains an array of values for each point in spacetime. The size of this array is equal to the gridSize of your spacetime.
Let's take a look at the tensor values for a slice of the space.
Just as expected for Minkowski space! ( gμν=ημν for all points in the slice)
.name - Your metric has a name!
.date - Your metric stores a date when it is made.
.scaling - Your metric has scaling information about the coordinate grid step size in time and space. We'll get into this more in later examples.
.coords - The coordinate system associated with the metric. 'cartesian'.
Last updated
MyFirstMetric.tensorfor i = 1:4
for j = 1:4
nexttile
surfq(MyFirstMetric.tensor{i,j}(1,:,:,1))
end
endMyFirstMetric.name
MyFirstMetric.date
MyFirstMetric.scaling
MyFirstMetric.coords