2021 年高教社杯全国大学生数学建模竞赛 B题 乙醇偶合制备 C4 烯烃 求解思路2

2021 年高教社杯全国大学生数学建模竞赛 B题 乙醇偶合制备 C4 烯烃 求解思路2由附件1“性能数据表”中A1~A14(用装料方式I)整理得下表“sheet2”:wt%Co/SiO2 Co/SiO2和HAP的质量比 催化剂总量 乙醇浓度 温度 乙醇转化率(%) C4烯烃选择性(%) C4烯烃收率(%) 0.5 1 400 1.68 250 4.0 9.6 0.386665445 0.5 1 400 1.68 275 12.1 8.6 1….

2021

由附件1“性能数据表”中A1~A14(用装料方式I)整理得下表“sheet2”:

wt%Co/SiO2 Co/SiO2 和 HAP 的质量比 催化剂总量 乙醇浓度 温度 乙醇转化率(%) C4烯烃选择性(%) C4烯烃收率(%)
0.5 1 400 1.68 250 4.0  9.6  0.386665445
0.5 1 400 1.68 275 12.1  8.6  1.042826728
0.5 1 400 1.68 300 29.5  10.7  3.159887673
0.5 1 400 1.68 325 43.3  18.9  8.184209991
0.5 1 400 1.68 350 60.5  27.3  16.47764673
0.5 1 400 1.68 400 88.4  41.0  36.27781909
1 0.4925 100 1.68 250 2.5  1.9  0.047111815
1 0.4925 100 1.68 275 5.3  2.6  0.136038297
1 0.4925 100 1.68 300 10.2  3.6  0.366488509
1 0.4925 100 1.68 350 24.0  10.8  2.602654614
1 0.4925 100 1.68 400 53.6  22.3  11.95620228
1 0.5556  140 1.68 250 0.2  0.1  0.000227692
1 0.5556  140 1.68 275 0.5  1.0  0.00516312
1 0.5556  140 1.68 300 1.6  1.8  0.029257461
1 0.5556  140 1.68 350 8.2  4.4  0.357029779
1 0.5556  140 1.68 400 32.6  7.9  2.584664401
1 1 100 0.3 250 19.7  5.8  1.130236757
1 1 100 0.3 275 29.0  6.6  1.90534913
1 1 100 0.3 300 40.0  8.8  3.534617971
1 1 100 0.3 350 58.6  18.6  10.9239714
1 1 100 0.3 400 76.0  33.3  25.27911589
1 1 100 0.9 250 6.3  5.6  0.352760989
1 1 100 0.9 275 8.8  8.5  0.746485761
1 1 100 0.9 300 13.2  13.8  1.821344417
1 1 100 0.9 350 31.7  25.9  8.212479623
1 1 100 0.9 400 56.1  41.4  23.24340866
1 1 100 1.68 250 1.4  6.2  0.088953466
1 1 100 1.68 275 3.5  8.1  0.281711425
1 1 100 1.68 300 6.9  11.2  0.77579429
1 1 100 1.68 350 19.9  22.3  4.432477459
1 1 100 1.68 400 44.5  36.3  16.16619292
1 1 100 2.1 250 2.1  5.4  0.110870727
1 1 100 2.1 275 3.0  9.7  0.290648933
1 1 100 2.1 300 4.7  16.1  0.761401301
1 1 100 2.1 350 13.4  31.0  4.157107976
1 1 100 2.1 400 40.8  42.0  17.15112728
1 1 400 0.9 250 9.7  5.5  0.531815513
1 1 400 0.9 275 19.2  8.0  1.546649604
1 1 400 0.9 300 29.3  17.0  4.975464725
1 1 400 0.9 325 37.6  28.7  10.79274197
1 1 400 0.9 350 48.9  36.9  18.03330095
1 1 400 0.9 400 83.7  53.4  44.72805978
1 1 400 0.9 450 86.4  49.9  43.11844167
1 1 400 1.68 250 2.07  34.1  0.703871198
1 1 400 1.68 275 5.85  37.4  2.190299165
1 1 400 1.68 300 14.97  46.9  7.026397666
1 1 400 1.68 325 19.68  49.7  9.781635471
1 1 400 1.68 350 36.80  47.2  17.37376011
1 2.0303 100 1.68 250 1.3  5.2  0.069906624
1 2.0303 100 1.68 275 2.3  7.6  0.175675746
1 2.0303 100 1.68 300 4.1  12.7  0.518101314
1 2.0303 100 1.68 350 14.6  23.5  3.43425681
1 2.0303 100 1.68 400 40.0  27.9  11.17716077
2 1 400 0.3 250 14.8  2.0  0.289828794
2 1 400 0.3 275 12.4  6.7  0.826196719
2 1 400 0.3 300 20.8  10.1  2.105827939
2 1 400 0.3 325 28.3  13.9  3.929155582
2 1 400 0.3 350 36.8  18.8  6.902171053
2 1 400 0.3 400 76.0  38.2  29.06238183
2 1 400 1.68 250 4.60  18.1  0.8317616
2 1 400 1.68 275 17.20  17.3  2.971389123
2 1 400 1.68 300 38.92  19.6  7.62876008
2 1 400 1.68 325 56.38  30.6  17.26430932
2 1 400 1.68 350 67.88  39.1  26.54080464
5 1 100 2.1 250 0.3  2.2  0.007007211
5 1 100 2.1 275 1.0  1.7  0.016754982
5 1 100 2.1 300 1.7  2.2  0.036557463
5 1 100 2.1 350 9.0  3.3  0.297621751
5 1 100 2.1 400 28.6  10.3  2.942362809
5 1 400 1.68 250 13.4  3.3  0.441850092
5 1 400 1.68 275 12.8  7.1  0.907450345
5 1 400 1.68 300 25.5  7.2  1.829407723
5 1 400 1.68 350 55.8  10.7  5.937910401
5 1 400 1.68 400 83.3  37.3  31.11366512

