MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: FindRoot with a vector of unknowns


On 2/19/12 at 6:28 AM, sam.takoy at yahoo.com (Sam Takoy) wrote:

>Is there an elegant way to implement what I am trying to do here,
>that is solve for a vector of unknowns:

>FindRoot[x - {1, 2, 3} == {0, 0, 0}, {x, {1, 1, 1}}]

>I can do this writing a loop, but hoping for a "vectorized"
>solution.

Elegant is subjective and using MapThread to solve this may not
meet your notion of "vectorized". But here is how to to what you
seem to want using MapThread

In[1]:= MapThread[
  FindRoot[(x - #1) == #2, {x, #3}] &, {{1, 2, 3}, {0, 0, 0},
{1, 1,
    1}}]

Out[1]= {{x->1.},{x->2.},{x->3.}}




  • Prev by Date: Re: NProbability
  • Next by Date: Re: FindRoot with a vector of unknowns
  • Previous by thread: Re: FindRoot with a vector of unknowns
  • Next by thread: Re: FindRoot with a vector of unknowns