2

If I have a multivariable function such as F= lambda x,y: x**2+y**2
and if I need to use the input x0=np.array([1,1])

May I know how I should use x0 to get the value from F? I understand that I could use something like F(x0[0],x0[1])

But I would like to know whether there is a way that I can directly use x0 rather than calling each cordinate manually

Appreciate your help

1 Answer 1

4

Python lets you do this by doing F(*x0), which expands the array into the parameters. In other languages this is sometimes called "splatting".

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.