使用全部影响乙醇转化率和C4 烯烃选择性的参数做拟合:

xx1:Co/SiO2

xx2:Co/SiO2 HAP 的质量比

xx3:催化剂总量

xx4:乙醇浓度

xx5温度

乙醇转化率:   y1=f(xx1,xx2,xx3,xx4,xx5)(使用万能的泰勒公式-幂级数,拟合公式见代码)

C4 烯烃选择性:y2=f(xx1,xx2,xx3,xx4,xx5)(使用万能的泰勒公式-幂级数,拟合公式见代码)

三级泰勒公式展开
!!!using["luopt","math"]; //使用命名空间
目标函数(xx1,xx2,xx3,xx4,xx5,  //共61个拟合参数
    a,a1,a2,a3,a4,a5,
    a11,a12,a13,a14,a15,
        a22,a23,a24,a25,
            a33,a34,a35,
                a44,a45,
                    a55,
    a111,a112,a113,a114,a115,
         a122,a123,a124,a125,
              a133,a134,a135,
                   a144,a145,
                        a155,
         a222,a223,a224,a225,
              a233,a234,a235,
                   a244,a245,
                        a255,
              a333,a334,a335,
                   a344,a345,
                        a355,
                   a444,a445,
                        a455,
                        a555
    : i,s,x1,x2,x3,x4,x5,y1,y2,py,pc : tyArray,max)=
{
    i=-1, s=0, (++i<max).while{
        x1=tyArray(i,0)-xx1, x2=tyArray(i,1)-xx2, x3=tyArray(i,2)-xx3, x4=tyArray(i,3)-xx4, x5=tyArray(i,4)-xx5, py=tyArray(i,5), pc=tyArray(i,6),
        y1= a+a1*x1+a2*x2+a3*x3+a4*x4+a5*x5+
            a11*x1*x1+a12*x1*x2+a13*x1*x3+a14*x1*x4+a15*x1*x5+
                      a22*x2*x2+a23*x2*x3+a24*x2*x4+a25*x2*x5+
                                a33*x3*x3+a34*x3*x4+a35*x3*x5+
                                          a44*x4*x4+a45*x4*x5+
                                                    a55*x5*x5+ 
         a111*x1*x1*x1+a112*x1*x1*x2+a113*x1*x1*x3+a114*x1*x1*x4+a115*x1*x1*x5+
                       a122*x1*x2*x2+a123*x1*x2*x3+a124*x1*x2*x4+a125*x1*x2*x5+
                                     a133*x1*x3*x3+a134*x1*x3*x4+a135*x1*x3*x5+
                                                   a144*x1*x4*x4+a145*x1*x4*x5+
                                                                 a155*x1*x5*x5+
                       a222*x2*x2*x2+a223*x2*x2*x3+a224*x2*x2*x4+a225*x2*x2*x5+
                                     a233*x2*x3*x3+a234*x2*x3*x4+a235*x2*x3*x5+
                                                   a244*x2*x4*x4+a245*x2*x4*x5+
                                                                 a255*x2*x5*x5+
                                     a333*x3*x3*x3+a334*x3*x3*x4+a335*x3*x3*x5+
                                                   a344*x3*x4*x4+a345*x3*x4*x5+
                                                                 a355*x3*x5*x5+
                                                   a444*x4*x4*x4+a445*x4*x4*x5+
                                                                 a455*x4*x5*x5+
                                                                 a555*x5*x5*x5,
        s=s+[y1-py]^2    //拟合乙醇转化率
        //s=s+[y1-pc]^2  //拟合C4烯烃选择性
    },
    sqrt[s/max]          //均方差RMSE为目标函数值
};
main(::tyArray,max)=
{
    tyArray=matrix{ //存放实验数据:使用装料方式I全部数据
        "
0.5	1	400	1.68	250	4.0 	9.6 
0.5	1	400	1.68	275	12.1 	8.6 
0.5	1	400	1.68	300	29.5 	10.7 
0.5	1	400	1.68	325	43.3 	18.9 
0.5	1	400	1.68	350	60.5 	27.3 
0.5	1	400	1.68	400	88.4 	41.0 
1	0.4925	100	1.68	250	2.5 	1.9 
1	0.4925	100	1.68	275	5.3 	2.6 
... ...(略)
        "
    },
    len[tyArray,0,&max],
    Opt1[@目标函数, optmax,1000, optmode,20, optdeep,20, optwaysimdeep, optwayconfra, optwaylme] //Opt1函数全局优化
};

