正剧开始:
星历2016年03月03日 10:59:03, 银河系厄尔斯星球中华帝国江南行省。
[工程师阿伟]正在和[机器小伟]一起研究[实数 小结与复习题]。
<span style="font-size:18px;">#题1 64^0.5 = 8, 0.25^0.5 = 0.5, (4÷9)^0.5 = 0.667, (5^6)^0.5 = 125, -(4÷13)^2^0.5 = -0.189, (10^6)^0.5 = 1000, #题2 -(1÷64)^(1÷3) = -0.25, -0.008^(1÷3) = -0.2, (27÷8)^(1÷3) = 1.5, (3^6)^(1÷3) = 9.0, #题3 -(49÷25)^0.5 = -1.4, -1^(1÷3) = -1, 0.16^0.5 = 0.4, 0.027^(1÷3) = 0.3, </span>
<span style="font-size:18px;">#题4 28^0.5 = 5.292, 38^0.5 = 6.164, 99^(1÷3) = 4.626, #题5 -94.3^0.5 = -9.711, 0.43^(1÷3) = 0.755, 55225^0.5 = 235, 34012224^(1÷3) = 324.0, #题8 2^0.5×(2^0.5+2) = 4.828, 3^0.5×(3^0.5+1÷3^0.5) = 4.0, </span>
<span style="font-size:18px;">function myDraw() { var config = new PlotConfiguration(); config.init(); config.setPreference(); config.setSector(1,1,1,1); config.axis1D(0, 0, 180); var r = 180-10; //刻度 scale; graduation ; var scale = r / 10; var array = []; var min = Math.ceil(-2*Math.PI), max = Math.ceil(2*Math.PI); for (var i = min; i < max; i+=1) { array.push(i); } var size = array.length; array.sort(function(a, b) { return a-b;}); //plot.fillText(array.join(' '), -100, 50, 400); //存放点阵列 var points = []; for (var i = 0; i < size; i++) { points.push([array[i]*scale, 0]); } //由于shape采用的是弹出数据的方式,所以拷贝一个副本来进行操作 var tmp = points; shape.pointDraw(tmp, 'green'); for (var i = 0; i < size; i++) { plot.fillText(array[i].toString(), array[i]*scale-10, 20, 50); } }</span>
<span style="font-size:18px;">function myDraw() { var config = new PlotConfiguration(); config.init(); config.setPreference(); config.setSector(1,1,1,1); config.axis2D(0, 0, 180); var r = 180-10; //刻度 scale; graduation ; var array = []; var min = 0, max = 50; for (var i = min; i < max; i+=1) { array.push(i); } var array2 = [1.5, 35]; var size = array.length; array.sort(function(a, b) { return a-b;}); //plot.fillText(array.join(' '), -100, 50, 400); //存放点阵列 var points = []; var scale = r/array[size-1]; var s; for (var i = 0; i < size; i++) { s = -Math.sqrt(16.88*array[i]); points.push([array[i]*scale, s*scale]); } shape.pointDraw(points, 'green'); for (var i = 0; i < 2; i++) { s = -Math.sqrt(16.88*array2[i]); points.push([array2[i]*scale, s*scale]); } shape.pointDraw(points, 'blue'); plot.fillText(Math.sqrt(16.88*1.5).toFixed(3), 20, 50, 50); plot.fillText(Math.sqrt(16.88*35).toFixed(3), 20, 100, 50); }</span>
计算工具:
### # @usage 混合运算 # @author mw # @date 2016年01月06日 星期三 09:33:22 # @param # @return # ### def calc(): #import traceback; fin = open('input.txt'); fout= open('output.txt', 'a'); for line in fin.readlines(): if line[-1] == '\n': line = line[:-1]; if line == '': continue; elif line.startswith('#'): print(line); fout.write(line+'\n'); else: try: lines = line.split(sep=' '); for i in range(len(lines)): if lines[i]=='': continue; try: result = eval(lines[i]); if (abs(result - int(result)) < 0.0001): result = int(result); else: result = round(result, 3); lines[i] = lines[i].replace('**','^'); lines[i] = lines[i].replace('*','×'); lines[i] = lines[i].replace('//', '÷'); lines[i] = lines[i].replace('/', '÷'); s = '{0} = {1}'.format(lines[i], result); print(s, end=', '); fout.write(s + ', '); except: #traceback.print_exc(); ex = '{0} 表达式有误,无法进行计算。'.format(lines[i]); print(ex); fout.write(ex); print('\n'); fout.write('\n'); except: #traceback.print_exc(); ex = '{0} 表达式有误,无法进行计算。'.format(lines[i]); print(ex); fout.write(ex); fout.write('\n'); fout.close(); fin.close(); return;
本节到此结束,欲知后事如何,请看下回分解。