{"id":4850,"date":"2020-02-29T14:28:36","date_gmt":"2020-02-29T06:28:36","guid":{"rendered":"https:\/\/www.highflybird.com\/blog\/?p=4850"},"modified":"2020-09-16T21:32:13","modified_gmt":"2020-09-16T13:32:13","slug":"%e5%b0%8f%e9%97%ae%e9%a2%98%ef%bc%8c%e5%a4%a7%e6%80%9d%e8%80%83","status":"publish","type":"post","link":"https:\/\/www.highflybird.com\/blog\/?p=4850","title":{"rendered":"\u5c0f\u95ee\u9898\uff0c\u5927\u601d\u8003"},"content":{"rendered":"<p>\u4e00\u4e2a\u535a\u58eb\u670b\u53cb\u7684\u513f\u5b50\u521a\u4e0a\u521d\u4e2d\u4e0d\u4e45\uff0c\u4ed6\u5c31\u63d0\u51fa\u4e86\u4e0b\u9762\u7684\u4e00\u4e2a\u95ee\u9898\uff0c\u6211\u611f\u89c9\u5f88\u6709\u6df1\u5ea6\uff0c\u5f88\u96be\u5f97\uff0c\u73b0\u5728\u8d34\u51fa\u6765\u8bf4\u8bf4\u3002<\/p>\n<p><!--more--><\/p>\n<p>\u5982\u4e0b\u9762\u56fe\u6240\u793a\uff1a\u5df2\u77e5\u7ebf\u6bb5AB\u548c\u4e00\u70b9P\uff0cn\u7b49\u5206\u7ebf\u6bb5,\u5f97\u5230n+1\u4e2a\u70b9\u4e0eP\u8fde\u7ebf\u3002<\/p>\n<p>\u95ee\uff1a<strong>n\u8d8b\u4e8e\u65e0\u7a77\u5927\u65f6\uff0c\u8fd9\u4e9b\u8fde\u7ebf\u957f\u7684\u5e73\u5747\u503c\u8d8b\u5411\u4e00\u4e2a\u5b9a\u6570\u5417\uff1f \u5982\u679c\u662f\uff0c\u8be5\u600e\u6837\u6c42\uff1f<\/strong><\/p>\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"911\" height=\"569\" src=\"https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson.jpg\" alt=\"\" class=\"wp-image-4852\" srcset=\"https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson.jpg 911w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-300x187.jpg 300w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-768x480.jpg 768w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-480x300.jpg 480w\" sizes=\"auto, (max-width: 911px) 100vw, 911px\" \/><\/figure>\n\n\n\n<p>\u7c97\u770b\u8d77\u6765\u597d\u50cf\u6ca1\u4ec0\u4e48\u96be\u5ea6\uff0c\u7136\u800c\u7a0d\u5fae\u8ba1\u7b97\u4e00\u4e0b\uff0c\u5c31\u53d1\u73b0\u4e0d\u90a3\u4e48\u7b80\u5355\uff0c\u535a\u58eb\u62ff\u51fa\u4e86Maple\u8fd9\u4e2a\u6570\u5b66\u8f6f\u4ef6\uff0c\u7528\u6c42\u6781\u9650\u6cd5\u5f97\u5230\u4e86\u4e00\u4e2a\u5e76\u4e0d\u7b80\u5355\u7684\u7ed3\u679c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"324\" src=\"https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-1-1024x324.png\" alt=\"\" class=\"wp-image-4851\" srcset=\"https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-1-1024x324.png 1024w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-1-300x95.png 300w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-1-768x243.png 768w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-1-500x158.png 500w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-1.png 1210w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u540e\u6765\uff0c\u6211\u89c9\u5f97\u8fd9\u4e2a\u6781\u9650\u53ef\u4ee5\u5316\u4e3a\u79ef\u5206\uff0c\u5f97\u5230\u4e86\u76f8\u540c\u7684\u7ed3\u679c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"876\" height=\"91\" src=\"https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-3.png\" alt=\"\" class=\"wp-image-4854\" srcset=\"https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-3.png 876w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-3-300x31.png 300w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-3-768x80.png 768w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-3-500x52.png 500w\" sizes=\"auto, (max-width: 876px) 100vw, 876px\" \/><\/figure>\n\n\n\n<p>\u5176\u4e2d\u7684\u5b57\u6bcd\u542b\u4e49\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"977\" height=\"422\" src=\"https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-4.png\" alt=\"\" class=\"wp-image-4855\" srcset=\"https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-4.png 977w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-4-300x130.png 300w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-4-768x332.png 768w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-4-500x216.png 500w\" sizes=\"auto, (max-width: 977px) 100vw, 977px\" \/><\/figure>\n\n\n\n<p>\u8fd9\u4e2a\u7ed3\u679c\u663e\u7136\u4e0d\u662f\u521d\u4e2d\u7684\u77e5\u8bc6\u4e86\u3002<\/p>\n\n\n\n<p>\u8fd9\u4e2a\u5c0f\u5b69\u5f88\u6709\u5929\u8d4b\uff0c\u4ed6\u8fd8\u628a\u8fd9\u4e2a\u95ee\u9898\u505a\u5f15\u7533\u53d1\u6563\u5f00\u6765\u3002<\/p>\n\n\n\n<p>\u9996\u5148\uff0c\u4ed6\u95ee\u8fd9\u6837\u7684\u5e73\u5747\u8ddd\u79bb\u9664\u4e86\u5bf9\u76f4\u7ebf\u6709\u5916\uff0c\u5bf9\u5706\u4e5f\u6709\u4e48\uff1f<\/p>\n\n\n\n<p>\u6211\u5f00\u59cb\u7528\u79ef\u5206\u7b97\u4e86\u4e00\u4e0b\uff0c\u5f97\u5230\u4e00\u4e2a\u5de8\u590d\u6742\u7684\u7ed3\u679c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"523\" src=\"https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-5-1024x523.png\" alt=\"\" class=\"wp-image-4857\" srcset=\"https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-5-1024x523.png 1024w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-5-300x153.png 300w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-5-768x392.png 768w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-5-1536x784.png 1536w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-5-500x255.png 500w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-5.png 1696w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u540e\u6765\u7a0d\u5fae\u4f18\u5316\u4e86\u4e00\u4e0b\uff0c<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"107\" src=\"https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-6-1024x107.png\" alt=\"\" class=\"wp-image-4858\" srcset=\"https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-6-1024x107.png 1024w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-6-300x31.png 300w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-6-768x80.png 768w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-6-1536x160.png 1536w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-6-500x52.png 500w, https:\/\/www.highflybird.com\/blog\/wp-content\/uploads\/2020\/02\/cqjson-6.png 1691w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u4f46\u53ef\u4ee5\u770b\u51fa\uff0c\u8fd9\u5df2\u7ecf\u4e0d\u662f\u53ef\u4ee5\u7528\u521d\u7b49\u51fd\u6570\u6765\u8868\u8fbe\u7684\u4e86\uff0c\u5df2\u7ecf\u7528\u4e86\u692d\u5706\u79ef\u5206\u6765\u8868\u8fbe\u4e86\u3002\u7136\u540e\uff0c\u4ed6\u53c8\u7ee7\u7eed\u95ee\u4e86\u4e00\u4e2a\u95ee\u9898\uff0c<strong>\u5728\u4e00\u4e2a\u4e09\u89d2\u5f62\u5185\uff0c\u662f\u5426\u5b58\u5728\u8fd9\u6837\u7684\u4e00\u4e2a\u70b9\uff0c\u4f7f\u5f97\u70b9\u5230\u8fd9\u4e09\u6761\u7ebf\u6bb5\u7684\u4e0a\u8ff0\u5e73\u5747\u503c\u76f8\u7b49\uff1f<\/strong><\/p>\n\n\n\n<p>\u5728\u6211\u770b\u6765\uff0c\u4e00\u822c\u60c5\u51b5\u4e0b\u5b58\u5728\u8fd9\u4e2a\u70b9\uff0c\u539f\u56e0\u5982\u4e0b\uff1a<br>\u56e0\u4e3a\u4e00\u70b9(x,y)\u5230\u7ebf\u6bb5\u7684\u5e73\u5747\u503c\u7684\u79ef\u5206\u89e3\u662f\u4e00\u4e2a\u4e0ex,y\u6709\u5173\u7684\u4e8c\u5143\u51fd\u6570<br>\u56e0\u6b64&nbsp;\u53e6&nbsp;&nbsp;&nbsp;p1p2\u7684&nbsp;\u503c&nbsp;&nbsp;\u8bbe\u4e3af1(x,y),&nbsp;p2p3\u7684\u503c\u8bbe\u7f6e\u4e3af2(x,y),p3p1\u7684\u503c\u8bbe\u7f6e\u4e3af3(x,y)<br>\u663e\u7136\u6709&nbsp;&nbsp;f1(x,y)=f2(x,y);&nbsp;f2(x,y)=f3(x,y)<br> \u8fd9\u662f\u4e00\u4e2a\u4e8c\u5143\u65b9\u7a0b\u7ec4\uff0c\u5e94\u8be5\u6709\u4e00\u4e2a\u89e3\uff0c\u4f46 \u4f30\u8ba1\u65e0\u6cd5\u7528\u516c\u5f0f\u6c42\u89e3\uff0c\u53ea\u80fd\u6570\u503c\u6c42\u89e3\u4e86\u3002<\/p>\n\n\n\n<p>\u4e0b\u9762\u8d34\u51fa\u4e00\u4e9bLISP\u4ee3\u7801\u6765\u9a8c\u8bc1\u6c42\u89e3\u3002<\/p>\n\n\n<p><\/p>\n<pre lang=\"lisp\">(defun ALG:AverageLength (p p1 p2 \/ A A1 A2 A3 A4 H HH L RT V)\n  (setq L (distance p1 p2))\n  (setq v (trans (mapcar '- p p1) 0 (mapcar '- p2 p1)))\n  (setq h (abs (car v)))\n  (setq a (- (caddr v)))\n  (if (&gt; L 0)\n    (progn\n      (setq a (\/ a L))\n      (setq h (\/ h L))\n      (setq hh (* h h))\n      (setq a1 (+ (* a a) hh))\n      (setq a2 (+ a1 a a 1))\n      (setq a3 (sqrt a1))\n      (setq a4 (sqrt a2))\n      (if (equal hh 0 1e-8)\n\t(setq rt (+ (* a (- a4 a3)) a4))\n        (setq rt (+ (* a (- a4 a3))\n\t\t    (* hh (- (log (+ a 1 a4)) (log (+ a a3))))\n\t\t    a4\n\t         )\n        )\n      )\n      (setq rt (* 0.5 rt L))\n    )\n    (distance p p1)\n  )\n)\n\n;(1\/2)*a*sqrt(a^2+h^2)-(1\/2)*h^2*ln(-a+sqrt(a^2+h^2))+(1\/2)*b*sqrt(b^2+h^2)+(1\/2)*h^2*ln(b+sqrt(b^2+h^2))\n;;;\u91c7\u7528\u79ef\u5206\u6cd5\n(defun ALG:AverageLength2 (p p1 p2 \/ A AH B BH H HH L V rt)\n  (setq L (distance p1 p2))\n  (setq v (trans (mapcar '- p p1) 0 (mapcar '- p2 p1)))\n  (setq h (abs (car v)))\n  (setq a (caddr v))\n  (setq b (- L a))\n  (if (equal L 0 1e-8)\n    (distance p p1)\n    (if (equal h 0 1e-8)\n      (\/ (+ (* a a) (* b b)) 2 L)\n      (setq a  (\/ a L)\n\t    b  (\/ b L)\n\t    h  (\/ h L)\n\t    hh (* h h)\n\t    ah (sqrt (+ (* a a) hh))\n\t    bh (sqrt (+ (* b b) hh))\n\t    rt (* hh (log (\/ (+ b bh) (- ah a))))\n            rt (* 0.5 L (+ RT (* a ah) (* b bh)))\n      )\n    )\n  )\n)\n\n;;;\u6536\u655b\u5f88\u6162\n(defun ALG:AverageLength1 (p p1 p2 \/ A AV D H HH I L N S UN V X)\n  (setq L (distance p1 p2))\n  (setq v (trans (mapcar '- p p1) 0 (mapcar '- p2 p1)))\n  (setq h (abs (car v)))\n  (setq a (- (caddr v)))\n  (if (&gt; L 0)\n    (progn\n      (setq n 1000)\n      (setq i 0)\n      (setq s 0)\n      (setq hh (* h h))\n      (setq un (\/ L n))\n      (repeat (1+ n)\n\t(setq x (+ a (* i un)))\n        (setq d (sqrt (+ (* x x) hh)))\n\t(setq s (+ s d))\n\t(setq i (1+ i))\n      )\n      (setq av (\/ s (1+ n)))\n    )\n    (distance p p1)\n  )\n)\n\n(defun ALG:AverageLengthOfCircle (p c r \/ A D I L N U X Y)\n  (setq p (mapcar '- p c))\n  (setq i 0)\n  (setq l 0)\n  (setq n 36000)\n  (setq u (\/ pi n))\n  (repeat n\n    (setq a (\/ i u))\n    (setq x (* r (cos a)))\n    (setq y (* r (sin a)))\n    (setq d (distance p (list x y)))\n    (setq l (+ d l))\n    (setq i (1+ i))\n  )\n  (\/ l n)\n)\n\n(defun c:xx ()\n  (initget 9)\n  (setq p (getpoint \"\\n\u76f4\u7ebf\u5916\u4e00\u70b9:\"))\n;;;  (initget 9)\n;;;  (setq c (getpoint \"\\n\u5706\u5fc3:\"))\n;;;  (initget 15)\n;;;  (setq r (getdist C \"\\n\u534a\u5f84:\"))\n  (setq c '(0 0))\n  (setq r 1)\n  (setq z (ALG:AverageLengthOfCircle p c r))\n  (princ \"\\n\u6240\u6c42\u7684\u503c\u4e3a: \")\n  (princ (rtos z 2 20))\n  (princ)\n)\n\n(defun c:gg ()\n  (setq i 0)\n  (setq p0 '(0 0))\n  (setq l 0)\n  (setq x 0)\n  (setq n 1000000)\n  (setq u (\/ 1.0 n))\n  (repeat n\n    (setq y (cos x))\n    (setq d (distance p0 (list x y)))\n    (setq l (+ l d))\n    (setq x (* i u))\n    (setq i (1+ i))\n  )\n  (setq v (\/ l n))\n  (princ \"\\n\u6240\u6c42\u7684\u503c\u4e3a: \")\n  (princ (rtos v 2 20))\n  (princ)\n)\n\n(defun c:ccc()\n  (initget 9)\n  (setq p (getpoint \"\\n\u76f4\u7ebf\u5916\u4e00\u70b9:\"))\n  (setq p (trans p 1 0))\n  (initget 9)\n  (setq p1 (getpoint \"\\n\u76f4\u7ebf\u7b2c\u4e00\u70b9:\"))\n  (setq p1 (trans p1 1 0))\n  (initget 9)\n  (setq p2 (getpoint \"\\n\u76f4\u7ebf\u7b2c\u4e00\u70b9:\"))\n  (setq p2 (trans p2 1 0))\n  (setq x (ALG:AverageLength p p1 p2))\n  (princ (strcat \"\\n\u6240\u6c42\u7684\u5e73\u5747\u503c\u662f:\" (rtos x 2 20)))\n  (setq x1 (ALG:AverageLength1 p p1 p2))\n  (princ (strcat \"\\n\u6781\u9650\u6cd5\u6240\u6c42\u7684\u5e73\u5747\u503c\u662f:\" (rtos x1 2 20)))\n\n  (setq x2 (ALG:AverageLength2 p p1 p2))\n  (princ (strcat \"\\n\u79ef\u5206\u6cd5\u6240\u6c42\u7684\u5e73\u5747\u503c\u662f:\" (rtos x2 2 20)))\n\n;;;  (UTI:BENCH 1000\n;;;    (list\n;;;      (list 'ALG:AverageLength p p1 p2)\n;;;      (list 'ALG:AverageLength1 p p1 p2)\n;;;    )\n;;;  )\n  \n  (princ)\n)<\/pre>\n<p><\/p>\n<p>\u6709\u5174\u8da3\u7684\u4e0d\u59a8\u6d4b\u8bd5\u4e00\u4e0b\u3002<\/p>","protected":false},"excerpt":{"rendered":"<p>\u4e00\u4e2a\u535a\u58eb\u670b\u53cb\u7684\u513f\u5b50\u521a\u4e0a\u521d\u4e2d\u4e0d\u4e45\uff0c\u4ed6\u5c31\u63d0\u51fa\u4e86\u4e0b\u9762\u7684\u4e00\u4e2a\u95ee\u9898\uff0c\u6211\u611f\u89c9\u5f88\u6709\u6df1\u5ea6\uff0c\u5f88\u96be\u5f97\uff0c\u73b0\u5728\u8d34\u51fa\u6765\u8bf4\u8bf4\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[4,9],"tags":[69,68],"class_list":["post-4850","post","type-post","status-publish","format-standard","hentry","category-math","category-programming","tag-69","tag-68"],"_links":{"self":[{"href":"https:\/\/www.highflybird.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4850","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.highflybird.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.highflybird.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.highflybird.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.highflybird.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4850"}],"version-history":[{"count":0,"href":"https:\/\/www.highflybird.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4850\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.highflybird.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4850"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.highflybird.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4850"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.highflybird.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4850"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}