结果及讨论:

对应乙醇转化率Y1的最优参数及均方差RMSE:

2.417402744750639         -0.2039147139106143       275.8011306772221         0.4156384853693174        260.1013882930106         14.83901857201672         0.317318572539172         -19.50790611027291        -3.588076207774742e-002   -6.855005447168541        -4.086740657820882e-002   -1.460941918741034        -0.4367844784685392       3.425230738907303e-002    11.49855862581616         4.904074627155117e-002    12.37311562403754         9.190390656233782e-002    2.893081399660135         -8.277525297568886e-002   -5.116674454929938e-004   -3.922081102157155e-003   3.238624290254206e-005    -2.034325083811818        5.339523080291108e-003    3.387818581763618e-003    -8.649776365931871        1.907021895486433         3.717192575220874e-003    0.2081378685138888        -2.614230849096533e-002   0.8020982822085792        1.067869051018692e-002    13.65608817413937         8.195945752882006e-003    -1.559228490839049e-004   5.447393901609546e-003    -6.670850845389642e-005   3.286334739062546         -3.95352575062304e-002    7.496760379706923e-005    -1.666984727364169        -2.45598856334926e-004    -2.942456600663122        4.646162907471563e-002    5.272516733906026e-005    2.86629773902457e-002     5.44992912475403e-004     26.46808705338533         -1.218629532938329e-003   1.496886943412408e-005    2.675602420290519e-007    2.753847472266319e-004    1.455617526774928e-005    -4.091460730469629e-002   9.190733722458817e-004    -1.477766443432227e-006   -8.220395243069316        -8.389116545320428e-003   3.364704951845783e-004    -1.132804688837243e-005   3.685019008260015

对应C4烯烃选择性Y2的最优参数及均方差RMSE:

