Felix Hunter
Felix Hunter

Reputation: 23

How to called special functions in the cmath library in C++?

I am trying to define a function that requires me to make use of something called an "Associated Laguerre Polynomial". It's listed here under the library. In visual studio code, intellisense predicts "assoc_laguerre()" as a function so it clearly exists!

Yet, when building the code, it highlights the assoc_laguerre() function with the message: "Identifier not found".

Any help would be very appreciated! Thanks!

Code:

#include <iostream>
#include <vector>
#include <string>
#include<vector>
#include<fstream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<time.h>
#define __STDCPP_WANT_MATH_SPEC_FUNCS__ 1
#include<math.h>
#include <stdio.h>
#include <cmath>
using namespace std;

//Function Definitons:
double a = 5.29177210903*pow(10,-11);
// Normalised Radial Component:
double Radial(double r,int n,int l,int Z){
    double rho, prefactor,R,L,M;
    rho = 2*r*Z/(n*a);
    R=pow(pow(rho/r,3)*tgamma(n-l)/(2*n*tgamma(n+l+1)),0.5)*exp(-rho/2)*pow(rho,l);
    L=R*assoc_laguerre(n-l-1,2*l+1,rho);

    M=L*R;
    return M;



}
int main()
{
    vector<string> msg {"End Process."};

    for (const string& word : msg)
    {
        cout << word << " ";
    }
  
}

Upvotes: 2

Views: 315

Answers (1)

einpoklum
einpoklum

Reputation: 131395

You're not compiling with the C++ 2017 version of the language standard enabled. Enable it, and this should be available. Your code compiles with GCC 10.1 and -std=c++17; but not if we use -std=c++14 instead.

GodBolt

Upvotes: 3

Related Questions