Re: Can I solve this system of nonlinear equations?
- To: mathgroup at smc.vnet.net
- Subject: [mg125271] Re: Can I solve this system of nonlinear equations?
- From: "Stephen Luttrell" <steve at _removemefirst_stephenluttrell.com>
- Date: Sat, 3 Mar 2012 06:55:00 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jil5ld$rrm$1@smc.vnet.net> <jiqfpe$6c$1@smc.vnet.net>
Let me repost to fix the equations/eqns and objective/obj confusion I inadvertently introduced above: eqns = {(((c - a)/0.002) - (0.995018769272803 + h*b)) == 0, (((d - b)/0.002) - (0.990074756047929 + h*c)) == 0, (((e - c)/0.002) - (0.985167483257382 + h*d)) == 0, (((f - d)/0.002) - (0.980296479563062 + h*e)) == 0, (((g - e)/0.002) - (0.975461279165159 + h*f)) == 0, (((-1*e + 8*d - 8*b + a)/(12*0.001)) - (0.990074756047929 + h*c)) == 0, (((-1*f + 8*e - 8*c + b)/(12*0.001)) - (0.985167483257382 + h*d)) == 0, (((-1*g + 8*f - 8*d + c)/(12*0.001)) - (0.980296479563062 + h*e)) == 0}; obj = Total[eqns /. (x : _) == 0 :> x^2] giving ... (-0.995019 + 500. (-a + c) - b h)^2 + (-0.990075 + 500. (-b + d) - c h)^2 + (-0.990075 + 83.3333 (a - 8 b + 8 d - e) - c h)^2 + (-0.985167 + 500. (-c + e) - d h)^2 + (-0.985167 + 83.3333 (b - 8 c + 8 e - f) - d h)^2 + (-0.980296 + 500. (-d + f) - e h)^2 + (-0.980296 + 83.3333 (c - 8 d + 8 f - g) - e h)^2 + (-0.975461 + 500. (-e + g) - f h)^2 solution = NMinimize[obj, {a, b, c, d, e, f, g, h}] giving ... {3.94032*10^-11, {a -> 0.314882, b -> 0.315979, c -> 0.317109, d -> 0.318197, e -> 0.319318, f -> 0.320396, g -> 0.321509, h -> 0.374577}} -- Stephen Luttrell West Malvern, UK "Stephen Luttrell" <steve at _removemefirst_stephenluttrell.com> wrote in message news:jiqfpe$6c$1 at smc.vnet.net... > equations = {(((c - a)/0.002) - (0.995018769272803 + h*b)) == > 0, (((d - b)/0.002) - (0.990074756047929 + h*c)) == > 0, (((e - c)/0.002) - (0.985167483257382 + h*d)) == > 0, (((f - d)/0.002) - (0.980296479563062 + h*e)) == > 0, (((g - e)/0.002) - (0.975461279165159 + h*f)) == > 0, (((-1*e + 8*d - 8*b + a)/(12*0.001)) - (0.990074756047929 + > h*c)) == > 0, (((-1*f + 8*e - 8*c + b)/(12*0.001)) - (0.985167483257382 + > h*d)) == > 0, (((-1*g + 8*f - 8*d + c)/(12*0.001)) - (0.980296479563062 + > h*e)) == 0}; > > Construct an objective function that is minimised when all of the > equations > are satisfied. The sum of the squares of the left hand sides of all of the > equations (whose right hand sides are all zero) will achieve the desired > effect. > > objective = Total[eqns /. (x : _) == 0 :> x^2] > > giving ... > > (-0.995019 + 500. (-a + c) - b h)^2 + (-0.990075 + 500. (-b + d) - > c h)^2 + (-0.990075 + 83.3333 (a - 8 b + 8 d - e) - > c h)^2 + (-0.985167 + 500. (-c + e) - d h)^2 + (-0.985167 + > 83.3333 (b - 8 c + 8 e - f) - d h)^2 + (-0.980296 + 500. (-d + f) - > e h)^2 + (-0.980296 + 83.3333 (c - 8 d + 8 f - g) - > e h)^2 + (-0.975461 + 500. (-e + g) - f h)^2 > > Minimise the objective function. > > solution = NMinimize[obj, {a, b, c, d, e, f, g, h}] > > giving ... > > {3.94032*10^-11, {a -> 0.314882, b -> 0.315979, c -> 0.317109, > d -> 0.318197, e -> 0.319318, f -> 0.320396, g -> 0.321509, > h -> 0.374577}} > > which has a satisfyingly small value of the objective function at the > found > solution. > > I'll bet there are other ways of solving this particular problem, but > minimising an appropriate objective function is a very useful general > approach. > > -- > Stephen Luttrell > West Malvern, UK > > "Andy" <andy732a at gmail.com> wrote in message > news:jil5ld$rrm$1 at smc.vnet.net... >> I'm dealing with systems of nonlinear equations that have 8 equations >> and 8 unknowns. Here's an example: >> >> Solve[{(((c - a)/0.002) - (0.995018769272803 + h*b)) == 0, >> (((d - b)/0.002) - (0.990074756047929 + h*c)) == 0, >> (((e - c)/0.002) - (0.985167483257382 + h*d)) == 0, >> (((f - d)/0.002) - (0.980296479563062 + h*e)) == 0, >> (((g - e)/0.002) - (0.975461279165159 + h*f)) == 0, >> (((-1*e + 8*d - 8*b + a)/(12*0.001)) - (0.990074756047929 + h*c)) == >> 0, >> (((-1*f + 8*e - 8*c + b)/(12*0.001)) - (0.985167483257382 + h*d)) == >> 0, >> (((-1*g + 8*f - 8*d + c)/(12*0.001)) - (0.980296479563062 + h*e)) == >> 0}, {a, b, c, d, e, f, g, h}] >> >> Whenever I try this, Mathematica 7 just returns the empty set {}. How >> can I tell if this is unsolvable? Shouldn't I at least be able to get >> a numerical approximation with NSolve? I've tried using stochastic >> optimization to get approximate answers but every method gives poor >> results, and that's why I would like to at least approximately solve >> this if possible. Thanks very much for any help~ >> > >