1.986158004301724         2.450433071976323         67.49819932455158         0.208662313445064         256.4968573838999         1.799578875493056         -5.974066210514014        -11.56553740063614        -0.1545396393604948       5.172523119752178         0.1540143576135561        -17.45297800630631        -0.1090062772880443       -1.310984675110006e-002   -14.03392383507257        -4.289169392186376e-002   22.25748000512774         -2.245456583454652e-002   8.212272604609786e-002    6.271792925982265e-003    -6.669459749834531e-005   -1.903100059080562e-002   7.217058706506922e-004    -9.15304420446407         -3.741345572514077e-002   2.559970423512096e-003    11.47373282665268         9.341921817829952         3.264886165514432e-002    -6.472974026168921e-003   -2.121310819655539e-003   5.51933035952529          -5.171538944184857e-003   4.989155322559992         0.1533949251601508        -1.698477968040691e-004   -2.204068286556028e-002   2.761963091700759e-004    4.0798863013763           9.376124672502875e-002    2.641556051018874e-004    4.100002442739125         -4.734441692273163e-003   -1.961348488352317        -0.1706020449016992       2.700080312269564e-004    -9.322610320728019e-004   1.622536988804513e-003    11.72316720890722         -0.1463931085480807       -5.872822055720774e-004   1.205698763703183e-006    1.286795200473773e-004    6.839371475233182e-006    3.721430144278198e-002    -4.335815325906642e-004   -1.157491548269355e-007   9.860323047148855         -1.120116777723885e-002   -1.625346889836123e-004   -1.228545092598462e-005   2.394257044586305

因参数多,耗时较长,等Opt::ShowMin输出稳定(半天多时间),取以上结果。

因耗时较长,未多次运行;若多台电脑同时运行,或许有更优结果。

因目标函数值稍大(均方差RMSE为3.69(对应Y1)和2.39(对应Y2)),说明三级泰勒公式展开精度欠佳,四级泰勒公式展开将有更好结果,但拟合参数将增加到131个,耗时将更长。

由以上拟合参数求C4烯烃收率(Y1*Y2)最大值,可求最佳参数xx1,xx2,xx3,xx4,xx5。

三级泰勒公式展开,优化求最佳C4烯烃收率
!!!using["luopt","math"];; //使用命名空间
init(::       //拟合参数赋值
    aa1,aa2,aa3,aa4,aa5,
    a,a1,a2,a3,a4,a5,
    a11,a12,a13,a14,a15,
        a22,a23,a24,a25,
            a33,a34,a35,
                a44,a45,
                    a55,
    a111,a112,a113,a114,a115,
         a122,a123,a124,a125,
              a133,a134,a135,
                   a144,a145,
                        a155,
         a222,a223,a224,a225,
              a233,a234,a235,
                   a244,a245,
                        a255,
              a333,a334,a335,
                   a344,a345,
                        a355,
                   a444,a445,
                        a455,
                        a555,
    bb1,bb2,bb3,bb4,bb5,
    b,b1,b2,b3,b4,b5,
    b11,b12,b13,b14,b15,
        b22,b23,b24,b25,
            b33,b34,b35,
                b44,b45,
                    b55,
    b111,b112,b113,b114,b115,
         b122,b123,b124,b125,
              b133,b134,b135,
                   b144,b145,
                        b155,
         b222,b223,b224,b225,
              b233,b234,b235,
                   b244,b245,
                        b255,
              b333,b334,b335,
                   b344,b345,
                        b355,
                   b444,b445,
                        b455,
                        b555) =
  new[real_s,61].SetArray[
  "
  1.605961168999771         -0.4410695905557486       235.7757505227786  ... ...(这里放对应Y1的输出结果)
  "].in[0 :
    &aa1,&aa2,&aa3,&aa4,&aa5,
    &a,&a1,&a2,&a3,&a4,&a5,
    &a11,&a12,&a13,&a14,&a15,
        &a22,&a23,&a24,&a25,
            &a33,&a34,&a35,
                &a44,&a45,
                    &a55,
    &a111,&a112,&a113,&a114,&a115,
         &a122,&a123,&a124,&a125,
              &a133,&a134,&a135,
                   &a144,&a145,
                        &a155,
         &a222,&a223,&a224,&a225,
              &a233,&a234,&a235,
                   &a244,&a245,
                        &a255,
              &a333,&a334,&a335,
                   &a344,&a345,
                        &a355,
                   &a444,&a445,
                        &a455,
                        &a555],
  new[real_s,61].SetArray[
  "
  0.6291493182031664        0.2958183812514781        -0.4652893843549317  ... ...(这里放对应Y2的输出结果)

  "].in[0 :
    &bb1,&bb2,&bb3,&bb4,&bb5,
    &b,&b1,&b2,&b3,&b4,&b5,
    &b11,&b12,&b13,&b14,&b15,
        &b22,&b23,&b24,&b25,
            &b33,&b34,&b35,
                &b44,&b45,
                    &b55,
    &b111,&b112,&b113,&b114,&b115,
         &b122,&b123,&b124,&b125,
              &b133,&b134,&b135,
                   &b144,&b145,
                        &b155,
         &b222,&b223,&b224,&b225,
              &b233,&b234,&b235,
                   &b244,&b245,
                        &b255,
              &b333,&b334,&b335,
                   &b344,&b345,
                        &b355,
                   &b444,&b445,
                        &b455,
                        &b555];;
