formatting source-code for d7af6fdc8c

This commit is contained in:
github-actions
2020-05-29 23:26:30 +00:00
parent edb3d51ec2
commit 7ad1f171c1
176 changed files with 5342 additions and 4288 deletions

View File

@@ -21,18 +21,21 @@
/** define \f$f(x)\f$ to find root for
*/
static double eq(double i) {
static double eq(double i)
{
return (std::pow(i, 3) - (4 * i) - 9); // original equation
}
/** define the derivative function \f$f'(x)\f$
*/
static double eq_der(double i) {
static double eq_der(double i)
{
return ((3 * std::pow(i, 2)) - 4); // derivative of equation
}
/** Main function */
int main() {
int main()
{
std::srand(std::time(nullptr)); // initialize randomizer
double z, c = std::rand() % 100, m, n;
@@ -41,7 +44,8 @@ int main() {
std::cout << "\nInitial approximation: " << c;
// start iterations
for (i = 0; i < MAX_ITERATIONS; i++) {
for (i = 0; i < MAX_ITERATIONS; i++)
{
m = eq(c);
n = eq_der(c);