License Public Domain
 Lines 53
##### Permissions
Viewable by Everyone
Editable by All Siafoo Users

# The Newton-Raphson Method 0

 In Brief Uses the Newton-Raphson Method to find zeros of a function.
 Language C
# 's
` 1/* 2Programmed By: David Isaacson, 2003 3Released into the Public Domain 4 5newton-raphson2.c 6  7The puropse of this program is to find the lowest zero of 8f(x)=4d*x^3-3x+1 where x=r/h and d=0.7 910this will be needed: f'(x)=12d*x^2-311*/1213#include <stdio.h>14#include <math.h>1516int main()17{18    const float d=0.7;			//defining d1920    double fofx;			//f evaluated at x21    double fprimeofx;			//f' evaluated at x2223    double x;				//the guess variable24    double xnew;			//the "next" guess variable2526    printf("Hello\n");2728    printf("\nWhat value shall we start at?");29    scanf("%lf",&xnew);3031    do32    {33	x=xnew;    34	fofx=4*d*x*x*x-3*x+1;		//eval f at x35	fprimeofx=12*d*x*x-3;		//eval f' at x36	xnew=x-fofx/fprimeofx;		//the n-r formula37	printf("%.10f\n",xnew);38	    39    }while(xnew!=x);40    41    printf("The graphs intersect at %.6f \n",xnew);42    //this prints xnew to a precision of 6 decimal places43        44    return 0;45}4647/*48 When I ran this on my computer, I recieved the result:4950 What value shall we start at?051 052 0.333333333353 0.383512542954 0.387708629655 0.387741397456 0.387741399457 0.387741399458 The graphs intersect at 0.387741 59 */60	61	6263    64    65    `

Uses the Newton-Raphson Method to find zeros of a function.