MathGroup Archive 2012

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

Search the Archive

Re: FindRoot with a vector of unknowns


On Sun, 19 Feb 2012 11:29:17 -0000, Sam Takoy <sam.takoy at yahoo.com> wrote:

> Hi,
>
> 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.
>
> Thanks,
>
> Sam
>

Well, this is implicitly a loop, but perhaps it's a little more elegant  
than what you may have been thinking of:

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

giving:

{{x -> 1.}, {x -> 2.}, {x -> 3.}}



  • Prev by Date: Re: FindRoot with a vector of unknowns
  • Next by Date: Re: How best to implement a hash table in Mathematica
  • Previous by thread: Re: FindRoot with a vector of unknowns
  • Next by thread: Re: FindRoot with a vector of unknowns