[从头学数学] 第118节 实数

来源:互联网 发布:查找效率最高的算法 编辑:程序博客网 时间:2024/04/28 14:53
剧情提要:
[机器小伟]在[工程师阿伟]的陪同下进入了筑基初期的修炼,
这次要修炼的目标是[实数]。

正剧开始:

星历2016年03月03日 09:27:04, 银河系厄尔斯星球中华帝国江南行省。
[工程师阿伟]正在和[机器小伟]一起研究实数。






<span style="font-size:18px;">#例1100^0.5 = 10, (49÷64)^0.5 = 0.875, 0.0001^0.5 = 0.01, </span>


<span style="font-size:18px;">#例23136^0.5 = 56, 2^0.5 = 1.414, </span>



<span style="font-size:18px;">#例4100^0.5 = 10, (9÷16)^0.5 = 0.75, 0.25^0.5 = 0.5, </span>


<span style="font-size:18px;">#例536^0.5 = 6, -(0.81)^0.5 = -0.9, (49÷9)^0.5 = 2.333, </span>

<span style="font-size:18px;">#例64^(1÷3) = 4.0, -(1÷8)^(1÷3) = -0.5, -(27÷64)^(1÷3) = -0.75, </span>

<span style="font-size:18px;">#例2(3^0.5+2^0.5)-2^0.5 = 1.732, 3×3^0.5+2×3^0.5 = 8.66, 5^0.5+3.142 = 5.378, 3^0.5×2^0.5 = 2.449, </span>

<span style="font-size:18px;">#例35^0.5+3.142 = 5.378, 3^0.5×2^0.5 = 2.449, </span>


小伟就来做纸盒了:

<span style="font-size:18px;">function myDraw() {         var config = new PlotConfiguration();          config.init();          config.setPreference();         config.setSector(1,1,1,1);      config.axis3D(0, 0, 0, 180);            var r = 141.4;  var grd1 = plot.createLinearGradient(0, 0, 0, r);grd1.addColorStop(0, 'yellow');grd1.addColorStop(1, '#00FF88');shape.drawCubic(-0.5, -0.5, 0, r, grd1);      }function myDraw() {         var config = new PlotConfiguration();          config.init();          config.setPreference();         config.setSector(1,1,1,1);      config.axis3D(0, 0, 0, 180);            var r = 141.4;  var grd1 = plot.createLinearGradient(0, 0, 0, r);grd1.addColorStop(0, 'yellow');grd1.addColorStop(1, '#00FF88');var array = [[-2,0],[-1, 0], [0, 0], [1, 0], [0, 1], [0, -1]];plot.translate(100, 0);plot.setFillStyle(grd1);for (var i = 0; i < array.length; i++) {shape.fillRect(array[i][0]*r, array[i][1]*r, r-1, r-1);}      }</span>





还有一个圆柱,不过在开始之前,小伟又整理了一下椭圆工具:

<span style="font-size:18px;">/*** @usage   绘制三维的椭圆,平行于xz | yz | xz平面,其余情况忽略* @author  mw* @date    2016年02月21日  星期日  08:29:00 * @param   以[x,y,z]三维点为中心,r为半径的椭圆* @return  椭圆上点按顺时针排列的数组,已转为二维视图坐标**/function ellipse(xyz, r, face) {var center = new Array();center = xyz;var retArray = new Array();var angle = 0;var x, y, z;face = face ? face : 'xz';//圆周细分为32点for (var i = 0; i < 32; i++) {if (face == 'xz') {//平行xz平面x = center[0] + r * Math.cos(angle-Math.PI/8);y = -center[1];z = center[2] + r * Math.sin(angle-Math.PI/8);}else if (face == 'yz') {//平行yz平面x = center[0];y = -center[1] + r * Math.sin(angle-Math.PI/8);z = center[2] + r * Math.cos(angle-Math.PI/8);}else {//平行xy平面x = center[0] + r * Math.cos(angle-Math.PI/8);y = -center[1] + r * Math.sin(angle-Math.PI/8);z = center[2];}retArray.push(point3D(x, y, z));angle += Math.PI*2/32;}return retArray;}function myDraw() {         var config = new PlotConfiguration();          config.init();          config.setPreference();         config.setSector(1,1,1,1);      config.axis3D(0, 0, 0, 180);            var r = 200;  var array = ellipse([0,0,0], r);var array2 = ellipse([0, 100, 0], r);var tmp = [].concat(array);shape.strokeDraw(tmp);for (var i = 0; i < 32; i++) {plot.beginPath().moveTo(array[i][0], array[i][1]).lineTo(array2[i][0], array2[i][1]).closePath().stroke();}      }</span>


来做圆柱吧:

<span style="font-size:18px;">function myDraw() {         var config = new PlotConfiguration();          config.init();          config.setPreference();         config.setSector(1,1,1,1);      config.axis3D(0, 0, 0, 180);            var r = 100;  plot.setGlobalAlpha(0.5);var grd1 = plot.createLinearGradient(0, 0, 0, r);grd1.addColorStop(0, 'yellow');grd1.addColorStop(1, '#00FF88');var array1 = ellipse([0, -r, 0], r);var array2 = ellipse([0, r, 0], r);var len = array1.length;var tmp = [];tmp = [].concat(array1);shape.fillDraw(tmp, 'yellow');tmp = [].concat(array2);shape.fillDraw(tmp, '#00FF88');for (var i = 0; i < len; i++) {if (i != len-1) {tmp = [array1[i], array1[i+1], array2[i+1], array2[i]];}else {tmp = [array1[i], array1[0], array2[0], array2[i]];}shape.fillDraw(tmp, grd1);}      }function myDraw() {         var config = new PlotConfiguration();          config.init();          config.setPreference();         config.setSector(1,1,1,1);      config.axis2D(0, 0, 180);            var r = 10*6;  plot.setGlobalAlpha(0.5);var grd1 = plot.createLinearGradient(0, 0, 0, r);grd1.addColorStop(0, 'yellow');grd1.addColorStop(1, '#00FF88');plot.setFillStyle(grd1);shape.fillCircle(0, r+r, r);shape.fillCircle(0, -r-r, r);shape.fillRect(0, 0, 2*3.1416*r, 2*r);      </span>




华大师真是神人,为此小伟仔细研究了一下个位数字的立方规律:

<span style="font-size:18px;">>>> 0 --> 01 --> 12 --> 83 --> 74 --> 45 --> 56 --> 67 --> 38 --> 29 --> 9def tmp():    for i in range(10):        print(i, '-->', i**3%10);</span>


原来果然是不重不漏,一一对应。

这样就可以解答出最后的问题了。

<span style="font-size:18px;">>>> 27**319683>>> 48**3110592</span>


本节到此结束,欲知后事如何,请看下回分解。


0 0
原创粉丝点击