MathGroup Archive 2008

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

Search the Archive

FindRoot with vector domain

I'm looking at a simple model of phase separation of a binary fluid in
the presence of an external field.  The following solves for the
volume fraction profile, \[Phi], of the component that feels the
field, given the strength of the field (parametrized by h), and the
strength of the interaction (parametrized by \[Chi]).

sol = With[{h = .5, \[Chi] = 1.9, x = Range[0, 1, .002]},
        1.0 - \[Phi])] + \[Chi] (1.0 - 2.0 \[Phi]) == (a - x/h),
     Mean[\[Phi]] == 0.5}, {{\[Phi], Table[0.497, {501}]}, {a,

ListPlot[Re[\[Phi]] /.sol, PlotRange -> {0, 1}, DataRange -> {0, 1},
 PlotLabel -> (Last[sol]), AxesLabel -> {x, \[Phi]}]

It's a bit magical to me that this works at all, having a vector as
one of the parameters to FindRoot, but it does.  However, moving the \
[Chi] term to the other side of the first equation causes it to go
down in flames:

sol = With[{h = .5, \[Chi] = 1.9, x = Range[0, 1, .002]},
       1.0 - \[Phi])] == (a - x/h) - \[Chi] (1.0 - 2.0 \[Phi]),
     Mean[\[Phi]] == 0.5}, {{\[Phi], Table[0.497, {501}]}, {a,

FindRoot::nveq: The number of equations does not match the number of \
variables in FindRoot[{Log[\[Phi]/(1.+Times[<<2>>])]==(a-{<<501>>} \
Power[<<2>>])-1.9 \
(1.+Times[<<2>>]),Mean[\[Phi]]==0.5},{{\[Phi],<<1>>},<<1>>}]. >>

In fact, basically any rearrangement fails except for the first one I
showed.  Can anyone explain why these two ways of stating the problem
are different?  I'm afraid that next time I want to do something
similar, I won't be able to stumble across a way of writing things
that actually works.



  • Prev by Date: Re: NIntegrate
  • Next by Date: Re: enquiry
  • Previous by thread: FindFit with constraints is slow
  • Next by thread: Deleting parts of notebooks programmatically