⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xbeschb.cpp

📁 这是数学计算上常用的计算方法
💻 CPP
字号:
#include <string>
#include <iostream>
#include <iomanip>
#include <cmath>
#include "nr.h"
using namespace std;

// Driver for routine beschb

int main(void)
{
        string txt;
        DP gam1,gam2,gampl,gammi,x,xgam1,xgam2,xgampl,xgammi;

        for (;;) {
          cout << "Enter x (magnitude < 0.5):" << endl;
          cin >> x;
          if ((x < -0.5) || (x > 0.5) || (x == 0.0)) break;
          NR::beschb(x,xgam1,xgam2,xgampl,xgammi);
          cout << setw(5) << "x" << endl;
          cout << setw(15) << "gam1" << setw(17) << "gam2";
          cout << setw(18) << "gampl" << setw(16) << "gammi" << endl;
          cout << setw(15) << "xgam1" << setw(17) << "xgam2";
          cout << setw(18) << "xgampl" << setw(16) << "xgammi" << endl;
          gampl=1.0/exp(NR::gammln(DP(1.0+x)));
          gammi=1.0/exp(NR::gammln(DP(1.0-x)));
          gam1=(gammi-gampl)/(2.0*x);
          gam2=(gammi+gampl)/2.0;
          cout << scientific << setprecision(2);
          cout << setw(5) << x << endl;
          cout << scientific << setprecision(6);
          cout << setw(16) << gam1 << setw(17) << gam2;
          cout << setw(17) << gampl << setw(17) << gammi << endl;
          cout << setw(16) << xgam1 << setw(17) << xgam2;
          cout << setw(17) << xgampl << setw(17) << xgammi << endl;
          cout << endl << endl;
        }
        return 0;
}

⌨️ 快捷键说明

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