f(xx1,xx2,xx3,xx4,xx5  //目标函数
  : x1,x2,x3,x4,x5, y1, y2
  : aa1,aa2,aa3,aa4,aa5,
    a,a1,a2,a3,a4,a5,
    a11,a12,a13,a14,a15,
        a22,a23,a24,a25,
            a33,a34,a35,
                a44,a45,
                    a55,
    a111,a112,a113,a114,a115,
         a122,a123,a124,a125,
              a133,a134,a135,
                   a144,a145,
                        a155,
         a222,a223,a224,a225,
              a233,a234,a235,
                   a244,a245,
                        a255,
              a333,a334,a335,
                   a344,a345,
                        a355,
                   a444,a445,
                        a455,
                        a555,
    bb1,bb2,bb3,bb4,bb5,
    b,b1,b2,b3,b4,b5,
    b11,b12,b13,b14,b15,
        b22,b23,b24,b25,
            b33,b34,b35,
                b44,b45,
                    b55,
    b111,b112,b113,b114,b115,
         b122,b123,b124,b125,
              b133,b134,b135,
                   b144,b145,
                        b155,
         b222,b223,b224,b225,
              b233,b234,b235,
                   b244,b245,
                        b255,
              b333,b334,b335,
                   b344,b345,
                        b355,
                   b444,b445,
                        b455,
                        b555) =
{
    x1=xx1-aa1, x2=xx2-aa2, x3=xx3-aa3, x4=xx4-aa4, x5=xx5-aa5,
    y1= a+a1*x1+a2*x2+a3*x3+a4*x4+a5*x5+
        a11*x1*x1+a12*x1*x2+a13*x1*x3+a14*x1*x4+a15*x1*x5+
                  a22*x2*x2+a23*x2*x3+a24*x2*x4+a25*x2*x5+
                            a33*x3*x3+a34*x3*x4+a35*x3*x5+
                                      a44*x4*x4+a45*x4*x5+
                                                a55*x5*x5+ 
     a111*x1*x1*x1+a112*x1*x1*x2+a113*x1*x1*x3+a114*x1*x1*x4+a115*x1*x1*x5+
                   a122*x1*x2*x2+a123*x1*x2*x3+a124*x1*x2*x4+a125*x1*x2*x5+
                                 a133*x1*x3*x3+a134*x1*x3*x4+a135*x1*x3*x5+
                                               a144*x1*x4*x4+a145*x1*x4*x5+
                                                             a155*x1*x5*x5+
                   a222*x2*x2*x2+a223*x2*x2*x3+a224*x2*x2*x4+a225*x2*x2*x5+
                                 a233*x2*x3*x3+a234*x2*x3*x4+a235*x2*x3*x5+
                                               a244*x2*x4*x4+a245*x2*x4*x5+
                                                             a255*x2*x5*x5+
                                 a333*x3*x3*x3+a334*x3*x3*x4+a335*x3*x3*x5+
                                               a344*x3*x4*x4+a345*x3*x4*x5+
                                                             a355*x3*x5*x5+
                                               a444*x4*x4*x4+a445*x4*x4*x5+
                                                             a455*x4*x5*x5+
                                                             a555*x5*x5*x5,
    x1=xx1-bb1, x2=xx2-bb2, x3=xx3-bb3, x4=xx4-bb4, x5=xx5-bb5,
    y2= b+b1*x1+b2*x2+b3*x3+b4*x4+b5*x5+
        b11*x1*x1+b12*x1*x2+b13*x1*x3+b14*x1*x4+b15*x1*x5+
                  b22*x2*x2+b23*x2*x3+b24*x2*x4+b25*x2*x5+
                            b33*x3*x3+b34*x3*x4+b35*x3*x5+
                                      b44*x4*x4+b45*x4*x5+
                                                b55*x5*x5+ 
     b111*x1*x1*x1+b112*x1*x1*x2+b113*x1*x1*x3+b114*x1*x1*x4+b115*x1*x1*x5+
                   b122*x1*x2*x2+b123*x1*x2*x3+b124*x1*x2*x4+b125*x1*x2*x5+
                                 b133*x1*x3*x3+b134*x1*x3*x4+b135*x1*x3*x5+
                                               b144*x1*x4*x4+b145*x1*x4*x5+
                                                             b155*x1*x5*x5+
                   b222*x2*x2*x2+b223*x2*x2*x3+b224*x2*x2*x4+b225*x2*x2*x5+
                                 b233*x2*x3*x3+b234*x2*x3*x4+b235*x2*x3*x5+
                                               b244*x2*x4*x4+b245*x2*x4*x5+
                                                             b255*x2*x5*x5+
                                 b333*x3*x3*x3+b334*x3*x3*x4+b335*x3*x3*x5+
                                               b344*x3*x4*x4+b345*x3*x4*x5+
                                                             b355*x3*x5*x5+
                                               b444*x4*x4*x4+b445*x4*x4*x5+
                                                             b455*x4*x5*x5+
                                                             b555*x5*x5*x5,
    -y1*y2/100  //C4烯烃收率的负值为目标函数值
};
Opt1[@f, optrange: 0.4,5.1; 0.4,2.1; 90.0,410.0; 0.2,2.2; 230.0, 470.0]; //指定范围内求解,超出范围恐误差加大

