[从头学数学] 第209节 带着计算机去高考

Posted mwsister

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[从头学数学] 第209节 带着计算机去高考相关的知识,希望对你有一定的参考价值。

剧情提要:
[机器小伟]在[工程师阿伟]的陪同下进入了[九转金丹]之第八转的修炼。设想一个场景:
如果允许你带一台不连网的计算机去参加高考,你会放弃选择一个手拿计算器和草稿本吗
?阿伟决定和小伟来尝试一下用计算机算高考题会是怎样的感觉。

正剧开始:

星历2016年05月16日 17:25:11, 银河系厄尔斯星球中华帝国江南行省。
[工程师阿伟]正在和[机器小伟]一起做着2000年的江苏省数学高考题]。






<span style="font-size:18px;">#题1
>>> 
4

def tmp():
    a = [2, 3, 4, 5];
    f = '2**n+n';

    for i in range(len(a)):
        n = a[i];
        if eval(f) == 20:
            print(n);</span>


<span style="font-size:18px;">#题2
>>> 
(2.999955999354648+1.732076211353316j)

def tmp2():
    a = (3-1.732j);
    thita = math.pi/3;
    b = complex(math.cos(thita), math.sin(thita));
    c = a*b;
    print(c);</span>



<span style="font-size:18px;">#题3
>>> 
D 2.449489742783178

def tmp3():
    ab=2**0.5;
    bc=3**0.5;
    ac=6**0.5
    # => sqrt(a**2+b**2+c**2)

    a2 = ab*ac/bc;
    b2 = ab*bc/ac;
    c2 = bc*ac/ab;

    table = 'ABCD';
    answer = math.sqrt(a2+b2+c2);
    choice = [2*3**0.5, 3*2**0.5, 6, 6**0.5];

    for i in range(len(choice)):
        if abs(choice[i]-answer) < 0.1:
            print(table[i], answer);</span>


<span style="font-size:18px;">#题4
>>> 
象限 1
cos ---  -0.03291312439684896
tan ---  0.11633650601051977
象限 2
cos ---  0.032913124396848896
tan ---  -0.08753362531749721
象限 3
cos ---  -0.032913124396848875
tan ---  -0.11633650601051942
象限 4
cos ---  0.032913124396848896
tan ---  0.08753362531749721


def tmp4():
    #给出60, 45度两个特例
    a = [math.pi/3, math.pi/4];

    for i in range(4):
        thita_1 = a[0]+math.pi/2*i;
        thita_2 = a[1]+math.pi/2*i;
        print('象限', i+1);
		
		#与sin差值相乘判断同号
        d1 = (math.cos(thita_1)-math.cos(thita_2))*(math.sin(thita_1)-math.sin(thita_2));
        d2 = (math.tan(thita_1)-math.tan(thita_2))*(math.sin(thita_1)-math.sin(thita_2));
        print('cos --- ', d1);
        print('tan --- ', d2);</span>



<span style="font-size:18px;">//题5
	 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 = -10, yE = 10;          
        config.axisSpacing(xS, xE, spaceX, scaleX, 'X');            
        config.axisSpacing(yS, yE, spaceY, scaleY, 'Y');            
                    
        var transform = new Transform();            
        //存放函数图像上的点        
        var a = [], b = [], c = [], d = [];          
                  
        //需要显示的函数说明    
                    //希腊字母表(存此用于Ctrl C/V  
            //ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ  
            //αβγδεζηθικλμνξοπρστυφχψω  
        var f1 = 'y = -xcosx', f2 = '', f3 = '', f4 = '';        
            
  
		for (var x = xS; x <= xE; x+=0.4) {  
            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, 100, -180, 200);          
        }  
  
          
    } 
}  

function taskFun(x) {
	return x*Math.cos(x);
}
</span>


<span style="font-size:18px;">#题6
>>> 
当月工资介于 1400 ,  1500

def tmp6():
    a = [];
    d = 26.78;
    
    for i in range(800, 3000, 100):
        if (i < 800):
            a.append(0);
        elif (i < 800+500):
            a.append((i-800)*0.05);
        elif (i < 800+500+1500):
            a.append(500*0.05+(i-1300)*0.1);
        elif (i < 800+2000+3000):
            a.append(500*0.05+1500*0.1+(i-2800)*0.15);

        if (len(a)>2 and a[-2] <d and a[-1]>=d):
            print('当月工资介于', i, ', ', i+100);
            break;
			</span>


<span style="font-size:18px;">#题7
>>> 
0.8726396796036775, 0.8958797346140275, 0.9162907318741551

def tmp7():
    #给定特例
    a, b = 3, 2;

    P = (math.log(a)*math.log(b))**0.5;
    Q = 0.5*(math.log(a)+math.log(b));
    R = math.log((a+b)/2);

    print('{0}, {1}, {2}'.format(P, Q, R));</span>








