码迷,mamicode.com
首页 > 其他好文 > 详细

[从头学数学] 第206节 优选法与试验设计初步

时间:2016-05-13 00:44:57      阅读:231      评论:0      收藏:0      [点我收藏+]

标签:

剧情提要:
[机器小伟]在[工程师阿伟]的陪同下进入了[九转金丹]之第七转的修炼。
这次要研究的是[优选法与试验设计初步]。

正剧开始:


星历2016年05月08日 16:07:12, 银河系厄尔斯星球中华帝国江南行省。

[工程师阿伟]正在和[机器小伟]一起研究[优选法与试验设计初步]。


技术分享


技术分享


技术分享


技术分享


技术分享


技术分享


技术分享


技术分享


技术分享


技术分享


技术分享


<span style="font-size:18px;">>>> a = 1+1-2*math.cos(108/180*math.pi);
>>> a
2.618033988749895
>>> d = a**0.5;
>>> d
1.618033988749895
>>> d*(d-1);
1.0000000000000002</span>

技术分享


技术分享


<span style="font-size:18px;">>>> 
[1, 0.5, 0.6666666666666666, 0.6000000000000001, 0.625, 0.6153846153846154, 
0.6190476190476191, 0.6176470588235294, 
0.6181818181818182, 0.6179775280898876, 
0.6180555555555556]

#分数法系数阵列
def fractionMethod():
    array = [];

    w = 1;
    array.append(w);
    
    for i in range(10):
        w = 1/(1+w);
        array.append(w);

    print(array);</span>

技术分享


技术分享


技术分享


技术分享


技术分享


技术分享


<span style="font-size:18px;">>>> 
[1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765]
21 55

def tmp():
    #生成斐波那契数列
    fib = [];
    for i in range(20):
        fib.append(Fibonacci(i));

    print(fib);
        
    #试验范围
    bound_low = 29;
    bound_high = 50;

    index_low = index_high = 1;

    
    for i in range(len(fib)):
        if (fib[i] <= bound_low):
            index_low = i;

        if (fib[i] > bound_low):
            break;

    for i in range(len(fib)):
        if (fib[i] >= bound_high):
            index_high = i;
            break;

    print(fib[index_low], fib[index_high]);

试验点:21, 55, 34, [21, 34]化为[0, 13], 中间取[8, 5], 所以是取29, 26</span>


<span style="font-size:18px;">1  -->  91
2  -->  84
3  -->  79
4  -->  76
5  -->  75
6  -->  76
7  -->  79
8  -->  84
9  -->  91

def tmp():
   for i in range(1, 10):
       print(i, ' --> ', i*i+10*(10-i));
	   
	  </span>

技术分享


技术分享


技术分享


技术分享


技术分享


技术分享


技术分享


技术分享


技术分享


技术分享


技术分享


技术分享


技术分享


技术分享


技术分享


技术分享


技术分享


技术分享


技术分享


有哪些种类的饱和正交表呢?


<span style="font-size:18px;">>>> 
L_4.0 (2^3)
L_8.0 (2^7)
L_16.0 (2^15)
L_32.0 (2^31)
L_9.0 (3^4)
L_27.0 (3^13)
L_16.0 (4^5)
L_64.0 (4^21)
L_25.0 (5^6)
L_125.0 (5^31)
L_36.0 (6^7)

#水平N正交表
def orthogonalTable(level, factor):
    #饱和型正交表
    count = 0;
    #q = (t^n-1)/(t-1)
    count = math.log(((level-1)*factor)+1)/math.log(level);

    return count;


def tmp():
    #水平
    for i in range(2, 7):
        #因素
        for j in range(2, 40):
            result = orthogonalTable(i, j);
            if abs(int(result)-result)<1e-6:
                print('L_{0} ({1}^{2})'.format(round(i**result, 3), i, j));</span>


技术分享


技术分享

<span style="font-size:18px;">>>> 
[[15.0, 18.0, 13.5], [14.5, 11.5, 16.0]]
[0.5, 6.5, 2.5]

