我正在尝试定义一个函数,要求我使用“关联拉盖尔多项式”。已列出here图书馆下。在 Visual Studio 代码中,智能感知将“assoc_laguerre()”预测为函数,因此它显然存在!
然而,在构建代码时,它会突出显示 assoc_laguerre() 函数并显示消息:“找不到标识符”。
任何帮助将不胜感激! 谢谢!
代码:
#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 << " ";
}
}
最佳答案
您未在启用 C++ 2017 版本语言标准的情况下进行编译。启用它,这应该是可用的。您的代码使用 GCC 10.1 和 -std=c++17
进行编译;但如果我们使用 -std=c++14
则不然。
关于c++ - 如何在C++中调用cmath库中的特殊函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62625150/