ValueError: setting an array element with a sequence
<p>These two sections my code are giving the following error message.</p>

<pre><code>def Simpsons(a, b, n, f, x):
    h=(b-a)/n
    s = 0.
    step = a + h 
    for i in range(1, int(n/2)):
        s += 4*f(x)
        #step += 2*h

    step = a + 2 * h
    for i in range(2, int(n/2 - 1)):
        s += 2*f(x)
        #step += 2 * h

    area = (h/3) * (f(a) + f(b) + s)
    return area
</code></pre>

<p>and</p>

<pre><code>for i in range(0, len(list_n)):
    for j in range(0, len(Functions)):
        x = np.linspace(a, b, list_n[i])
        error_simp[j, i] = Exact_intergrals[j] - Simpsons(0, 1,         list_n[i], Functions[j], x)
print(error_simp)
</code></pre>

<p>Give this message:</p>

<pre><code>   error_simp[j, i] = Exact_intergrals[j] - Simpsons(0, 1, list_n[i], Functions[j], x)
ValueError: setting an array element with a sequence.
</code></pre>

<p>Why is this? everything I have tried does not get rid of it.</p>