*/
Are you blogging on PH? Get your free blog.
*/

View \xdnewton.h

Calculus (Derivative:Tangent). v04

Submitted By: xhunga
Rating: (Not rated) (Rate It)


/* x.h                    freeware                  [[Email Removed]]  */

/* ------------------------------------- FUNCTION --------------------------  */
/* Do    :                                                                    */
/*                                                                            */
/* -------------------------------------------------------------------------- */
double Newton_s_Method(
double x,
   int imax,
double (*P_f)(double x),
double (*PDf)(double x)
)
{
   int i;

       for(i=1; i<imax; i++)
          {
           x = x - ((*P_f)(x)) / ((*PDf)(x));
          }
 return(x);
}

/* ------------------------------------- FUNCTION --------------------------  */
/* Do    :                                                                    */
/*                                                                            */
/* -------------------------------------------------------------------------- */
double p_Newton_s_Method(
double x,
   int imax,
double (*P_f)(double x),
double (*PDf)(double x)
)
{
   int i;

       for(i=1; i<(imax+1); i++)
          {
           printf(" x[%d] = %.15f\n",i,x);
           x = x - ((*P_f)(x)) / ((*PDf)(x));
          }
 return(x);
}

corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.