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

📄 test.c

📁 该文件为c++的数学函数库!是一个非常有用的编程工具.它含有各种数学函数,为科学计算、工程应用等程序编写提供方便!
💻 C
📖 第 1 页 / 共 5 页
字号:
    gsl_function f = make_function(&f15, &alpha);    gsl_function fc = make_counter(&f, &p) ;    status = gsl_integration_qagiu (&fc, 0.0, 0.0, 1.0e-7, w->limit,                                    w,                                     &result, &abserr) ;        gsl_test_rel(result,exp_result,1e-14,"qagiu(f15) smooth result") ;    gsl_test_rel(abserr,exp_abserr,1e-5,"qagiu(f15) smooth abserr") ;    gsl_test_int((int)(p.neval),exp_neval,"qagiu(f15) smooth neval") ;      gsl_test_int((int)(w->size),exp_last,"qagiu(f15) smooth last") ;      gsl_test_int(status,exp_ier,"qagiu(f15) smooth status") ;    for (i = 0; i < 10 ; i++)         gsl_test_rel(w->alist[i],a[i],1e-15,"qagiu(f15) smooth alist") ;    for (i = 0; i < 10 ; i++)         gsl_test_rel(w->blist[i],b[i],1e-15,"qagiu(f15) smooth blist") ;    for (i = 0; i < 10 ; i++)         gsl_test_rel(w->rlist[i],r[i],1e-15,"qagiu(f15) smooth rlist") ;    for (i = 0; i < 10 ; i++)         gsl_test_rel(w->elist[i],e[i],1e-4,"qagiu(f15) smooth elist") ;    for (i = 0; i < 10 ; i++)         gsl_test_int((int)w->order[i],order[i]-1,"qagiu(f15) smooth order");    gsl_integration_workspace_free (w) ;  }  /* Test infinite range integral f16 using an absolute error bound */  {    int status = 0, i; struct counter_params p;    double result = 0, abserr=0;    gsl_integration_workspace * w = gsl_integration_workspace_alloc (1000) ;    /* All results are for GSL_IEEE_MODE=double-precision */    double exp_result = 1.000000000006713292E-04;    double exp_abserr = 3.084062020905636316E-09;    int exp_neval  =      165;    int exp_ier    =        0;    int exp_last   =        6;    double a[6] = { 0.000000000000000000E+00,                    5.000000000000000000E-01,                    2.500000000000000000E-01,                    1.250000000000000000E-01,                    6.250000000000000000E-02,                    3.125000000000000000E-02 } ;    double b[6] = { 3.125000000000000000E-02,                    1.000000000000000000E+00,                    5.000000000000000000E-01,                    2.500000000000000000E-01,                    1.250000000000000000E-01,                    6.250000000000000000E-02 } ;    double r[6] = { 7.633587786326674618E-05,                    9.900990099009899620E-07,                    1.922522349322310737E-06,                    3.629434715543053753E-06,                    6.501422186103209199E-06,                    1.062064387653501389E-05 } ;    double e[6] = { 3.084061858351569051E-09,                    3.112064814755089674E-17,                    4.543453652226561245E-17,                    4.908618166361344548E-17,                    3.014338672269481784E-17,                    6.795996738013555461E-18 } ;    int order[6] = { 1, 4, 3, 2, 5, 6 } ;    double alpha = 1.0;    gsl_function f = make_function(&f16, &alpha);    gsl_function fc = make_counter(&f, &p) ;    status = gsl_integration_qagiu (&fc, 99.9, 1.0e-7, 0.0, w->limit,                                    w,                                     &result, &abserr) ;        gsl_test_rel(result,exp_result,1e-14,"qagiu(f16) smooth result") ;    gsl_test_rel(abserr,exp_abserr,1e-5,"qagiu(f16) smooth abserr") ;    gsl_test_int((int)(p.neval),exp_neval,"qagiu(f16) smooth neval") ;      gsl_test_int((int)(w->size),exp_last,"qagiu(f16) smooth last") ;      gsl_test_int(status,exp_ier,"qagiu(f16) smooth status") ;    for (i = 0; i < 6 ; i++)         gsl_test_rel(w->alist[i],a[i],1e-15,"qagiu(f16) smooth alist") ;    for (i = 0; i < 6 ; i++)         gsl_test_rel(w->blist[i],b[i],1e-15,"qagiu(f16) smooth blist") ;    for (i = 0; i < 6 ; i++)         gsl_test_rel(w->rlist[i],r[i],1e-15,"qagiu(f16) smooth rlist") ;    for (i = 0; i < 6 ; i++)         gsl_test_rel(w->elist[i],e[i],1e-4,"qagiu(f16) smooth elist") ;    for (i = 0; i < 6 ; i++)         gsl_test_int((int)w->order[i],order[i]-1,"qagiu(f16) smooth order");    gsl_integration_workspace_free (w) ;  }  /* Test infinite range integral myfn1 using an absolute error bound */  {    int status = 0, i; struct counter_params p;    double result = 0, abserr=0;    gsl_integration_workspace * w = gsl_integration_workspace_alloc (1000) ;    /* All results are for GSL_IEEE_MODE=double-precision */    double exp_result = 2.275875794468747770E+00;    double exp_abserr = 7.436490118267390744E-09;    int exp_neval  =      270;    int exp_ier    =        0;    int exp_last   =        5;    double a[5] = { 1.250000000000000000E-01,                    5.000000000000000000E-01,                    2.500000000000000000E-01,                    0.000000000000000000E+00,                    3.750000000000000000E-01 } ;    double b[5] = { 2.500000000000000000E-01,                    1.000000000000000000E+00,                    3.750000000000000000E-01,                    1.250000000000000000E-01,                    5.000000000000000000E-01 } ;    double r[5] = { 4.639317228058405717E-04,                    1.691664195356748834E+00,                    1.146307471900291086E-01,                    4.379392477350953574E-20,                    4.691169201991640669E-01 } ;    double e[5] = { 3.169263960393051137E-09,                    4.265988974874425043E-09,                    1.231954072964969637E-12,                    8.360902986775307673E-20,                    5.208244060463541433E-15 } ;    int order[5] = { 2, 1, 3, 5, 4 } ;    gsl_function f = make_function(&myfn1, 0);    gsl_function fc = make_counter(&f, &p) ;    status = gsl_integration_qagi (&fc, 1.0e-7, 0.0, w->limit,                                   w,                                    &result, &abserr) ;        gsl_test_rel(result,exp_result,1e-14,"qagiu(myfn1) smooth result") ;    gsl_test_rel(abserr,exp_abserr,1e-5,"qagiu(myfn1) smooth abserr") ;    gsl_test_int((int)(p.neval),exp_neval,"qagiu(myfn1) smooth neval") ;      gsl_test_int((int)(w->size),exp_last,"qagiu(myfn1) smooth last") ;      gsl_test_int(status,exp_ier,"qagiu(myfn1) smooth status") ;    for (i = 0; i < 5 ; i++)         gsl_test_rel(w->alist[i],a[i],1e-15,"qagiu(myfn1) smooth alist") ;    for (i = 0; i < 5 ; i++)         gsl_test_rel(w->blist[i],b[i],1e-15,"qagiu(myfn1) smooth blist") ;    for (i = 0; i < 5 ; i++)         gsl_test_rel(w->rlist[i],r[i],1e-14,"qagiu(myfn1) smooth rlist") ;    for (i = 0; i < 5 ; i++)         gsl_test_rel(w->elist[i],e[i],1e-4,"qagiu(myfn1) smooth elist") ;    for (i = 0; i < 5 ; i++)         gsl_test_int((int)w->order[i],order[i]-1,"qagiu(myfn1) smooth order");    gsl_integration_workspace_free (w) ;  }  /* Test infinite range integral myfn1 using an absolute error bound */  {    int status = 0, i; struct counter_params p;    double result = 0, abserr=0;    gsl_integration_workspace * w = gsl_integration_workspace_alloc (1000) ;    /* All results are for GSL_IEEE_MODE=double-precision */    double exp_result = 2.718281828459044647E+00;    double exp_abserr = 1.588185109253204805E-10;    int exp_neval  =      135;    int exp_ier    =        0;    int exp_last   =        5;    double a[5] = { 0.000000000000000000E+00,                    5.000000000000000000E-01,                    2.500000000000000000E-01,                    1.250000000000000000E-01,                    6.250000000000000000E-02 } ;    double b[5] = { 6.250000000000000000E-02,                    1.000000000000000000E+00,                    5.000000000000000000E-01,                    2.500000000000000000E-01,                    1.250000000000000000E-01 } ;    double r[5] = { 8.315287189746029816E-07,                    1.718281828459045091E+00,                    8.646647167633871867E-01,                    1.328565310599463256E-01,                    2.477920647947255521E-03 } ;    double e[5] = { 1.533437090413525935E-10,                    4.117868247943567505E-12,                    7.802455785301941044E-13,                    5.395586026138397182E-13,                    3.713312434866150125E-14 } ;    int order[5] = { 1, 2, 3, 4, 5 } ;    double alpha = 1.0 ;    gsl_function f = make_function(&myfn2, &alpha);    gsl_function fc = make_counter(&f, &p) ;    status = gsl_integration_qagil (&fc, 1.0, 1.0e-7, 0.0, w->limit,                                    w,                                     &result, &abserr) ;        gsl_test_rel(result,exp_result,1e-14,"qagiu(myfn2) smooth result") ;    gsl_test_rel(abserr,exp_abserr,1e-5,"qagiu(myfn2) smooth abserr") ;    gsl_test_int((int)(p.neval),exp_neval,"qagiu(myfn2) smooth neval") ;      gsl_test_int((int)(w->size),exp_last,"qagiu(myfn2) smooth last") ;      gsl_test_int(status,exp_ier,"qagiu(myfn2) smooth status") ;    for (i = 0; i < 5 ; i++)         gsl_test_rel(w->alist[i],a[i],1e-15,"qagiu(myfn2) smooth alist") ;    for (i = 0; i < 5 ; i++)         gsl_test_rel(w->blist[i],b[i],1e-15,"qagiu(myfn2) smooth blist") ;    for (i = 0; i < 5 ; i++)         gsl_test_rel(w->rlist[i],r[i],1e-14,"qagiu(myfn2) smooth rlist") ;    for (i = 0; i < 5 ; i++)         gsl_test_rel(w->elist[i],e[i],1e-4,"qagiu(myfn2) smooth elist") ;    for (i = 0; i < 5 ; i++)         gsl_test_int((int)w->order[i],order[i]-1,"qagiu(myfn2) smooth order");    gsl_integration_workspace_free (w) ;  }  /* Test integral f454 with integrable singular points */  {    int status = 0, i; struct counter_params p;    double result = 0, abserr=0;    gsl_integration_workspace * w = gsl_integration_workspace_alloc (1000) ;    /* All results are for GSL_IEEE_MODE=double-precision */    double exp_result = 5.274080611672716401E+01;    double exp_abserr = 1.755703848687062418E-04;    int exp_neval  =        777;    int exp_ier    =          0;    int exp_last   =         20;    double a[20] = { 9.687500000000000000E-01,                    1.401269388548935790E+00,                    1.414213562373095145E+00,                    1.000000000000000000E+00,                    0.000000000000000000E+00,                    2.207106781186547462E+00,                    1.810660171779821415E+00,                    1.207106781186547462E+00,                    5.000000000000000000E-01,                    1.103553390593273731E+00,                    1.612436867076458391E+00,                    1.310660171779821415E+00,                    7.500000000000000000E-01,                    1.051776695296636976E+00,                    1.513325214724776657E+00,                    1.362436867076458391E+00,                    8.750000000000000000E-01,                    1.463769388548935790E+00,                    1.388325214724776657E+00,                    9.375000000000000000E-01} ;    double b[20] = { 1.000000000000000000E+00,                     1.414213562373095145E+00,                     1.463769388548935790E+00,                     1.051776695296636976E+00,                     5.000000000000000000E-01,                     3.000000000000000000E+00,                     2.207106781186547462E+00,                     1.310660171779821415E+00,                     7.500000000000000000E-01,                     1.207106781186547462E+00,                     1.810660171779821415E+00,                     1.362436867076458391E+00,                     8.750000000000000000E-01,                     1.103553390593273731E+00,                     1.612436867076458391E+00,                     1.388325214724776657E+00,                     9.375000000000000000E-01,                     1.513325214724776657E+00,                     1.401269388548935790E+00,                     9.687500000000000000E-01} ;    double r[20] = { -1.125078814079027711E-01,                     -1.565132123531515207E-01,                     -4.225328513207429193E-01,                     -1.830392049835374568E-01,                     6.575875041899758092E-03,                     4.873920540843067783E+01,                     6.032891565603589079E+00,                     -2.991531901645863023E-01,                     -7.326282608704996063E-03,                     -2.431894410706912923E-01,                     5.911661670635662835E-01,                     -2.236786562536174916E-01,                     -5.647871991778510847E-02,                     -1.305470403178642658E-01,                     -1.721363984401322045E-01,                     -1.5893454545

⌨️ 快捷键说明

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