def tmp():
    level = 2;
    factor = 3;
    
    array = [
        #前三列为因素,最后一列为试验得到的数据值
        [1,1,1,17],
        [1,2,2,13],
        [2,1,2,19],
        [2,2,1,10]
        ];

    size = len(array);

    k_q = [([0]*factor) for j in range(level)];

    for k in range(level):
        for i in range(factor):
            sum_ = 0;
            for j in range(size):
                if (array[j][i] == k+1):
                    sum_ += array[j][factor];

            k_q[k][i] = sum_/level;

    print(k_q);
       
    R = [0]*factor;

    for i in range(factor):
        subArray = [];
        for j in range(level):
            subArray.append(k_q[j][i]);

        max_ = max(subArray);
        min_ = min(subArray);
        R[i] = max_-min_;

    print(R);
	</span>


技术分享


技术分享


技术分享


技术分享


技术分享


技术分享

<span style="font-size:18px;">>>> 
[[1.5, 2.25, 2.0], [2.75, 2.0, 2.25]]
[1.25, 0.25, 0.25]

def tmp():
    level = 2;
    factor = 3;
    
    array = [
        #前三列为因素,最后一列为试验得到的数据值
        [1,1,1,1.5],
        [1,2,2,1.5],
        [2,1,2,3.0],
        [2,2,1,2.5]
        ];

    size = len(array);

    k_q = [([0]*factor) for j in range(level)];

    for k in range(level):
        for i in range(factor):
            sum_ = 0;
            for j in range(size):
                if (array[j][i] == k+1):
                    sum_ += array[j][factor];

            k_q[k][i] = sum_/level;

    print(k_q);
       
    R = [0]*factor;

    for i in range(factor):
        subArray = [];
        for j in range(level):
            subArray.append(k_q[j][i]);

        max_ = max(subArray);
        min_ = min(subArray);
        R[i] = max_-min_;

    print(R);</span>


技术分享


技术分享


技术分享


<span style="font-size:18px;">>>> 
[[433.667, 456.167, 439.833], [438.833, 423.667, 418.167], [424.667, 417.333, 439.167]]
[14.166, 38.834, 21.666]

def tmp():
    level = 3;
    factor = 3;
    
    array = [
        #前三列为因素,最后一列为试验得到的数据值
        [1,1,1,463.5],
        [1,2,2,409.0],
        [1,3,3,428.5],
        [2,1,2,451.5],
        [2,2,3,435.5],
        [2,3,1,429.5],
        [3,1,3,453.5],
        [3,2,1,426.5],
        [3,3,2,394.0]
         
        ];

    size = len(array);

    k_q = [([0]*factor) for j in range(level)];

    for k in range(level):
        for i in range(factor):
            sum_ = 0;
            for j in range(size):
                if (array[j][i] == k+1):
                    sum_ += array[j][factor];

            k_q[k][i] = round(sum_/level, 3);

    print(k_q);
       
    R = [0]*factor;

    for i in range(factor):
        subArray = [];
        for j in range(level):
            subArray.append(k_q[j][i]);

        max_ = max(subArray);
        min_ = min(subArray);
        R[i] = round(max_-min_, 3);

    print(R);
	</span>

技术分享


技术分享


技术分享

>>> 
[[72.0, 83.5, 80.0], [84.5, 73.0, 76.5]]
[12.5, 10.5, 3.5]

def tmp2():
    level = 2;
    factor = 3;
    
    array = [
        #前三列为因素,最后一列为试验得到的数据值
        [1,1,1,79],
        [1,2,2,65],
        [2,1,2,88],
        [2,2,1,81]
        ];

    size = len(array);

    k_q = [([0]*factor) for j in range(level)];

    for k in range(level):
        for i in range(factor):
            sum_ = 0;
            for j in range(size):
                if (array[j][i] == k+1):
                    sum_ += array[j][factor];

            k_q[k][i] = sum_/level;

    print(k_q);
       
    R = [0]*factor;

    for i in range(factor):
        subArray = [];
        for j in range(level):
            subArray.append(k_q[j][i]);

        max_ = max(subArray);
        min_ = min(subArray);
        R[i] = max_-min_;

    print(R);


技术分享

技术分享

技术分享


这些正交表中的每行每列到底是些什么规律,小伟还没搞明白,先放着吧。


本节到此结束,欲知后事如何,请看下回分解。

[从头学数学] 第206节 优选法与试验设计初步

标签:

原文地址:http://blog.csdn.net/mwsister/article/details/51346066

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!