结果(xx1,xx2,xx3,xx4,xx5及目标函数值)及讨论:

5.09999900000004          2.099999992453416         409.999999                2.199999982171348         469.9999990026478         -1951.17328362952

从拟合结果可以看出,目标函数值C4烯烃收率超过了100%,明显不符合实际情况,但仍对实验设计有指导意义。

xx1Co/SiO2(实验数据提供了0.5、1、2、5共4个参数)最佳值在设定参数上限,应增加该参数进行实验。

xx2Co/SiO2 HAP 的质量比(实验数据提供了0.4925、0.5556、1、2.0303共4个参数)最佳值在设定参数上限,应增加该参数进行实验。

xx3:催化剂总量(实验数据提供了100、140、400共3个参数)最佳值在设定参数上限,应增加该参数进行实验。

xx4乙醇浓度(实验数据提供了0.3、0.9、1.68、2.1共4个参数)最佳值在设定参数上限,应增加该参数进行实验。

xx5温度(实验数据提供较多)最佳值在设定参数上限,如果条件允许应增加该参数进行实验。

指定条件(Co/SiO2 HAP 的质量比为1,催化剂总量为100)求最优值:

Opt1[@f, optwaycom, optrange: 0.4,5.1; 0.999,1.001; 99.999,100.0; 0.3,2.2; 230.0, 470.0]; //指定范围内求解,超出范围恐误差加大

结果(xx1,xx2,xx3,xx4,xx5及目标函数值):

2.059379393474595         1.000999997151315         99.9990005847001          2.199999994350263         452.9225113865244         -49.9568032788798

猜想:如果 xx1,xx2,xx3,xx4 数据更多些,拟合结果或许会更好。

下面使用Lu脚本优化库中新增的泰勒展开式计算函数FunTaylor,不仅代码量大幅减少,运行速度也大幅提高:

