# M1 - First Metric

## Welcome to Warp Factory!

In this example, we'll learn the basics of metrics.

## First metric&#x20;

<pre class="language-matlab" data-line-numbers><code class="lang-matlab">gridSize = [1 10 10 10];
gridScaling = [1 1 1 1];
<a data-footnote-ref href="#user-content-fn-1">MyFirstMetric = metricGet_Minkowski(gridSize, gridScaling);</a>
</code></pre>

Check out the properties of the metric struct&#x20;

{% code lineNumbers="true" %}

```matlab
fieldnames(MyFirstMetric)
```

{% endcode %}

## MyFirstMetric.type

This one is simple. The `.type` property of this tensor is "metric". This identifies this tensor object as a metric.

{% code lineNumbers="true" %}

```matlab
MyFirstMetric.type
```

{% endcode %}

## MyFirstMetric.index

This property specifies what form the tensor is in. A metric tensor index can either be "covariant" ( $$g\_{\mu\nu}$$ ) or "contravariant" ( $$g^{\mu\nu}$$ ).

<pre data-line-numbers><code><strong>MyFirstMetric.index
</strong></code></pre>

## 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.

{% code lineNumbers="true" %}

```matlab
MyFirstMetric.tensor
```

{% endcode %}

Let's take a look at the tensor values for a slice of the space.

{% code lineNumbers="true" %}

```matlab
for i = 1:4
    for j = 1:4
        nexttile
        surfq(MyFirstMetric.tensor{i,j}(1,:,:,1))
    end
end
```

{% endcode %}

Just as expected for Minkowski space! ( $$g\_{\mu\nu} = \eta\_{\mu\nu}$$ for all points in the slice)

## Other Properties

`.name` - Your metric has a name!&#x20;

`.date` - Your metric stores a date when it is made.&#x20;

`.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.&#x20;

`.coords` - The coordinate system associated with the metric. 'cartesian'.

{% code lineNumbers="true" %}

```
MyFirstMetric.name
MyFirstMetric.date
MyFirstMetric.scaling
MyFirstMetric.coords
```

{% endcode %}

[^1]:


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://applied-physics.gitbook.io/warp-factory/examples/metrics/m1-first-metric.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
