advmath.cpp

来自「一个在linux下的shell的计算器」· C++ 代码 · 共 71 行

CPP
71
字号
/* * * * */#include <iostream>#include <cmath>#include "advmath.h"#include "interpreter.h"using namespace std;//////double sinc(double x){ return ((x == 0) ? 1.0 : sin(x)/x);}//////void LoadAdvMath(ItemList & list){ list.Add(new Operation(ERF, "erf", 1)); list.Add(new Operation(ERFC, "erfc", 1)); list.Add(new Operation(GAMMA, "gamma", 1)); list.Add(new Operation(SIGMOID, "sigmoid", 1)); list.Add(new Operation(J0, "j0", 1)); list.Add(new Operation(J1, "j1", 1)); list.Add(new Operation(Y0, "y0", 1)); list.Add(new Operation(Y1, "y1", 1)); list.Add(new Operation(SINC, "sinc", 1)); list.Add(new Operation(HYPOT, "hypot", 2)); list.Add(new Operation(JN, "jn", 2)); list.Add(new Operation(YN, "yn", 2)); // Alias list.Add(new Operation(J0, "bessel0", 1)); list.Add(new Operation(J1, "bessel1", 1)); list.Add(new Operation(Y0, "sbessel0", 1)); list.Add(new Operation(Y1, "sbessel1", 1)); list.Add(new Operation(JN, "bessel", 2)); list.Add(new Operation(YN, "sbessel", 2));}//////void AdvancedMathHelp(){ cout << endl << "Advanced Mathematical functions: " << endl << endl; cout << "  rand     Random number between 0 and 1." << endl; cout << "  hypot    Euclidean distance." << endl; cout << "  gamma    Gamma function." << endl; cout << "  erf      Error function." << endl; cout << "  erfc     Complementary erf." << endl; cout << "  sigmoid  Logistic (sigmoid) function." << endl; cout << "  j0       zero-order Bessel function, 1st kind." << endl; cout << "  j1       first-order Bessel function, 1st kind." << endl; cout << "  jn       nth-order Bessel function, 1st kind." << endl; cout << "  y0       zero-order Bessel function, 2nd kind." << endl; cout << "  y1       first-order Bessel function, 2nd kind." << endl; cout << "  yn       nth-order Bessel function, 2nd kind." << endl; cout << "  sinc     Sinc function." << endl;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?