三级泰勒公式展开
!!!using["luopt","math"]; //使用命名空间
目标函数(a :: tyArray,Array,max)=
{
    FunTaylor[2,5,3,a,tyArray], //计算泰勒展开式的函数值
    sqrt{sum{[(tyArray[all:5]-Array).reshape()].^2.0}/max}  //均方差RMSE为目标函数值
};
main(:a:tyArray,Array,max)=
{
    //实验数据:使用装料方式I全部数据,最后一列为乙醇转化率(或者C4 烯烃选择性)
    tyArray=matrix{
        "
0.5	1	400	1.68	250	4.0 
0.5	1	400	1.68	275	12.1
0.5	1	400	1.68	300	29.5 
0.5	1	400	1.68	325	43.3 
0.5	1	400	1.68	350	60.5
0.5	1	400	1.68	400	88.4
1	0.4925	100	1.68	250	2.5 
1	0.4925	100	1.68	275	5.3 
        "
    },
    len[tyArray,0,&max], Array=tyArray[all:5],
    a=new[real_s,FunTaylor(0,5,3)],  //申请数组,存放泰勒展开式系数
    Opt1[a, @目标函数, optmax,1000, optmode,20, optdeep,20, optwaysimdeep, optwayconfra, optwaylme] //Opt1函数全局优化
};

运行结果与前述相同。

下面的代码可输出泰勒公式展开式:

输出泰勒公式展开式
!!!using["luopt","math"]; //使用命名空间
main(:a)=
{
    a=new[real_s,FunTaylor(0,5,3)].SetArray{  //申请数组
        "
2.417496983520035         -0.2038158183643675       275.7788602686833 ...  //存放泰勒展开式系数
        "
    },
    FunTaylor(1,5,3,a) //输出泰勒展开式
};

结果:y=f(y0,y1,y2,y3,y4) 乙醇转化率 的三级泰勒展开

x0=y0-(2.417496983520035), x1=y1-(-0.2038158183643675), x2=y2-(275.7788602686833), x3=y3-(0.4157150578775843), x4=y4-(260.1130205122635), 
y=(14.8339916081916)+(0.3166092689262277)*x0+(-19.5191890572145)*x1+(-3.579769353416268e-002)*x2+(-6.851231734885069)*x3+(-4.081252504690269e-002)*x4
  +(-1.462185975049673)*x0*x0+(-0.4399498529512698)*x0*x1+(3.424728880639916e-002)*x0*x2+(11.50149493634983)*x0*x3+(4.899775046562916e-002)*x0*x4+(12.37566086214654)*x1*x1+(9.179605162184748e-002)*x1*x2+(2.890613812179718)*x1*x3+(-8.280205689469142e-002)*x1*x4+(-5.112768904844806e-004)*x2*x2+(-3.945340831718832e-003)*x2*x3+(3.216395934710691e-005)*x2*x4+(-2.02763843455804)*x3*x3+(5.330066275526738e-003)*x3*x4+(3.38768061375748e-003)*x4*x4
  +(-8.64941211238461)*x0*x0*x0+(1.906979904073245)*x0*x0*x1+(3.715034007924377e-003)*x0*x0*x2+(0.2072410484718987)*x0*x0*x3+(-2.614438938622829e-002)*x0*x0*x4+(0.8077179983441646)*x0*x1*x1+(1.067299977263131e-002)*x0*x1*x2+(13.64855878020005)*x0*x1*x3+(8.218774646838642e-003)*x0*x1*x4+(-1.558999302693181e-004)*x0*x2*x2+(5.46432176380897e-003)*x0*x2*x3+(-6.669493109849741e-005)*x0*x2*x4+(3.289772620061781)*x0*x3*x3+(-3.952670192258448e-002)*x0*x3*x4+(7.497001157885084e-005)*x0*x4*x4+(-1.664062662934021)*x1*x1*x1+(-2.11898392118816e-004)*x1*x1*x2+(-2.94415280401644)*x1*x1*x3+(4.647403064153688e-002)*x1*x1*x4+(5.293074439992591e-005)*x1*x2*x2+(2.868693302201956e-002)*x1*x2*x3+(5.447745594835923e-004)*x1*x2*x4+(26.46740180486084)*x1*x3*x3+(-1.230102336289828e-003)*x1*x3*x4+(1.493155915585734e-005)*x1*x4*x4+(2.693155624482926e-007)*x2*x2*x2+(2.753552958995272e-004)*x2*x2*x3+(1.455718067712246e-005)*x2*x2*x4+(-4.09069242216141e-002)*x2*x3*x3+(9.190931133968552e-004)*x2*x3*x4+(-1.477757220874119e-006)*x2*x4*x4+(-8.219787163776919)*x3*x3*x3+(-8.378418878388916e-003)*x3*x3*x4+(3.364395602770745e-004)*x3*x4*x4+(-1.132849569198336e-005)*x4*x4*x4

