Friday, October 14, 2022

atan(x)

 #include <iostream>

#include <math.h>

int main()

{

    double x,y,s,a,b;

    int k; k = - 1;

    x = 0.5;

    y = atan(x);

    std::cout << "x =" << x << ", y=" << y << " ";

    b = x * x;

    s = x; a = x * x * x;

    for (int i = 3; i < 10000000; i = i + 2)

    {

        s = s + k*a/i;

        a = a * b;

        k = k * (-1);

    }

    std::cout << "s = " << s << "\n";

  }

No comments:

Post a Comment

NaCl.xyz Generator with Interactive 3D Visualization

NaCl.xyz Generator with Interactive 3D Visualization NaCl.xyz Generator with Interactive 3D Visualization ...