# Introduction

The absorption coefficient in the case of Doppler broadening is directly proportional to the Voigt function. It is assumed the plasma is characterized by a kinetic temperature and that the velocity distribution is Maxwellian. The absorption profile is restricted to an intrinsic Lorentzian profile.

# Building the Sample

This project should build as is using Visual Studio 2008.

Description

This application computes and graphs the Voigt function H(a, v) which is proportional to a modified Gaussian function multiplied by cos(vx) and integrated over x = 0 to x = infinity. In the plasmas found in stellar atmospheres the parameter a is usually much less than 1, however, we do not use that approximation in this program. The parameter v is proportional to the frequency minus the line's frequency all divided by the Doppler width of the line.

C#
Edit|Remove
```using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VoigtFunction
{
class Integration
{
public double TrapezoidalRule(int n, double a, double b, Func<double, double> f)
{
double h = (b - a) / n;
double s = 0.5 * (f(a) + f(b));
double x = a + h;

for (int i = 1; i < n; i++)
{
s += f(x);
x += h;
}

return h * s;
}

public double SimpsonsRule(int n, double a, double b, Func<double, double> f)
{
double h = (b - a) / n;
double h2 = 2.0 * h;
double s = 0.0;
double t = 0.0;
double x = a + h;

for (int i = 1; i < n; i += 2)
{
s += f(x);
x += h2;
}

x = a + h2;

for (int i = 2; i < n; i += 2)
{
t += f(x);
x += h2;
}

return h * (f(a) + 4 * s + 2 * t + f(b)) / 3.0;
}

public void GenerateGaussianLegendreAbscissasAndWeights(int n, double[] x, double[] w)
{
OrthogonalPolynomials op = new OrthogonalPolynomials();
List<double> roots = new List<double>();
Zeros zeros = new Zeros("Legendre", 0.0, 0.0, n, ref roots);

for (int i = 0; i < n; i++)
{
double xi = roots[i];
double fd = op.g("Legendre", xi, n);
double x2 = 1.0 - xi * xi;

x[i] = xi;
w[i] = 2.0 / (x2 * fd * fd);
}
}

public double GLIntegrate11(int n, double[] x, double[] w, Func<double, double> f)
{
double sum = 0.0;

for (int i = 0; i < n; i++)
sum += w[i] * f(x[i]);

return sum;
}

public double GLIntegrateAB(int n, double a, double b,
double[] x, double[] w, Func<double, double> f)
{
double c = (b - a) / 2.0;
double d = (b + a) / 2.0;
double sum = 0.0;

for (int i = 0; i < n; i++)
sum += w[i] * f(c * x[i] + d);

return c * sum;
}
}
}```

# Source Code Files

• DrawGraphForm.cs - plots the Voigt function H(a,v) as a function of v.
• Integration.cs - integration functions wrapper class.
• MainForm.cs - the main form of the application for the single parameter input.
• OrthogonalPolynomials.cs - needed for Gaussian-Legendre quadrature
• Program.cs - Visual Studio 2008 generated program class.
• Zeros.cs - determines the zeros of orthogonal polynomials.