M1 - First Metric
Welcome to Warp Factory!
In this example, we'll learn the basics of metrics.
First metric
gridSize = [1 10 10 10];
gridScaling = [1 1 1 1];
Check out the properties of the metric struct
fieldnames(MyFirstMetric)
MyFirstMetric.type
This one is simple. The .type
property of this tensor is "metric". This identifies this tensor object as a metric.
MyFirstMetric.type
MyFirstMetric.index
This property specifies what form the tensor is in. A metric tensor index can either be "covariant" ( ) or "contravariant" ( ).
MyFirstMetric.index
MyFirstMetric.tensor
The 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.
MyFirstMetric.tensor
Let's take a look at the tensor values for a slice of the space.
for i = 1:4
for j = 1:4
nexttile
surfq(MyFirstMetric.tensor{i,j}(1,:,:,1))
end
end
Just as expected for Minkowski space! ( for all points in the slice)
Other Properties
.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'.
MyFirstMetric.name
MyFirstMetric.date
MyFirstMetric.scaling
MyFirstMetric.coords
Last updated