NAG Library Manual, Mark 28.4
```/* C05QB_T1W_F C++ Header Example Program.
*
* Copyright 2022 Numerical Algorithms Group.
* Mark 28.4, 2022.
*/

#include <dco.hpp>
#include <iostream>
#include <math.h>
#include <nag.h>
#include <nagx02.h>
#include <nagx04.h>
#include <stdio.h>
#include <string>
using namespace std;

int main()
{
// Scalars
int           exit_status = 0;
const Integer n           = 7;

cout << "C05QB_T1W_F C++ Header Example Program Results\n\n";

// problem parameters and starting value

ruser[0] = -1.0;
ruser[1] = 3.0;
ruser[2] = -2.0;
ruser[3] = -2.0;
ruser[4] = -1.0;

for (int i = 0; i < n; ++i)
{
x[i] = -1.0;
}

// Create AD configuration data object
Integer           ifail = 0;

double            dr[5 * n];

xtol = sqrt(X02AJC);
const Integer &         n,
Integer &               iflag)
{
if (iflag != 0)
{
for (int i = 0; i < n; ++i)
{
fvec[i] = (ruser[1] + ruser[2] * x[i]) * x[i] - ruser[4];
}
for (int i = 1; i < n; ++i)
{
fvec[i] = fvec[i] + ruser[0] * x[i - 1];
}
for (int i = 0; i < n - 1; ++i)
{
fvec[i] = fvec[i] + ruser[3] * x[i + 1];
}
}
iflag = 0;
};

for (int i = 0; i < 5; ++i)
{
for (int j = 0; j < n; ++j)
{
x[j] = -1.0;
}

dco::derivative(ruser[i]) = 0.5;

ifail = 0;

for (int j = 0; j < n; ++j)
{
dr[i * n + j] = 2. * dco::derivative(x[j]);
}

dco::derivative(ruser[i]) = 0.;
}

cout.setf(ios::scientific, ios::floatfield);
cout.precision(4);
cout << "           Solution:\n";
for (int i = 0; i < n; ++i)
{
cout.width(10);
cout << i + 1;
cout.width(20);
cout << dco::value(x[i]) << endl;
}

cout << "\n Derivatives calculated: First order tangents\n";
cout << " Computational mode    : algorithmic\n";
cout << "\n Derivatives are of solution w.r.t function params\n\n";

NagError fail;
INIT_FAIL(fail);
x04cac(Nag_ColMajor, Nag_GeneralMatrix, Nag_NonUnitDiag, n, 5, dr, n,
"    dx/druser", 0, &fail);

return exit_status;
}
```