正剧开始:
星历2016年05月07日 12:11:48, 银河系厄尔斯星球中华帝国江南行省。
[工程师阿伟]正在和[机器小伟]一起研究[不等式选讲]。
<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,180); //坐标轴设定 var scaleX = 2*r, scaleY = 2*r; var spaceX = 2, spaceY = 2; var xS = -10, xE = 10; var yS = -8, yE = 8; config.axisSpacing(xS, xE, spaceX, scaleX, 'X'); config.axisSpacing(yS, yE, spaceY, scaleY, 'Y'); var transform = new Transform(); //存放函数图像上的点 var a = [], b = [], c = [], d = []; //需要显示的函数说明 var f1 = 'y=(x+3)*(x+7)-(x+4)*(x+6)', f2 = 'y=', f3 = '', f4 = ''; //函数描点 for (var x = xS; x <= xE; x+=1) { a.push([x, taskFun(x)]); } //存放临时数组 var tmp = []; //显示变换 if (a.length > 0) { a = transform.scale(transform.translate(a, 0, 0), scaleX/spaceX, scaleY/spaceY); //函数1 tmp = [].concat(a); shape.pointDraw(tmp, 'red'); tmp = [].concat(a); shape.multiLineDraw(tmp, 'pink'); plot.setFillStyle('red'); plot.fillText(f1, -270, -90, 400); } if (b.length > 0) { b = transform.scale(transform.translate(b, 0, 0), scaleX/spaceX, scaleY/spaceY); //函数2 // tmp = [].concat(b); // shape.pointDraw(tmp, 'blue'); tmp = [].concat(b); shape.multiLineDraw(tmp, '#22CCFF'); plot.setFillStyle('blue'); plot.fillText(f2, -270, -120, 400); } } } function taskFun(x) { return (x+3)*(x+7)-(x+4)*(x+6); }</span>
<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,180); //坐标轴设定 var scaleX = 2*r, scaleY = 2*r; var spaceX = 2, spaceY = 2; var xS = -10, xE = 10; var yS = -8, yE = 8; config.axisSpacing(xS, xE, spaceX, scaleX, 'X'); config.axisSpacing(yS, yE, spaceY, scaleY, 'Y'); var transform = new Transform(); //存放函数图像上的点 var a = [], b = [], c = [], d = []; //需要显示的函数说明 var f1 = 'y=0.38+0.04*x*x+4/(x*x)', f2 = 'y=', f3 = '', f4 = ''; var y = 0; //函数描点 for (var x = 0.1; x <= xE; x+=0.1) { y = taskFun(x); a.push([x, y]); d.push([x, y]); } //存放临时数组 var tmp = []; d.sort(function(p1, p2) { return (p1[1]-p2[1]); }); var x0 = d[0][0], y0 = d[0][1]; //显示变换 if (a.length > 0) { a = transform.scale(transform.translate(a, 0, 0), scaleX/spaceX, scaleY/spaceY); //函数1 tmp = [].concat(a); shape.pointDraw(tmp, 'red'); tmp = [].concat(a); shape.multiLineDraw(tmp, 'pink'); plot.setFillStyle('red'); plot.fillText(f1, -270, -90, 400); } b.push([x0, y0]); if (b.length > 0) { b = transform.scale(transform.translate(b, 0, 0), scaleX/spaceX, scaleY/spaceY); //最值点 tmp = [].concat(b); shape.pointDraw(tmp, 'blue'); //tmp = [].concat(b); //shape.multiLineDraw(tmp, '#22CCFF'); plot.setFillStyle('blue'); plot.fillText(x0.toFixed(3)+', '+y0.toFixed(3), b[0][0], -b[0][1]-20, 100); } } } function taskFun(x) { return 0.38+0.04*x*x+4/(x*x); }</span>
<span style="font-size:18px;"> if (1) { var r = 20; config.setSector(1,5,1,1); config.graphPaper2D(0, 0, r); config.axis2D(0, 0,180, 3); //坐标轴设定 var scaleX = 2*r, scaleY = 2*r; var spaceX = 0.05, spaceY = 0.05; var xS = -10, xE = 10; var yS = -8, yE = 8; config.axisSpacing(xS, xE, spaceX, scaleX, 'X'); config.axisSpacing(yS, yE, spaceY, scaleY, 'Y'); var transform = new Transform(); //存放函数图像上的点 var a = [], b = [], c = [], d = []; //需要显示的函数说明 var f1 = 'y=(1-2*x)*(1-2*x)*x', f2 = 'y=', f3 = '', f4 = ''; var y = 0; //函数描点 for (var x = 0; x <= 0.5; x+=0.01) { y = taskFun(x); a.push([x, y]); d.push([x, y]); } //存放临时数组 var tmp = []; //显示变换 if (a.length > 0) { a = transform.scale(transform.translate(a, 0, 0), scaleX/spaceX, scaleY/spaceY); //函数1 tmp = [].concat(a); shape.pointDraw(tmp, 'red'); tmp = [].concat(a); shape.multiLineDraw(tmp, 'pink'); plot.setFillStyle('red'); plot.fillText(f1, 30, -100, 400); } d.sort(function(p1, p2) { //求最大值加负号,最小值不加 return -(p1[1]-p2[1]); }); var x0 = d[0][0], y0 = d[0][1]; b.push([x0, y0]); if (b.length > 0) { b = transform.scale(transform.translate(b, 0, 0), scaleX/spaceX, scaleY/spaceY); //最值点 tmp = [].concat(b); shape.pointDraw(tmp, 'blue'); //tmp = [].concat(b); //shape.multiLineDraw(tmp, '#22CCFF'); plot.setFillStyle('blue'); plot.fillText(x0.toFixed(3)+', '+y0.toFixed(3), b[0][0], -b[0][1]-20, 100); } } } function taskFun(x) { //var a = x, b = a+1, c = b+1; return (1-2*x)*(1-2*x)*x; } >>> 2/27 0.07407407407407407</span>
<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,180); //坐标轴设定 var scaleX = 2*r, scaleY = 2*r; var spaceX = 1, spaceY = 2; var xS = -100, xE = 100; var yS = -100, yE = 100; config.axisSpacing(xS, xE, spaceX, scaleX, 'X'); config.axisSpacing(yS, yE, spaceY, scaleY, 'Y'); var transform = new Transform(); //存放函数图像上的点 var a = [], b = [], c = [], d = []; //需要显示的函数说明 var f1 = 'y=(Math.abs(x-1)+Math.abs(x+2))-5', f2 = 'y=', f3 = '', f4 = ''; var y = 0; //函数描点 for (var x = xS; x <= xE; x+=1) { y = taskFun(x); a.push([x, y]); d.push([x, y]); } //存放临时数组 var tmp = []; //显示变换 if (a.length > 0) { a = transform.scale(transform.translate(a, 0, 0), scaleX/spaceX, scaleY/spaceY); //函数1 tmp = [].concat(a); shape.pointDraw(tmp, 'red'); tmp = [].concat(a); shape.multiLineDraw(tmp, 'pink'); plot.setFillStyle('red'); plot.fillText(f1, 30, -100, 400); } d.sort(function(p1, p2) { //求最大值加负号,最小值不加 return (p1[1]-p2[1]); }); var x0 = d[0][0], y0 = d[0][1]; b.push([x0, y0]); if (b.length > 0) { b = transform.scale(transform.translate(b, 0, 0), scaleX/spaceX, scaleY/spaceY); //最值点 tmp = [].concat(b); shape.pointDraw(tmp, 'blue'); //tmp = [].concat(b); //shape.multiLineDraw(tmp, '#22CCFF'); plot.setFillStyle('blue'); plot.fillText(x0.toFixed(3)+', '+y0.toFixed(3), b[0][0], -b[0][1]-20, 100); } } } function taskFun(x) { //var a = x, b = a+1, c = b+1; return (Math.abs(x-1)+Math.abs(x+2))-5; }</span>
<span style="font-size:18px;">0.16666666666666669 -- 0.25 -- 0.5 0.25 -- 0.3611111111111111 -- 0.6666666666666666 0.3 -- 0.4236111111111111 -- 0.75 0.33333333333333337 -- 0.4636111111111111 -- 0.8 0.35714285714285715 -- 0.4913888888888889 -- 0.8333333333333334 0.375 -- 0.511797052154195 -- 0.8571428571428571 0.3888888888888889 -- 0.527422052154195 -- 0.875 0.4 -- 0.5397677311665408 -- 0.8888888888888888 0.40909090909090906 -- 0.5497677311665408 -- 0.9 def tmp(): for n in range(2, 11): a_1 = 1/2-1/(n+1); a_2 = 0; for i in range(2, n+1): a_2 += 1/(i*i); a_3 = (n-1)/n; print(a_1, ' -- ', a_2, ' -- ', a_3); n = 10000时:0.4999000099990001 -- 0.6448340718480534 -- 0.9999</span>
<span style="font-size:18px;"> if (1) { var mathText = new MathText(); //希腊字母表(存此用于Ctrl C/V //ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ //αβγδεζηθικλμνξοπρστυφχψω var s = [ /* 'V=[PI]*r^[2]*h', 'S=2*[PI]*r^[2]+2*[PI]*r*h', ' = 2*[PI]*r^[2]+2V/r', '>=3*(V/r*V/r*2[pi]r^[2])^[1/3]', '=3*(2[PI]V^[2])^[1/3]', '4*[PI]*r-2V/r^[2] = 0 => r = (V/(2[PI]))^[1/3]', 'h = (4V/[PI])^[1/3]',*/ ' ', 'V = 1/3SH', 'r = R(2[PI]-θ)/2[PI]', 'H = R(1-((2[PI]-θ)/2[PI])^[2])^[1/2]' ]; var x =40, y=40; var r1 = 40; var len = s.length; for (var i = 0; i < len; i++) { if (s[i] == '') { if (x < 100) { x += 300; y-=r1*3; } else { x = 20; y += r1; } } else { mathText.print(s[i], x, y, '@'); y+=r1; } } }</span>
<span style="font-size:18px;">>>> 338350 -- 171700 def tmp(): a1 = list(range(1, 101)); a2 = list(range(100, -1, -1)); sum_1 = 0; sum_2 = 0; for i in range(len(a1)): sum_1 += a1[i]*a1[i]; sum_2 += a1[i]*a2[i]; print(sum_1, ' -- ', sum_2);</span>
本节到此结束,欲知后事如何,请看下回分解。