Re: FindRoot with a vector of unknowns
- To: mathgroup at smc.vnet.net
- Subject: [mg125071] Re: FindRoot with a vector of unknowns
- From: "Oleksandr Rasputinov" <oleksandr_rasputinov at ymail.com>
- Date: Mon, 20 Feb 2012 02:50:54 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jhqmed$f70$1@smc.vnet.net>
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.}}