# Passing a list to a nested vector function

In order to apply a newton-rhapson algorithm to solve a set of nonlinear vector equations such as these,

f[x_, y_] = {x^2 - 3*y + 6, (y + 1)^2 - x - 33}


I need to nest the update function to run a few times:

newtit[x_, y_] =  {x, y} - Inverse[D[f[x, y], {{x, y}}]].f[x, y]


However, when using Nest[] I cannot seem to pass a list of arguments ({2,2}) to this function.

Nest[newtit, {2, 2}, 2]


To be clear why I don't just use Solve[], I want to use this algorithm to solve a larger and more complicated set of vector equations. I am quite new to mathematica, but the syntax I use for passing lists to functions would be (f@@{2,2}), I can't use this form in Nest[]. What should I use in this case?

• Thanks, those are insightful, but both entries seem to only handle a single input argument to the function f, or am I not looking into the arguments well enough? Apr 3, 2016 at 22:34

Nest[newtit @@ # &, {2, 2}, 2]

• @FlorisvanElteren, thanks for the accept. f@@expr replaces the head of expr by f; i.e., the head of {2,2} (i.e. List) is replaced by newtit giving newtit[2,2]. (see Apply (@@) )
• Alternatively, f should have been directly defined for vector input: f[{x_, y_}] := {x^2 - 3*y + 6, (y + 1)^2 - x - 33}; newtit[{x_, y_}] = {x, y} - Inverse[D[f[{x, y}], {{x, y}}]].f[{x, y}]. Then Nest[newtit, {2, 2}, 2] just works. Apr 3, 2016 at 22:50