结果:y=f(y0,y1,y2,y3,y4) C4 烯烃选择性 的三级泰勒展开

x0=y0-(1.986158004301724), x1=y1-(2.450433071976323), x2=y2-(67.49819932455158), x3=y3-(0.208662313445064), x4=y4-(256.4968573838999), 
y=(1.799578875493056)+(-5.974066210514014)*x0+(-11.56553740063614)*x1+(-0.1545396393604948)*x2+(5.172523119752178)*x3+(0.1540143576135561)*x4
  +(-17.45297800630631)*x0*x0+(-0.1090062772880443)*x0*x1+(-1.310984675110006e-002)*x0*x2+(-14.03392383507257)*x0*x3+(-4.289169392186376e-002)*x0*x4+(22.25748000512774)*x1*x1+(-2.245456583454652e-002)*x1*x2+(8.212272604609786e-002)*x1*x3+(6.271792925982265e-003)*x1*x4+(-6.669459749834531e-005)*x2*x2+(-1.903100059080562e-002)*x2*x3+(7.217058706506922e-004)*x2*x4+(-9.15304420446407)*x3*x3+(-3.741345572514077e-002)*x3*x4+(2.559970423512096e-003)*x4*x4
  +(11.47373282665268)*x0*x0*x0+(9.341921817829952)*x0*x0*x1+(3.264886165514432e-002)*x0*x0*x2+(-6.472974026168921e-003)*x0*x0*x3+(-2.121310819655539e-003)*x0*x0*x4+(5.51933035952529)*x0*x1*x1+(-5.171538944184857e-003)*x0*x1*x2+(4.989155322559992)*x0*x1*x3+(0.1533949251601508)*x0*x1*x4+(-1.698477968040691e-004)*x0*x2*x2+(-2.204068286556028e-002)*x0*x2*x3+(2.761963091700759e-004)*x0*x2*x4+(4.0798863013763)*x0*x3*x3+(9.376124672502875e-002)*x0*x3*x4+(2.641556051018874e-004)*x0*x4*x4+(4.100002442739125)*x1*x1*x1+(-4.734441692273163e-003)*x1*x1*x2+(-1.961348488352317)*x1*x1*x3+(-0.1706020449016992)*x1*x1*x4+(2.700080312269564e-004)*x1*x2*x2+(-9.322610320728019e-004)*x1*x2*x3+(1.622536988804513e-003)*x1*x2*x4+(11.72316720890722)*x1*x3*x3+(-0.1463931085480807)*x1*x3*x4+(-5.872822055720774e-004)*x1*x4*x4+(1.205698763703183e-006)*x2*x2*x2+(1.286795200473773e-004)*x2*x2*x3+(6.839371475233182e-006)*x2*x2*x4+(3.721430144278198e-002)*x2*x3*x3+(-4.335815325906642e-004)*x2*x3*x4+(-1.157491548269355e-007)*x2*x4*x4+(9.860323047148855)*x3*x3*x3+(-1.120116777723885e-002)*x3*x3*x4+(-1.625346889836123e-004)*x3*x4*x4+(-1.228545092598462e-005)*x4*x4*x4

有了公式,拟合y=f(y0,y1,y2,y3,y4)的最优值将比较方便,有兴趣的可自行研究。

将本例五元函数泰勒四级展开,不知精度将提高多少,有兴趣的可自行研究。

以上讨论,仅供参考。

补充说明:因xx1Co/SiO2(实验数据提供了0.5、1、2、5共4个参数)、xx2Co/SiO2 HAP 的质量比(实验数据提供了0.4925、0.5556、1、2.0303共4个参数)、xx3:催化剂总量(实验数据提供了100、140、400共3个参数)、xx4乙醇浓度(实验数据提供了0.3、0.9、1.68、2.1共4个参数)数据量少,而拟合参数多,会存在两个问题导致模型失真:

1、过拟合。

2、龙格震荡现象。

今天的文章2021 年高教社杯全国大学生数学建模竞赛 B题 乙醇偶合制备 C4 烯烃 求解思路2分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/32736.html

(0)
编程小号编程小号

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注