MathGroup Archive 2006

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

Search the Archive

Re: 2 dimension Newton Raphson

  • To: mathgroup at smc.vnet.net
  • Subject: [mg71244] Re: [mg71218] 2 dimension Newton Raphson
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Sat, 11 Nov 2006 03:39:15 -0500 (EST)
  • Reply-to: hanlonr at cox.net

eqns={(x-4)^2+(y-4)^2==5,x^2+y^2==16};

soln={#[[1]],#[[2]]/.#[[1]]}&/@
    {Reduce[eqns,{x,y}]//ToRules}

{{x -> (1/16)*(43 - Sqrt[199]), 
   y -> (1/8)*(43 + (1/2)*(-43 + Sqrt[199]))}, 
  {x -> (1/16)*(43 + Sqrt[199]), 
   y -> (1/8)*(43 + (1/2)*(-43 - Sqrt[199]))}}

Needs["Graphics`"];

ImplicitPlot[eqns, {x, -5, 7},
    Epilog->{Red, AbsolutePointSize[5],
        Point/@({x,y}/.soln)}];


Bob Hanlon

---- ms z <ms-z- at hotmail.com> wrote: 
> I have tried to solve the roots of the simultaneous nonlinear equations
> (x-4)^2 + (y-4)^2 = 5
> x^2 + y^2 = 16
> 
> by writing this function:
> 
> nr2method[xl1_, xl2_, es1_] :=
>   Block[{x1, x2, ea, es, x1new, u, v},
>     u = (x1 - 4)^2 + (x2 - 4)^2 - 5;
>     v = x1^2 + x2^2 - 16;
>     ea = 100; es = es1;
>     For[i = 1, ea > es, i++,
>       (x1new[x1_, x2_] = x1 - (u*D[
>     v, x2] - v*D[u, x2])/(D[u, x1]*D[v, x2] - D[u, x2]*D[v, x1]);
>         If[i == 1, x1 = xl1, x1 = b];
>         x2 = xl2;
>         b = x1new[x1, x2];
>         ea = Abs[(b - x1)/b 100];
>         Clear[x1, x2, x1new];)];
>     ea = 100; es = es1;
>     For[i = 1, ea > es, i++,
>       (x2new[x1_, x2_] = x2 - (v*D[u, x1] - u*D[v, x1])/(D[u, x1]*D[v, x2] -
>         D[u, x2]*D[v, x1]);
>         If[i == 1, x2 = xl2, x2 = c];
>         x1 = xl1;
>         c = x2new[x1, x2];
>         ea = Abs[(c - x2)/c 100];
>         Clear[x1, x2, x2new];)];
>     Print["The value of x1 is ", b];
>     Print["The value of x2 is ", c];]
> 
> Is this function a good one? Is there a way to make this function simpler?
> 


  • Prev by Date: RE: Slow Integrate[] on standard integral
  • Next by Date: Re: best strategy to fit the given function to my data
  • Previous by thread: Re: 2 dimension Newton Raphson
  • Next by thread: RE: 2 dimension Newton Raphson