下面代码的执行结果是( ) x2 = 1 for i in range (4, 0, -1): x1 = ( x2 + 1 ) * 2 x2 = x1 print (x2)
A: 23
B: 94
C: 190
D: 46
A: 23
B: 94
C: 190
D: 46
举一反三
- 下面代码的执行结果是( )[br][/br] x2 = 1 for i in range (4, 0, -1): x1 = ( x2 + 1 ) * 2 x2 = x1 print (x2)
- 求函数 f(x)=3*x1^2 + 2*x1*x2 + x2^2 − 4*x1 + 5*x2. 时,输入代码 >>fun = @(x)3*x(1)^2 + 2*x(1)*x(2) + x(2)^2 - 4*x(1) + 5*x(2); >>x0 = [1,1]; >>[x,fval] = fminunc(fun,x0); 其中fun的作用是:
- 求函数 f(x)=3*x1^2 + 2*x1*x2 + x2^2 − 4*x1 + 5*x2. 时,输入代码 >>fun = @(x)3*x(1)^2 + 2*x(1)*x(2) + x(2)^2 - 4*x(1) + 5*x(2); >>x0 = [1,1]; >>[x,fval] = fminunc(fun,x0); 到matlab上运行一下,得到的结果,x是:
- 下面代码的输出结果是 x2=1 for day in range(4,0,-1): x1=(x2+1)*2 x2=x1 print(x1)
- 执行下列程序之后的显示结果是( )。CLEARx1=1x2 =2DO p1 with x1 ,x1 +x2"x1="+STR(x1 ,l),"x2="+STR(x2,1)RETURNPROC p1PARA w1.w2wl=wl*2w2=w2*2RETURN A: x1=2 x2=2 B: x1=1 x2=2 C: x1=2 x2=6 D: x1=1 x2=6