标签:
剧情提要:正剧开始:
星历2016年04月25日 08:42:55, 银河系厄尔斯星球中华帝国江南行省。
[工程师阿伟]正在和[机器小伟]一起研究[数系的扩充与复数的引入]。
<span style="font-size:18px;">#复数的虚部必须是数字+'j'的格式,否则报错 def tmp(): a = (5-6j)+(-2-1j)-(3+4j); print(a); >>> -11j</span>CD和OE都是结果:
<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); //坐标轴设定 var scaleX = 2*r, scaleY = 2*r; var spaceX = 3, spaceY = 3; var xS = -15, xE = 15; var yS = -15, yE = 15; config.axisSpacing(xS, xE, spaceX, scaleX, 'X'); config.axisSpacing(yS, yE, spaceY, scaleY, 'Y'); var array2D = [[0, 0], [5, -6], [-2,-1],[3, 4], [3, -7], [0, -11]]; //去除重复点 var pointArray = removeDuplicatedPoint(array2D); //无重复的点的数量 var points = pointArray.length; //得到距离阵列 //格式为[[点1序号,点2序号, 距离值], ...] var distanceArray = distanceSort(pointArray); //边的数量 var edges = distanceArray.length; //存放需要连通的边 var linkedArray = []; //连通的边的数量 var links = 0; //每个顶点相关的边的集合 var edgeOfVertex = []; for (var i = 0; i < points; i++) { //获得顶点相关的边的集合 edgeOfVertex = []; for (var j = 0; j < edges; j++) { if (distanceArray[j][0] == i || distanceArray[j][1] == i) { edgeOfVertex.push(distanceArray[j]); } } //根据起始点寻找最短长度的两条边 edgeOfVertex.sort(function(a, b) { return a[2] - b[2]; }); var choice = 3; 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; //比例缩放 var scale = scaleX/spaceX; 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, 'OABCDEFGHIJKLMN'); }</span>
<span style="font-size:18px;">>>> (3+4j)*(3-4j); (25+0j) >>> (1+1j)**2 2j </span>结果OC:
结果OB:
结果OC:
共轭复数:
<span style="font-size:18px;">>>> complex.conjugate(1+2j); (1-2j)</span>OA和OB共轭。
本节到此结束,欲知后事如何,请看下回分解。
标签:
原文地址:http://blog.csdn.net/mwsister/article/details/51239693