Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8831

Re: Can I solve this system of nonlinear equations?

From "Stephen Luttrell" <steve@_removemefirst_stephenluttrell.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Can I solve this system of nonlinear equations?
Date 2012-03-02 12:51 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jiqfpe$6c$1@smc.vnet.net> (permalink)
References <jil5ld$rrm$1@smc.vnet.net>

Show all headers | View raw


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@gmail.com> wrote in message 
news:jil5ld$rrm$1@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~
> 

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Can I solve this system of nonlinear equations? Andy <andy732a@gmail.com> - 2012-02-29 12:28 +0000
  Re: Can I solve this system of nonlinear equations? "Stephen Luttrell" <steve@_removemefirst_stephenluttrell.com> - 2012-03-02 12:51 +0000
    Re: Can I solve this system of nonlinear equations? "Stephen Luttrell" <steve@_removemefirst_stephenluttrell.com> - 2012-03-03 11:56 +0000
  Re: Can I solve this system of nonlinear equations? "Stephen Luttrell" <steve@_removemefirst_stephenluttrell.com> - 2012-03-02 12:52 +0000
  Re: Can I solve this system of nonlinear equations? Ray Koopman <koopman@sfu.ca> - 2012-03-03 11:58 +0000
    Re: Can I solve this system of nonlinear equations? "Stephen Luttrell" <steve@_removemefirst_stephenluttrell.com> - 2012-03-04 09:33 +0000
    Re: Can I solve this system of nonlinear equations? Ray Koopman <koopman@sfu.ca> - 2012-03-04 09:36 +0000
      Re: Can I solve this system of nonlinear equations? "Stephen Luttrell" <steve@_removemefirst_stephenluttrell.com> - 2012-03-05 06:05 +0000
  Re: Can I solve this system of nonlinear equations? danl@wolfram.com - 2012-03-03 11:54 +0000

csiph-web