Page 29 - 《软件学报》2020年第12期
P. 29

赵世忠  等:循环迭代程序的一种可信计算算法                                                           3695



             否则,若式(33)不成立,则由假设知:总可以获得一个新的计算值 Y ,使得由其得到的 z 满足式(33).这样,新获
                        z
         得的 z 的函数值 e   ε/2 能够满足式(32).证明完毕.                                                    □
             算法 9. AccurateEnough_Exp( {( , ) |1y ε i  ≤≤  n }, ( , ,...,f x x 2  x n ),ε ).

                                              i
                                       i
                                                      1
             Require: {( , ) | yε i    i  =   y    ,1≤≤  } n ,f(x 1 ,x 2 ,…,x n ),ε>0;
                     y
                                     i
                      i
                               i
                                  i ε
             Ensure:返回一个 4 元组 D =  (, , ,y k ε 0  enough ) .若 enough=true,则 | ye−  ( fy 1 , y 2 ,..., n y  )  | ε<  ;否则,当 enough=false 时,
          y   的精度ε k 不能满足计算的要求,其精度需要提高至ε 0 .
           k
             1:   ε′⇐0.1;
             2:   Calculate and Judge ({( , ) |1y ε  ≤≤  n }, , )f ε′ ;

                                            i
                            _
                        _
                                     i  i
             3:   ε″⇐0.2;

                       +
             4:   y ⇐    e f ε ′    ε ′′ ;
             5:   ε″′⇐min{0.1,δ(ε/(2(y+ε″)))};

                                                     )
                                            i
                        _
                            _
             6:   Calculate and Judge ({( , ) |1y ε i  ≤≤  n }, ,f ε′′′ ;
                                     i
             7:   y ⇐    e    f    ε /2  ;
             8:   return (y,0,0,true);
         2.1.3    递归计算子算法
             首先,对于下面式(34)中的函数,我们有式(35)中对应的等式:
                 cos( ),tan( ),cot( ),sec( ),csc( ),arcsin( ),arccos( ),arccot( ),logf 1  f 1  f 1  f 1  f 1  f 1  f 1  f 1  1 f  f 2 ,sinh( ),cosh( )f 1  f 1  (34)
                   ⎧ sin( / 2π  −  f  ),sin( )/cos( ),cos( )/sin( ),1/cos( ),1/sin( ),2arctan( /(1f  f  f  f  f  f  f  +  1−  f  2  ))
                   ⎪
                   ⎨        1    1     1     1     1      1      1        1       1          (35)
                   ⎪ ⎩ π  / 2 arcsin( ), / 2 arctan( ),ln( )/ln( ),(f π  −  1  −  f 1  f 1  f 2  e −  1 f  e −  1 f  )/(2 e +  ,  1 f  e −  1 f  ) 2/
         然后,根据前面的两个子算法,我们可以得出递归计算的子算法.其中,f 为−f 1 , ∑                    1 n  , f f  2 f  或式(34)中之一.
                                                                       i= 1 i  1

             算法 10.  Sub 3_ AccurateEnough ({( , ) |1y ε i  ≤≤  n }, ( , ,...,f x x 2  x n ), ).ε
                                                i
                                         i
                                                        1
             1:   if f=−f 1  then

             2:      D ⇐  AccurateEnough ({( , ) |1y ε i  ≤≤ n }, , )f ε ;

                                             i
                                                   1
                    1
                                      i

             3:      D ⇐−  (D 1 ),Snd (D 1 ),Thd (D 1 ),Fth (D 1 )) ;
                      ( Fst
             4:   else if  f = ∑  1 n  f   then
                           i= 1 i
             5:      for i=1 to n 1  do
             6:         Calculate and Judge ({( , ) |1y ε     i  i  i  n }, , ( / ))f δ  i  ε ≤≤  n 1  ;  //参见算法 4
                            _
                                _
             7:      end for

             8:      D ⇐ ∑  1 n  f    ,0,0,true) ;
                      (
                         i= 1 i
             9:   else if  f =  f  2 f    then
                          1
             10:     if f 1 =0 and f 2 >0 then

             11:        D ⇐  (0,0,0,true) ;
             12:     end if f 1 >0 then


             13:        D ⇐  AccurateEnough ({( , ) |1y ε i  ≤≤  n },e f 2 ln( f×  1 ) , )ε
                                               i
                                        i
             14:     end if f 1 <0,f 2 =n′/n″(不可约),n′是偶数,and n″是奇数 then

             15:        D ⇐  AccurateEnough ({( , ) |1y ε  ≤≤ n },e f 2 ln( f×  −  1 ) , )ε ;
                                               i

                                        i  i
             16:     end if f 1 <0,f 2 =n′/n″(不可约),and n′与 n″均是奇数 then
             17:        D ⇐     AccurateEnough ({( , ) |1y ε  ≤≤ n }, e−  f 2 ln( f×  −  1 ) , )ε ;

                                               i
                                        i  i
             18:     end if
             19: end if f=式(34)中的表达式  then
   24   25   26   27   28   29   30   31   32   33   34