<span style="font-size:18px;">#题9
>>> 
A 1.1591549430918953

def tmp9():
    h = 1;
    S_side = h*h;
    r = h/(math.pi*2);
    S_total = math.pi*r**2*2+S_side;

    #答案
    answer = S_total/S_side;

    table = 'ABCD';
    #选项
    choice = [1/(math.pi*2)+1, 1/(math.pi*4)+1,
              1/(math.pi)+2, 1/(math.pi*2)+2];

    for i in range(len(choice)):
        if abs(choice[i]-answer) < 0.001:
            print(table[i], answer);</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 = 1;           
        var xS = -5, xE = 5;          
        var yS = -10, yE = 10;          
        config.axisSpacing(xS, xE, spaceX, scaleX, 'X');            
        config.axisSpacing(yS, yE, spaceY, scaleY, 'Y');            
                    
        var transform = new Transform();            
        //存放函数图像上的点        
        var a = [], b = [], c = [], d = [];          
                  
        //需要显示的函数说明    
                    //希腊字母表(存此用于Ctrl C/V  
            //ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ  
            //αβγδεζηθικλμνξοπρστυφχψω  
        var f1 = 'x^2+y^2+4x+3 = 0', f2 = 'y = 1.732/3*x', f3 = 'y=1/(4a)', f4 = '';        
            
		//(1-(x+2)^2)^0.5
		for (var x = xS; x <= xE; x+=0.2) {  
            a.push([x, Math.pow(1-(x+2)*(x+2), 0.5)]);  
			a.push([x, -Math.pow(1-(x+2)*(x+2), 0.5)]); 
			b.push([x, 1.732/3*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, 100, -90, 200);          
        }  
		    
		        //显示变换        
        if (b.length > 0) {        
            b = transform.scale(transform.translate(b, 0, 0), scaleX/spaceX, scaleY/spaceY);         
            //函数1        
            tmp = [].concat(b);            
            shape.pointDraw(tmp, 'blue');            
            tmp = [].concat(b);            
            shape.multiLineDraw(tmp, 'blue');          
                      
            plot.setFillStyle('blue');        
            plot.fillText(f2, 100, -120, 200);          
        }  
    } 
	</span>



<span style="font-size:18px;">//题11
	 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 = 0.5, spaceY = 0.5;           
        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 transform = new Transform();            
        //存放函数图像上的点        
        var a = [], b = [], c = [], d = [];          
                  
        //需要显示的函数说明    
                    //希腊字母表(存此用于Ctrl C/V  
            //ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ  
            //αβγδεζηθικλμνξοπρστυφχψω  
        var f1 = 'y = ax^2', f2 = 'y = -1/(4a)', f3 = 'y=1/(4a)', f4 = '';        
            
		//(1-(x+2)^2)^0.5
		for (var x = xS; x <= xE; x+=0.2) {  
            a.push([x, x*x]);  
			b.push([x, -1/4]);
			c.push([x, 1/4]);
        }  
          
                  
        //存放临时数组        
        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, 100, -90, 200);          
        }  
		
		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, 100, -120, 200);     
    
        }    
               
        if (c.length > 0) {    
            c = transform.scale(transform.translate(c, 0, 0), scaleX/spaceX, scaleY/spaceY);      
            //tmp = [].concat(c);        
            //shape.pointDraw(tmp, 'green');        
            tmp = [].concat(c);        
            shape.multiLineDraw(tmp, '#CCFF22');      
            plot.setFillStyle('green');      
            plot.fillText(f3, 100, -150, 200);     
        } 
		
  
          
    } </span>




<span style="font-size:18px;">#题12
def tmp12():
    #母线
    L = 1;
    thita = 0;
    V_top = 1/3*Math.pi*(L*math.cos(thita)**2*math.sin(thita))**2*L*math.cos(thita);
    V_total = 1/3*Math.pi*(L*math.sin(thita))**2*L*math.cos(thita);

    #V_top / V_total = math.cos(thita)**4 = 1/2</span>



<span style="font-size:18px;">#题13
>>> 
6*42 = 252

#排列公式  
def arrangement(n, m):  
    if n < m:  
        return arrangement(m, n);  
    else:  
        factorial = 1;  
        for i in range(n, n-m, -1):  
            factorial*=i;  
        return factorial;  
  
#组合公式  
def combination(n, m):  
    if (n < m):  
        return combination(m, n);  
    else:  
        return arrangement(n, m)/arrangement(m,m);
    
def tmp13():
    a = arrangement(3, 3);
    b = arrangement(7, 2);
    print('{0}*{1} = {2}'.format(a, b, a*b));</span>




<span style="font-size:18px;">#题14
def tmp14():
    #椭圆长短轴
    a = 3;
    b = 2;
    c = (a**2-b**2)**0.5;

    print(c);
	
>>> 
2.23606797749979

