0

I'm trying to get an array from an f(x) function this way:

array=list()

for i in range(x):
    parameter= z+(i*change)
    array=f(parameter)

Note that x is an integer, z and change are floats established in my code.

The next thing I want is to use simpson's rule using the simps function in scipy. I tried this:

Simpsons= integrate.simps(array, dx=change)

It says there is an error How can I solve this?

1 Answer 1

1

The problem line is array=f(param). You're assigning array to the result of f, not appending it. You should do array.append(f(param)).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.