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

📄 xdf1dim.cpp

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

// Driver for routine df1dim

int ncom;   // defining declarations
DP (*nrfunc)(Vec_I_DP &);
Vec_DP *pcom_p,*xicom_p;
void (*nrdfun)(Vec_I_DP &, Vec_O_DP &);

void dfunc(Vec_I_DP &x, Vec_O_DP &df)
{
        int i;

        for (i=0;i<3;i++)
          df[i]=(x[i]-1.0)*(x[i]-1.0);
}

int main(void)
{
        const int NDIM=3;

        ncom=NDIM;
        pcom_p=new Vec_DP(ncom);
        xicom_p=new Vec_DP(ncom);
        Vec_DP &pcom=*pcom_p, &xicom=*xicom_p;
        nrdfun=dfunc;
        cout << endl << "Enter vector direction along which to" << endl;
        cout << "plot the function. Minimum is in the" << endl;
        cout << "direction 1.0 1.0 1.0 - enter x y z:" << endl << endl;
        pcom[0]=pcom[1]=pcom[2]=0.0;
        cin >> xicom[0] >> xicom[1] >> xicom[2];
        NR::scrsho(NR::df1dim);
        delete xicom_p;
        delete pcom_p;
        return 0;
}

⌨️ 快捷键说明

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