{"id":1030,"date":"2010-04-20T16:03:00","date_gmt":"2010-04-20T08:03:00","guid":{"rendered":""},"modified":"2013-11-17T12:04:48","modified_gmt":"2013-11-17T04:04:48","slug":"%e6%8b%89%e6%a0%bc%e6%9c%97%e6%97%a5%e5%86%85%e6%8f%92%e9%80%9a%e7%94%a8%e7%89%88","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/1030.html","title":{"rendered":"\u62c9\u683c\u6717\u65e5\u5185\u63d2\u901a\u7528\u7248"},"content":{"rendered":"<p>\u7f51\u4e0a\u6709\u7c7b\u4f3c\u7684\u7a0b\u5e8f\uff0c\u4f46\u662f\u6211\u89c9\u5f97\u90fd\u4e0d\u5b8c\u7f8e\uff0c\u4e8e\u662f\u81ea\u5df1\u53c2\u8003\u73b0\u6709\u7684\u4ee3\u7801\uff0c\u5199\u4e86\u4e00\u4e2a\u81ea\u5df1\u6ee1\u610f\u7684\u3002<\/p>\n<pre class=\"brush: delphi; title: ; notranslate\" title=\"\">\r\n\r\n\/\/\u62c9\u683c\u6717\u65e5\u5185\u63d2,n\u4e3a\u9636\u6570\uff0cfx,fy\u4e3a\u6574\u4f53\uff0c\u51fd\u6570\u5185\u90e8\u4f1a\u5bf9\u5176\u7b5b\u9009\uff0cfx,fy\u957f\u5ea6&gt;=n\r\nfunction lagrange2(fx,fy: array of Extended; xx: Extended; n: Integer): Extended;\r\nvar i,j: Integer;\r\n    yy: Extended;\r\n    a: array of Extended;\r\n    fx2,fy2: array of Extended;\r\n    sum1,st_n,half_n: Integer;\r\n    len: Integer;\r\nbegin\r\n  SetLength(a,n+1);\r\n  SetLength(fx2,n+1);\r\n  SetLength(fy2,n+1);\r\n  sum1 := 0;\r\n  half_n := n div 2;\r\n  len := Length(fx)-1;   \/\/\u5728\u8fd9\u91cc\u662f95\r\n\r\n\/\/===================BEGIN=========\u53d6nn\u4e2a\u6570\u53c2\u4e0e\u63d2\u503c\uff0c\u4f7f\u8981\u6c42\u7684\u6570\u5728\u5176\u4e2d\u95f4========\r\n    st_n := Trunc(xx-fx&#x5B;0]) div (15*60); \/\/\u65f6\u95f4\u5904\u4e8e\u7b2c\u51e0\u4e2a15\u5206\u949f\r\n    if(st_n&gt;=len) then    \/\/\u8d85\u51fa\u6240\u6709\r\n    begin\r\n      for j := len-n to len do\r\n      begin\r\n        fx2&#x5B;sum1] := fx&#x5B;j];\r\n        fy2&#x5B;sum1] := fy&#x5B;j];\r\n        sum1 := sum1+1;\r\n      end;\r\n    end\r\n    else if(st_n&lt;=0) then   \/\/\u4f4e\u4e8e\u6240\u6709\r\n    begin\r\n      for j := 0 to n do\r\n      begin\r\n        fx2&#x5B;sum1] := fx&#x5B;j];\r\n        fy2&#x5B;sum1] := fy&#x5B;j];\r\n        sum1 := sum1+1;\r\n      end;\r\n    end\r\n    else if(len-st_n&lt; half_n) then      \/\/\u53f3\u8fb9\u4e0d\u591f\r\n    begin\r\n      for j := st_n to len do\r\n      begin\r\n        fx2&#x5B;sum1] := fx&#x5B;j];\r\n        fy2&#x5B;sum1] := fy&#x5B;j];\r\n        sum1 := sum1+1;\r\n      end;\r\n      for j := (len-n+1) to st_n do\r\n      begin\r\n        fx2&#x5B;sum1] := fx&#x5B;j-1];\r\n        fy2&#x5B;sum1] := fy&#x5B;j-1];\r\n        sum1 := sum1+1;\r\n      end;\r\n    end\r\n    else if(st_n&lt;(n div 2)) then      \/\/\u5de6\u8fb9\u4e0d\u591f\r\n    begin\r\n      for j := 0 to st_n do\r\n      begin\r\n        fx2&#x5B;sum1] := fx&#x5B;j];\r\n        fy2&#x5B;sum1] := fy&#x5B;j];\r\n        sum1 := sum1+1;\r\n      end;\r\n      for j := (st_n+1) to (n) do\r\n      begin\r\n        fx2&#x5B;sum1] := fx&#x5B;j];\r\n        fy2&#x5B;sum1] := fy&#x5B;j];\r\n        sum1 := sum1+1;\r\n      end;\r\n    end\r\n    else      \/\/\u4e24\u8fb9\u90fd\u591f\r\n    begin\r\n      for j := (st_n-(n div 2)) to st_n do\r\n      begin\r\n        fx2&#x5B;sum1] := fx&#x5B;j];\r\n        fy2&#x5B;sum1] := fy&#x5B;j];\r\n        sum1 := sum1+1;\r\n      end;\r\n      for j := (st_n+1) to (st_n+n-(n div 2)) do\r\n      begin\r\n        fx2&#x5B;sum1] := fx&#x5B;j];\r\n        fy2&#x5B;sum1] := fy&#x5B;j];\r\n        sum1 := sum1+1;\r\n      end;\r\n    end;\r\n\/\/========================END======\u53d6nn\u4e2a\u6570\u53c2\u4e0e\u63d2\u503c\uff0c\u4f7f\u8981\u6c42\u7684\u6570\u5728\u5176\u4e2d\u95f4========\r\n  yy := 0;\r\n  for I := 0 to n do\r\n  begin\r\n    a&#x5B;i] := fy2&#x5B;i];\r\n    for j := 0 to n do\r\n    begin\r\n      if(j&lt;&gt;i) then\r\n        a&#x5B;i] := a&#x5B;i]*(xx-fx2&#x5B;j])\/(fx2&#x5B;i]-fx2&#x5B;j]);\r\n    end;\r\n    yy := yy+a&#x5B;i];\r\n  end;\r\n  Result := yy;\r\nend;\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u7f51\u4e0a\u6709\u7c7b\u4f3c\u7684\u7a0b\u5e8f\uff0c\u4f46\u662f\u6211\u89c9\u5f97\u90fd\u4e0d\u5b8c\u7f8e\uff0c\u4e8e\u662f\u81ea\u5df1\u53c2\u8003\u73b0\u6709\u7684\u4ee3\u7801\uff0c\u5199\u4e86\u4e00\u4e2a\u81ea\u5df1\u6ee1\u610f\u7684\u3002 \/\/\u62c9\u683c\u6717\u65e5\u5185\u63d2,n\u4e3a\u9636\u6570 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-1030","post","type-post","status-publish","format-standard","hentry","category-diary"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/1030","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/comments?post=1030"}],"version-history":[{"count":3,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/1030\/revisions"}],"predecessor-version":[{"id":4574,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/1030\/revisions\/4574"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=1030"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=1030"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=1030"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}