Logo 
Search:

C Programming Articles

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

SUCCESSIVE APPROXIMATION METHOD

Posted By: Abbie Hughes     Category: C Programming     Views: 20967

Write a program of SUCCESSIVE APPROXIMATION METHOD

Code for SUCCESSIVE APPROXIMATION METHOD in C Programming

#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int user_power,i=0,cnt=0,flag=0;
int coef[10]={0};
float x1=0,t=0;
float x2=0;

void main()
{

    clrscr();

    printf("\n\n\t\t\t PROGRAM FOR SUCESSIVE APPROXIMATION");

    printf("\n\tINTIAL X1---->");
    scanf("%f",&x2);


/*************************************************************************/
printf("\n ******************************************************"); printf("\n ITERATION X1 FX1 "); printf("\n **********************************************************"); do { cnt++; x1=x2; x2=(2-(log10(x1))); printf("\n %d %.3f %.3f ",cnt,x1,x2); }while((fabs(x2 - x1))>=0.0001); printf("\n\t THE ROOT OF EQUATION IS %f",x1); getch(); } /*******************************OUTPUT**********************************/
PROGRAM FOR SUCESSIVE APPROXIMATION INTIAL X1---->10 ******************************** ITERATION X1 FX1 ******************************** 1 10.000 1.000 2 1.000 2.000 3 2.000 1.699 4 1.699 1.770 5 1.770 1.752 6 1.752 1.756 7 1.756 1.755 8 1.755 1.756 9 1.756 1.756 ******************************** THE ROOT OF EQUATION IS 1.755633
  
Share: 


Didn't find what you were looking for? Find more on SUCCESSIVE APPROXIMATION METHOD Or get search suggestion and latest updates.

Abbie Hughes
Abbie Hughes author of SUCCESSIVE APPROXIMATION METHOD is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

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

 
Saruque Ahamed Mollick from United States Comment on: Sep 15
Enter the initial approximation: 0

Iteration x0 xn
1 1 1.84677
2 1.84677 1.57584
3 1.57584 1.66499
4 1.66499 1.63532
5 1.63532 1.64517
6 1.64517 1.6419
7 1.6419 1.64299
8 1.64299 1.64262
9 1.64262 1.64274
10 1.64274 1.6427
11 1.6427 1.64272
12 1.64272 1.64271
13 1.64271 1.64271
14 1.64271 1.64271

The root of the equation cos(x)-3x+5=0 is 1.64271
Reference: https://www.codespeedy.com/.../

View All Comments