FindRoot with vector domain
- To: mathgroup at smc.vnet.net
- Subject: [mg89208] FindRoot with vector domain
- From: "jwmerrill at gmail.com" <jwmerrill at gmail.com>
- Date: Thu, 29 May 2008 07:04:59 -0400 (EDT)
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]}, FindRoot[{Log[\[Phi]/( 1.0 - \[Phi])] + \[Chi] (1.0 - 2.0 \[Phi]) == (a - x/h), Mean[\[Phi]] == 0.5}, {{\[Phi], Table[0.497, {501}]}, {a, 0.5/h}}]]; 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]}, FindRoot[{Log[\[Phi]/( 1.0 - \[Phi])] == (a - x/h) - \[Chi] (1.0 - 2.0 \[Phi]), Mean[\[Phi]] == 0.5}, {{\[Phi], Table[0.497, {501}]}, {a, 0.5/h}}]]; 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. Thanks, JM