Boost logo

Boost :

From: Gary.Stevens_at_[hidden]
Date: 2008-06-12 11:07:31


I did add the include statement. Please find attached the sample code.
Thank you.

#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <boost/math/special_functions/erf.hpp>

using namespace std;
int main()
{
// declare input and calculated variables
float C;
float W;
float H;
float V;
float Y1;
float Y2;
float Z1;
float Z2;
float DX;
float DY;
float DZ;
float DK;
float X;
float Y;
float Z;
float T;
float Max;
float CN;
long double ETA;
long double PN;
long double OM;
long double LM;
long double ZETA;
long double ALPHA;
long double BETA;
long double BETAT;
long double COSSZ;
long double COSRY;
long double RTDXT;
long double A1;
long double B1;
long double A2;
long double B2;
long double C1;
long double C2;
long double TERM1;
long double SIGMAN;
long double SIGMAM;
long double SUBTN;
const double PI = 3.14159265358979;

// Concentrations are specified for boundary conditions
if (Y==0 && Y == Y1 || Y == Y2)
{
   if (Z > Z1 && Z < Z2)
         CN = 0.50;
   else (Z == Z1 || Z == Z2);
         CN = 0.25;
}
else;
if (Z == Z1 || Z == Z2)
{
   if (Y > Y1 && Y < Y2)
         CN = 0.50;
   else ;
}
else;

if (Y > Y1 && Y < Y2 && Z >Z1 && Z<Z2)
         CN = 1.0;
else;

// Begin summation of infinite outer series
 SIGMAM = 0;
 
    for (int x = 0; x <= Max; x++ )
    {
           ZETA = x*PI/H;
           if (x==0)
               OM = (Z2-Z1)/H;
           else
               OM = (sin(ZETA*Z2)-sin(ZETA*Z1))/(x*PI);
         COSSZ=cos(ZETA*Z);
       // Begin summation of infinite inner series
        SIGMAN = 0;
        SUBTN = 0;
            for (int y = 0; y <= Max; y++ )
            {
            ETA = y*PI/W;
                  if (y==0)
                      PN = (Y2-Y1)/W;
                  else
                      PN = (sin(ETA*Y2)-sin(ETA*Y1))/(y*PI);
            COSRY=cos(ETA*Y);
            ALPHA = 4.0*DX*(ETA*ETA*DY+ZETA*ZETA*DZ+DK);
            BETA = sqrt(V*V+ALPHA);
            BETAT=BETA*T;
            RTDXT=2.0*sqrt(DX*T);
            //Compute TERM1 and SIGMAN
            A1 = exp(X*(V-BETA)/(2.0*DX));
            B1 =erfc((X-BETAT)/RTDXT);
            A2= exp(X*(V+BETA)/(2.0*DX));
            B2=erfc((X+BETAT)/RTDXT);
            TERM1 = COSRY*PN*((A1*B1)+(A2*B2));
                  if ((x==0) && (y==0))
                     TERM1 = TERM1*0.5;
                  else if((x>0) && (y>0))
                     TERM1 = TERM1*2;
                  else
                     TERM1 = TERM1;
             SIGMAN = SIGMAN+TERM1;
             // Check for convergence of inner series due to
oscillations
             // Check subtotal of last 10 terms
                 {
                 if(y % 10 != 0)
                      continue;
                    {
                    if (fabs(SUBTN) < 1.0E-12)
                      goto leave_innerloop;
                    }
                 SUBTN = 0.0;
                 }
            
             // End of infinite inner series
            }
       leave_innerloop:
       SIGMAM=SIGMAM+SIGMAN*COSSZ*OM;
       // End of infinite outer series
    }
}

-----Original Message-----
From: boost-bounces_at_[hidden]
[mailto:boost-bounces_at_[hidden]] On Behalf Of John Maddock
Sent: Thursday, June 12, 2008 6:04 AM
To: boost_at_[hidden]
Subject: Re: [boost] erfc id not found

Gary.Stevens_at_[hidden] wrote:
> I have been trying to compile code that uses the erfc function. I can
> get it to build successfully using DevC++4.9.9.2, but cannot using
> Win-Visual C++2005 Express (C90 standard) which I have been using to
> construct a form for input-output. I have downloaded the boost
> libraries
> and have changed the configuration properties to include the boost
> directory and changed to Not Using Precompiled Headers. I continue to
> receive the following: 'erfc': identifier not found. I have tried
> adding
> the libraies for DevC++4.9.9.2 but receive the same error. I am new to
> C++ and this a small simple program but am spending a significant
> amount
> of time getting the erfc issue resolved. Any help would be very
> appreciated. Thank you.

We would need to see the sample code to understand what you're doing
wrong,
but are you including <boost/math/special_functions/erf.hpp> ?

HTH, John.

_______________________________________________
Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk