Cody

# Problem 44845. Just another sum (JAS)

Solution 1742232

Submitted on 4 Mar 2019 by Martin C.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
x=[ 1.000000000000 2.000000000000 3.000000000000 4.000000000000 5.000000000000 6.000000000000 7.000000000000 8.000000000000 9.000000000000 10.000000000000 ]; y=sol(x); yref=-5.000000000000 assert(abs(y-yref)<1e-6);

le = 10 m = 1 -1 1 -1 1 -1 1 -1 1 -1 y = 1 -2 3 -4 5 -6 7 -8 9 -10 y = -5 yref = -5

2   Pass
x=[ 2.000000000000 4.000000000000 8.000000000000 16.000000000000 32.000000000000 64.000000000000 128.000000000000 256.000000000000 512.000000000000 1024.000000000000 ]; y=sol(x); yref=-682.000000000000 assert(abs(y-yref)<1e-6);

le = 10 m = 1 -1 1 -1 1 -1 1 -1 1 -1 y = 2 -4 8 -16 32 -64 128 -256 512 -1024 y = -682 yref = -682

3   Pass
x=[ 1.000000000000 4.000000000000 9.000000000000 16.000000000000 25.000000000000 36.000000000000 49.000000000000 64.000000000000 81.000000000000 100.000000000000 ]; y=sol(x); yref=-55.000000000000 assert(abs(y-yref)<1e-6);

le = 10 m = 1 -1 1 -1 1 -1 1 -1 1 -1 y = 1 -4 9 -16 25 -36 49 -64 81 -100 y = -55 yref = -55

4   Pass
x=[ 1.000000000000 8.000000000000 27.000000000000 64.000000000000 125.000000000000 216.000000000000 343.000000000000 512.000000000000 729.000000000000 1000.000000000000 ]; y=sol(x); yref=-575.000000000000 assert(abs(y-yref)<1e-6);

le = 10 m = 1 -1 1 -1 1 -1 1 -1 1 -1 y = 1 -8 27 -64 125 -216 343 -512 729 -1000 y = -575 yref = -575

5   Pass
x=[ 1.000000000000 0.500000000000 0.333333333333 0.250000000000 0.200000000000 0.166666666667 0.142857142857 0.125000000000 0.111111111111 0.100000000000 ]; y=sol(x); yref=0.645634920635 assert(abs(y-yref)<1e-6);

le = 10 m = 1 -1 1 -1 1 -1 1 -1 1 -1 y = 1.0000 -0.5000 0.3333 -0.2500 0.2000 -0.1667 0.1429 -0.1250 0.1111 -0.1000 y = 0.6456 yref = 0.6456

6   Pass
x=[ 0.243132468125 -0.107772980466 0.155477890178 -0.328813312188 0.206046088020 -0.468167153623 -0.223077015039 -0.453828609369 -0.402868218764 0.323457828327 ]; y=sol(x); yref=1.013835439837 assert(abs(y-yref)<1e-6);

le = 10 m = 1 -1 1 -1 1 -1 1 -1 1 -1 y = 0.2431 0.1078 0.1555 0.3288 0.2060 0.4682 -0.2231 0.4538 -0.4029 -0.3235 y = 1.0138 yref = 1.0138