c++ - 如何在 C++ 中调用 cmath 库中的特殊函数?
问题描述
我正在尝试定义一个函数,该函数需要我使用称为“关联拉盖尔多项式”的东西。它在图书馆下面列出。在 Visual Studio 代码中,intellisense 将“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
而不是。
推荐阅读
- php - api 提供者仪表板显示来自 curl 的重复调用(curl 重复请求)
- django - 如何排除 Django 中的字段?
- django - CSS文件不会加载 - Django
- sublimetext3 - 告诉 Sublime Text 3 始终默认为“自动换行列:自动”?
- javascript - MongoDB Stitch JWT 自定义身份验证:需要有效的 UID(介于 1 到 128 个字符之间)
- amazon-web-services - EC2 AWS 服务器上的网络错误 (tcp_error)
- javascript - 如何将分隔文本转换为 JSON
- python - 如何在 python 中将父类的实例转换为其子类之一?
- mysql - 尝试找到一种方法将极大的索引放入内存
- java - 用于 NativeQuery 的 Spring JPA 长 SQL 字符串