Method of successive approximations using fixed-point iteration method.
More...
#include <cmath>
#include <iostream>
|
static float | eq (float y) |
|
static float | eqd (float y) |
|
int | main () |
|
Method of successive approximations using fixed-point iteration method.
◆ eq()
static float eq |
( |
float |
y | ) |
|
|
static |
equation 1
\[f(y) = 3y - \cos y -2\]
12 {
return (3 * y) -
cos(y) - 2; }
◆ eqd()
static float eqd |
( |
float |
y | ) |
|
|
static |
equation 2
\[f(y) = \frac{\cos y+2}{2}\]
17 {
return 0.5 * (
cos(y) + 2); }
◆ main()
Main function
21 float y, x1, x2, x3,
sum, s, a, f1, f2, gd;
24 for (i = 0; i < 10; i++) {
26 std::cout <<
"value of equation at " << i <<
" " <<
sum <<
"\n";
31 std::cout <<
"enter the no iteration to perform->\n";
34 for (i = 0; i <= n; i++) {