private void TestDistribution(float T)
    {
        int           divs       = 10000;
        StringBuilder sb         = new StringBuilder();
        float         prev_value = 1f;
        float         next_value = 100f;

        for (int i = 0; i < divs; i++)
        {
            string[] output = new string[1];
            float    frac   = MaxwellBoltzmannSpeeds.ProbabilityLowerToUpper(prev_value, next_value, T, 4 * 1.67E-27f);
            //Debug.Log("Frac = " + frac);
            output[0] = frac.ToString("F6");
            data.Add(output);
            prev_value  = next_value;
            next_value += 10f;
        }

        for (int j = 0; j < divs; j++)
        {
            sb.AppendLine(string.Join(",", data[j]));
        }

        StreamWriter outStream = System.IO.File.CreateText("C:/Users/dpryd/Desktop/TESTDATA/" + "MaxBoltzDist" + T.ToString("F1") + ".csv");

        outStream.WriteLine(sb);
        outStream.Close();
    }
    //Plot the Maxwell-Boltzmann distribution. The x axis should be speed and the y axis the number of particles at that speed.
    private void PlotDistribution()
    {
        //Delete all the previous plotted points
        foreach (GameObject p in plotted_points)
        {
            GameObject.Destroy(p);
        }
        plotted_points.Clear();

        List <float[]> fractions = MaxwellBoltzmannSpeeds.Fractions(m, T, N, divs, vp);

        foreach (float[] data in fractions)
        {
            GameObject point          = Instantiate(data_point_prefab);
            Vector3    point_position = new Vector3(graph_origin.position.x + data[1] / 25f, graph_origin.position.y + data[0] * 10000f, graph_origin.position.z);
            point.transform.position = point_position;
            plotted_points.Add(point);
        }
    }
 private void CalculateAndSetSpeeds(float m, float T, int N, int divs, float vp)
 {
     particle_speeds = MaxwellBoltzmannSpeeds.Speeds(m, T, N, divs, vp);
     SetParticleSpeeds(N, vp);
     PlotDistribution();
 }