# Parabola

## Setup

The first thing we'll do is create a file containing the system describing the curve we want to decompose.

Since tropical geometric objects intersect the hyperplane at $$\infty$$, we need to be able to compute points in this hyperplane. That's right, we'll compute points at $$\infty$$! The tool we'll use is projectivization, a method of compactification which identifies all points on the same line as being the same point. This is accomplished by introducing a new variable to the system, called the homogenizing variable. We typically call it $$h$$.

For our parabola, the starting system looks like
$$y = x^2-1,$$
but we phrase problems in terms of a system vanishing, so we rewrite it as
$$-y+ x^2-1=0.$$
Now we homogenize. Every term (summand) in the system must have the same degree. The term $$y$$ has degree 1, $$x^2$$ has degree 2, and $$1$$ has degree 0. The max is 2. Hence, each term needs to have degree 2. We increase degree by multiplying by the new homogenizing variable $$h$$. Hence, the system becomes
$$h y + x^2 - h^2$$
But now there are three variables and a single constraint, so it looks like a dimension-two object, whereas the parabola we started with was of dimension one.

The second part of projectivization is to introduce an affine patch. It picks out a single point on each line which is identified in projective space. We'll choose a random patch,
$$p_h h + p_x x + p_y y -1 = 0.$$

Finally we are ready to write the Bertini input file to be used to decompose the curve.
Note the top portion, bracketed by CONFIG and END;. Bertini 1 passes its configuration via a config section at the top of the input file. We will be working with positive-dimensional varieties, so we indicate to Bertini to generate a set of witness sets by passing tracktype: 1;.

## Running

Now that we have our system set up in a Bertini input file, we will go through the steps to do the tropical decomposition.

### NID

The input for the tropical decomposition includes the witness set for the component to be decomposed. Hence, we need to generate that witness set. The Numerical Irreducible Decomposition (NID) contains that witness set, and the algorithm for computing it is accessed by using tracktype:1;.

All we need to do is call Bertini, assuming the input file is simply called 'input'. Hence, move to the folder containing the input file (which you should name something corresponding to the system, such as 'parabola'). This can be done either in a terminal, or in Matlab.

Then call Bertini. Let it run, for this system, it should complete very quickly, like less than one second. My output looks like this:
The most important part is the last bit, where it tells us we have a single dimension 1 classified component, of degree 2. Briefly, this means that a random complex intersection with this component will yield two points. Indeed, the witness set contains two points.

The output from Bertini is the 'witness data' file, contained in the working folder.

### Tropical Decomposition - $$\mathbb{C}$$

Now that we have the NID in 'witness_data', we can compute the tropical decomposition of the component.

To do so, we simply create a 'tropical_curve' object in Matlab. The constructor for this class, provided in this code, performs the decomposition. There are options you can pass in, such as whether you want the complex or real curve, and several numerical tolerances.

For now, let's stick to default mode, which does the decomposition of the complex curve. Here's what I get on my machine:
There's a lot going on in that output. Beyond that, a folder has been made in the current directory, containing the data for the run, and the tropical curve you made was automatically saved to a time-stamped .mat file. I just got:
• a folder called parabola_complex_tropical_decomposition
• a file called tropdecomp_parabola_complex_1601261210.mat.
The parabola part of these names is determined by the name of the working folder. The time stamp is evident.

The rays and multiplicities are the most important part of the tropical curve. If you look at the output, you can see that the object 'T' that we just made
• is not real
• is homogenized
• has some rays
• has some multiplicities
• and has a bunch of other data, including 'aux_data'.
To look at the rays, just call the name of the field in Matlab: 'T.rays'.
One thing to notice is that there are too many coordinates in some sense. Well, we homogenized, first thing. We introduced a new variable, $$h$$, and it appears at the front of the variable ordering. Let's de-homogenize. I built the call into Matlab:
Since tropical_curves are implemented as handle classes in Matlab, the call T.dehomogenize modifies T. It does not produce a new copy of T which is dehomogenized, but rather T itself changes. This is ok, the tropical curve automatically saved, so you can just re-load it from disk if you feel like you screwed something up.

Now let's look at the rays, and their multiplicities, without the 'extra' homogenizing variable mucking things up.
Sure enough, the rays are as expected. Columns in the matrix represent the rays. Ok, so we have rays and multiplicities, but do they balance? Ray-multiplicity structure balances for tropical curves, in the sense that they sum to 0, if you multiply each ray by its multiplicity, and add them all up for all rays, you should get 0. If not, then an error certainly occurred. Let's check.
They balanced! The curve was decomposed correctly.

### Tropical Decomposition - $$\mathbb{R}$$

We have successfully decomposed the parabola's complex curve. What about what we usually think of as a parabola, the real curve? The code I provide can compute real tropicalizations, too! It starts from the point of a complete NID, just as the $$\mathbb{C}$$ does. So we just call T = tropical_curve('real') and let the algorithm go.
The data automatically saves, and the bread crumbs from the Bertini runs are preserved in their own folder, similarly to the complex case.

Real tropical curves can be arranged according to how the curve crosses the hyperplane, something which can't be done for complex curves. The command 'arrange' for tropical real curves in Matlab will render the rays in space for me. First, let's dehomogenize, then call arrange
Ok, the code is letting me know that the command 'labelText' will allow for re-sizing of the fonts in the image. Whatever. For now let's just save it to disk, and put it here on this website.