[ab initio mathematics] 193th section reasoning and Proof

Source: Internet
Author: User
Tags acos cos

plot summary:
[Machine Xiao Wei] in the [engineer Ah Wei] accompanied by the [nine turn elixir] of the five-turn of the cultivation.
This is a study of [reasoning and proof].

Drama Start:

Star Calendar April 24, 2016 12:16:07, the Milky Way Galaxy Earles the Chinese Empire Jiangnan Line province.
[Engineer Ah Wei] is working with [machine Xiao Wei] to study [reasoning and proof].






<span style= "FONT-SIZE:18PX;" >>>> 23.5 13.865424623862042# Helen-Qin Jiushao formula  def hqformula (A, B, c):      p = (a+b+c)/2;      S = Math.sqrt (p* (p-a) * (p-b) * (p-c));        return S; #例3def tmp ():    #a, B, C = 3, 4, 5    A, B, C = 3, 4, 5    s1= a*b/2    S2 = a*c/2    S3 = b*c/2    S4 = H Qformula ((a*a+b*b) **0.5, (A*a+c*c) **0.5, (b*b+c*c) **0.5);    Print (S1+S2+S3, S4);</span>




<span style= "FONT-SIZE:18PX;" >if (1) {var array = new Array (); array[0] = [1];array[1] = [1,1];for (var i = 2; i <; i++) {Array[i] = [1];for (v Ar j = 1; J < I; J + +) {Array[i].push (array[i-1][j-1]+array[i-1][j]);} Array[i].push (1);} var width = n, height = 400;var x = width/2, y = 30;var measure = 0, s = ' '; var len = Array.length;for (var i = 0; I < ; Len i++) {s = array[i].join ('    ); measure = Plot.measuretext (s);p Lot.filltext (S, x-measure/2, y, measure); y + = 30;}} </span>






About seeking dihedral angle, Xiao Wei found this formula:

<span style= "FONT-SIZE:18PX;" >>>> cos = 0.9218142082600806 angle is: 22.80723538641745 degrees #[] dihedral angle; #二面角余弦def dihedral (): xyz = [-1.           2999760,0.0173840,-0.7162670, 1.0107690,1.5229620,-0.0945670, 0.0932470,-1.0086090,1.6265070,    -1.2280340,-1.4934410,1.8123150, 0.0932470,-1.0086090,1.6265070, 1.0734260,-1.5230970,2.5155820] #六个点 ax1 = xyz[0] Ay1 = xyz[1] az1 = xyz[2] bx2 = xyz[3] by2 = xyz[4] bz2 = xyz[5] cx3 = xyz[6] Cy 3 = xyz[7] cz3 = xyz[8] dx1 = xyz[9] dy1 = xyz[10] dz1 = xyz[11] ex2 = xyz[12] Ey2 = xyz[13] EZ2 = XY Z[14] fx3 = xyz[15] Fy3 = xyz[16] fz3 = xyz[17] #面一法线 NX = ((CZ3-AZ1)/(Cy3-ay1)-(BZ2-AZ1)/(By2-ay1))/((bx2- AX1)/(By2-ay1)-(CX3-AX1)/(cy3-ay1)) NY = ((CZ3-AZ1)/(CX3-AX1)-(BZ2-AZ1)/(BX2-AX1))/((By2-ay1)/(BX2-AX1)-(Cy3-ay1) /(CX3-AX1)) NZ = 1 #面二法线 mx = ((FZ3-DZ1)/(fy3-dy1)-(EZ2-DZ1)/(EY2-DY1))/((EX2-DX1)/(ey2-dy1)-(FX3-DX1)/(fy3-dy1)) my = ((FZ3-DZ1)/(FX3-DX1)-(EZ2-DZ1)/(EX2-DX1))/((ey2-dy1)/(EX2-DX1)-(fy3-dy1)/(fx3-dx1)) mz = 1 Cosangle = (NX    *MX+NY*MY+NZ*MZ)/((Math.sqrt (nx**2+ny**2+nz**2)) * (Math.sqrt (mx**2+my**2+mz**2))); Print (' cos = ', cosangle, ' angle is: ', 180/math.pi*math.acos (cosangle), ' degrees ');</span>

But in the process of verification, Wei found that the algorithm seems to have problems:

For example, the following:



Ask for VAB and ABC's dihedral angle.

<span style= "FONT-SIZE:18PX;" >>>> [2, 5, 2, 5, 0, 1, 0, 0, 0, 1, 1, 5, 5, 0, 1, 0, 0, 0]cos = 0.4911436350228293 angle: 60.5842228640166 degrees #[] Dihedral angle; #二面角余弦 # temporarily can only be counted not perpendicular or parallel to XY, XZ, yz either plane of the two planes of the dihedral angle # formula looking in ... def dihedral (points): #points格式是 []*18, six points, each point X, y, z-coordinate "' XYZ = [ -1.2999760,0.0173840,-0.7162670, 1.0107690,1.5229620,-0.0945670, 0.093247 0,-1.0086090,1.6265070, -1.2280340,-1.4934410,1.8123150, 0.0932470,-1.0086090,1.6265070, 1.0    734260,-1.5230970,2.5155820] "if (len (points)! =): Return ' INF ';    xyz = points; #六个点 ax1 = xyz[0] Ay1 = xyz[1] az1 = xyz[2] bx2 = xyz[3] by2 = xyz[4] bz2 = xyz[5] cx3 = xyz[6] Cy 3 = xyz[7] cz3 = xyz[8] dx1 = xyz[9] dy1 = xyz[10] dz1 = xyz[11] ex2 = xyz[12] Ey2 = xyz[13] EZ2 = XY Z[14] fx3 = xyz[15] Fy3 = xyz[16] fz3 = xyz[17] #面一法线 NX = ((CZ3-AZ1)/(Cy3-ay1)-(BZ2-AZ1)/(By2-ay1))/((bx2- AX1)/(by2-aY1)-(CX3-AX1)/(cy3-ay1)) NY = ((CZ3-AZ1)/(CX3-AX1)-(BZ2-AZ1)/(BX2-AX1))/((By2-ay1)/(BX2-AX1)-(cy3-ay1)/(CX3-AX1)) NZ = 1 #面二法线 mx = ((FZ3-DZ1)/(fy3-dy1)-(EZ2-DZ1)/(EY2-DY1))/((EX2-DX1)/(ey2-dy1)-(FX3-DX1)/(fy3-dy1)) my = ((fz3- DZ1)/(FX3-DX1)-(EZ2-DZ1)/(EX2-DX1))/((ey2-dy1)/(EX2-DX1)-(fy3-dy1)/(fx3-dx1)) mz = 1 Cosangle = (NX*MX+NY*MY+NZ*MZ)/    ((Math.sqrt (nx**2+ny**2+nz**2)) * (Math.sqrt (mx**2+my**2+mz**2)));    Print (' cos = ', cosangle, ' angle is: ', 180/math.pi*math.acos (cosangle), ' degrees '), #求二面角def tmp (): V = [2, 5, 2] A = [5, 0, 1]    B = [0, 0, 0] C = [1, 1, 5] points = v+ A + b + c+a+b;    #print (len (points));        print (points); Dihedral (points);</span>


Ask VBC and ABC, or VAB and vbc.

<span style= "FONT-SIZE:18PX;" >>>> [2, 5, 2, 0, 0, 0, 1, 1, 5, 1, 1, 5, 5, 0, 1, 0, 0, 0]cos =  -0.2558139534883721 angle: 104.821821062050 12 degrees >>> ================================ RESTART ================================>>> [2, 5, 2, 5, 0, 1 , 1, 1, 5, 1, 1, 5, 5, 0, 1, 0, 0, 0]cos =  0.19218663979154185 angle: 101.08042157684446 degrees </span>

How can be more than 100 degrees, look not like Ah, but little Wei also can not say is right is wrong.

Let's put it on first.


<span style= "FONT-SIZE:18PX;"                    >if (1) {var r = 20;                      Config.setsector (1,1,1,1);                    Config.graphpaper2d (0, 0, R);                                      Config.axis2d (0, 0,190);                  Axis set var ScaleX = 4*r, ScaleY = 4*r;                   var SpaceX = 2, SpaceY = 2;                  var XS = -10, XE = 10;                  var YS = -10, YE = 10;                    Config.axisspacing (XS, XE, SpaceX, ScaleX, ' X ');                                                     Config.axisspacing (YS, YE, SpaceY, ScaleY, ' Y ');            var array = [[2, 5, 2], [5, 0, 1], [0, 0, 0], [1, 1, 5];          Array = shape.xyzsort (array);                      var size = Array.Length;          var array2d = [];          for (var i = 0; i < size; i++) {Array2d.push (Shape.point3d (array[i][0], array[i][1], array[i][2])); }//Remove duplicate point var Pointarray = RemoveduplicaTedpoint (Array2D);                        Number of non-repeating points var points = pointarray.length;            Get the distance array//format as [[Point 1 ordinal, point 2 ordinal, distance value], ...]            var Distancearray = Distancesort (Pointarray);                        The number of sides var edges = distancearray.length;            Store the side var linkedarray = [] that need to be connected;                        Number of connected edges var links = 0;                        The set of edges associated with each vertex var edgeofvertex = []; for (var i = 0; i < points; i++) {//Gets a collection of vertex-related edges edgeofve                Rtex = [];                        for (var j = 0; J < edges; J + +) {if (distancearray[j][0] = = I | |                    DISTANCEARRAY[J][1] = = i) {Edgeofvertex.push (distancearray[j]);                    }}//Based on the starting point, look for the shortest length of two edges edgeofvertex.sort (function (A, b) { return A[2]- B[2];                                });                var choice = 4;                if (Edgeofvertex.length > Choice) {edgeofvertex = Edgeofvertex.slice (0, choice);            } Linkedarray = Linkedarray.concat (Edgeofvertex);            }//document.write (Linkedarray.join (', ') + ' <br/> ');            Linkedarray = Removeduplicatedpoint (Linkedarray);                        Links = linkedarray.length;                            document.write (Linkedarray.join (', ') + ' <br/> ');            var startPoint, EndPoint, x1, y1, x2, y2;                        Scaled var scale = 40;                for (var i = 0; i < links; i++) {startPoint = linkedarray[i][0];                EndPoint = linkedarray[i][1];                x1 = pointarray[startpoint][0];                y1 = pointarray[startpoint][1];                x2 = pointarray[endpoint][0]; y2 = poINTARRAY[ENDPOINT][1];            Shape.vectordraw ([[X1,y1], [X2, Y2]], ' red ', scale);                        } shape.pointdraw (Pointarray, ' blue ', scale, 1, ' vabc ');            Plot.setfillstyle (' Blue ');                  Plot.filltext (' Vector graph ',-270,-170, 300); }</span>



The end of this section, to know how to funeral, please see tell.

[ab initio mathematics] 193th section reasoning and Proof

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.