/* C05AY_P0W_F C++ Header Example Program.
*
* Copyright 2019 Numerical Algorithms Group.
* Mark 27, 2019.
*/
#include <nag.h>
#include <nagad.h>
#include <stdio.h>
#include <math.h>
#include <nagx07.h>
#include <iostream>
#include <string>
using namespace std;
extern "C"
{
static void (NAG_CALL f)(void* &ad_handle,
const double &x,
double &z,
Integer iuser[],
double ruser[]);
}
int main (void)
{
int exit_status = 0;
cout << "C05AY_P0W_F C++ Header Example Program Results\n\n";
// Skip first line of data file
string mystr;
getline (cin, mystr);
// Read problem parameters
double a, b, eps, eta, ruser[1];
cin >> a;
cin >> b;
cin >> eps;
cin >> eta;
cin >> ruser[0];
// Call P0W routine
double x;
Integer iuser[1];
iuser[0] = 0;
Integer ifail = 0;
void *ad_handle=0;
c05ay_p0w_f_(ad_handle,a,b,eps,eta,f,x,iuser,ruser,ifail);
cout.setf(ios::scientific,ios::floatfield);
cout.precision(5);
cout << " Solution, x = " << x << endl;
return exit_status;
}
static void (NAG_CALL f)(void* &ad_handle,
const double &x,
double &z,
Integer iuser[],
double ruser[])
{
z = exp(-x) - x*ruser[0];
return;
}