Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Numerical MethodsRSS Feeds

Program of FIXED POINT METHOD

Posted By: Pedro Silva     Category: C Programming     Views: 6192

Write a program of FIXED POINT METHOD.

Code for Program of FIXED POINT METHOD in C Programming

#include<stdio.h>
#include<conio.h>
#include<math.h>
#define ESP 0.0001
#define F(x) (x)*(exp(x)) = 1
#define X(x) (exp(-x))
#define G(x) -(exp(x))


void main()
{
  float x1,x2,x;
  int i=1;
  clrscr();
  do
  {
  printf("\nEnter the value of x: ");
  scanf("%f",&x);
  }while(fabs(G(x)) > 1);
  x1=X(x);
  printf("\n x = %f",x1);
  printf("\n\n");
  do
  {
   x2=X(x1);
   if(fabs(x1-x2)<ESP)
   {
    printf("\n\nREAL ROOT = %.3f",x1);
    i=0;
   }
   else
   {
    x1=x2;
   }
  if(i==1)
  {
   printf("\n x = %f",x1);
   printf("\n\n");
  }
  }while(i!=0);
getch();
}

/*
____________________________

OUT PUT
____________________________



Enter the value of x: 90

x = 1.275963


x = 1.645290


x = 1.462788


x = 1.553900


x = 1.508448


x = 1.531154


x = 1.519816


x = 1.525479


x = 1.522651


x = 1.524063


x = 1.523358


x = 1.523710


x = 1.523534



REAL ROOT = 1.524


*/
  
Share: 


Didn't find what you were looking for? Find more on Program of FIXED POINT METHOD Or get search suggestion and latest updates.

Pedro  Silva
Pedro Silva author of Program of FIXED POINT METHOD is from Salvador, Brazil.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!