y**2 = (1-x**2/9)*4
(x-c)**2+(y)**2+(x+c)**2+(y)**2 = 4*c**2
2*x**2 + 2*y**2 = 2*c**2
5/9*x**2+4 = c**2

>>> 
2.23606797749979
x =  1.3416407864998743

    x = ((c**2-4)*9/5)**0.5;
    print('x = ', x);

=>-1.342 < x < 1.342 

>>> 3/5**0.5
1.3416407864998738</span>


<span style="font-size:18px;">#题15
a1 = 1 = 2/2; 
2a2**2+a2-1 = 0; => a2 = 1/2;
3a3**2+1/2*a3-1/2; 1/3
=>an = 1/n


	if (1) {
		var equation = new Equation();  
          
        var a = [2, 1, -1];  
        equation.quadratic(a);  
	}
	
方程 2x^[2] + 1x + -1 = 0 =>
Δ = b^[2] - 4ac = 9 ;
方程的解为:x1 = -1, x2 = 0.5 ;
方程根与系数的关系:x1 + x2 = -0.5, x1 * x2 = -0.5 ;

	if (1) {
		var equation = new Equation();  
          
        var a = [3, 1/2, -1/2];  
        equation.quadratic(a);  
	}
	
方程 3x^[2] + 0.5x + -0.5 = 0 =>
Δ = b^[2] - 4ac = 6.25 ;
方程的解为:x1 = -0.5, x2 = 0.3333333333333333 ;
方程根与系数的关系:x1 + x2 = -0.16666666666666669, x1 * x2 = -0.16666666666666666 ;</span>





<span style="font-size:18px;">//题17
	 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 = 0.4;           
        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 transform = new Transform();            
        //存放函数图像上的点        
        var a = [], b = [], c = [], d = [];          
                  
        //需要显示的函数说明    
                    //希腊字母表(存此用于Ctrl C/V  
            //ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ  
            //αβγδεζηθικλμνξοπρστυφχψω  
        var f1 = 'y = 1/2cos^2+0.868sinxcosx+1', f2 = 'y = -1/(4a)', f3 = 'y=1/(4a)', f4 = '';        
            
		//(1-(x+2)^2)^0.5
		for (var x = xS; x <= xE; x+=0.2) {  
            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, 100, -90, 200);          
        }  
		          
    } 
	

}  

function taskFun(x) {
	return 0.5*Math.pow(Math.cos(x), 2)+0.866*Math.sin(x)*Math.cos(x)+1;
}</span>






<span style="font-size:18px;">//题19
	 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 = 0.4;           
        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 transform = new Transform();            
        //存放函数图像上的点        
        var a = [], b = [], c = [], d = [];          
                  
        //需要显示的函数说明    
                    //希腊字母表(存此用于Ctrl C/V  
            //ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ  
            //αβγδεζηθικλμνξοπρστυφχψω  
        var f1 = 'y = (x^2+1)^0.5-x', f2 = 'y = -1/(4a)', f3 = 'y=1/(4a)', f4 = '';        
            
		//(1-(x+2)^2)^0.5
		for (var x = xS; x <= xE; x+=0.2) {  
            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, 100, -90, 200);          
        }  
		          
    } 
	

}  </span>


<span style="font-size:18px;">#题20
def tmp20():
    c1 = 2+3;
    c2 = 2**2+3**2;
    c3 = 2**3+3**3;
    c4 = 2**4+3**4;

    #(c3-pc2)**2 = (c4-pc3)*(c2-pc1);
    #c3**2+p**2*c2**2-2*p*c3*c2 = c2*c4+p**2*c1*c3-p*(c2*c3+c1*c4)
    coef = [c2**2-c1*c3, c1*c4-c2*c3, c3**2-c2*c4];
    print(coef);

>>> 
[-6, 30, -36]

	if (1) {
		var equation = new Equation();  
          
        var a = [-6, 30, -36] 
        equation.quadratic(a);  
	}
	
方程 6x^[2] + -30x + 36 = 0 =>
Δ = b^[2] - 4ac = 36 ;
方程的解为:x1 = 2, x2 = 3 ;
方程根与系数的关系:x1 + x2 = 5, x1 * x2 = 6 ;</span>




好了,可能及格都难。这些题陷阱相当多,运算量也很大,基本上如果不经过一番大运算,

得到的答案你不用想也知道是错的。


现在阿伟二周目来看这些题,做的那是心惊肉跳的。


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

以上是关于[从头学数学] 第209节 带着计算机去高考的主要内容,如果未能解决你的问题,请参考以下文章

[从头学数学] 第214节 带着计算机去高考

[从头学数学] 第219节 带着计算机去高考

[从头学数学] 第211节 带着计算机去高考

[从头学数学] 第215节 带着计算机去高考

[从头学数学] 第216节 带着计算机去高考

[从头学数学] 第217节 带着计算机去高考