Professional Documents
Culture Documents
Gubaton Numericals
Gubaton Numericals
Gubaton Numericals
1. Find the positive solution of f(x)= x-2 sinx=c by the secant method starting from X1= 2
and X1= 1.5
C++ Program
#include <iostream>
#include <cmath>
int main() {
double c = 1.0; // Change this to the desired value of c
double x0 = 2.0;
double x1 = 1.5;
double tolerance = 1e-6; // Tolerance for convergence
int maxIterations = 100; // Maximum number of iterations
x0 = x1;
x1 = x2;
}
return 0;
}
2. Find the positive solution of 2sinx=x
C++ Program
#include <iostream>
#include <cmath>
int main() {
double x0 = 1.0; // Initial guess for the positive solution
double tolerance = 1e-6; // Tolerance for convergence
Ernie P. Gubaton III Activity
BSEE 4th Numerical Methods and Analysis
int maxIterations = 100; // Maximum number of iterations
x0 = x1;
}
return 0;
}
#include <iostream>
#include <cmath>
int main() {
double x0 = 0.5; // Initial guess
double tolerance = 1e-6; // Tolerance for convergence
int maxIterations = 100; // Maximum number of iterations
x0 = x1;
}
return 0;
}