Answer the question
In order to leave comments, you need to log in
How to make a Taylor series (via pointers)?
How can you convert this code to pointers? and through the function
#include "stdafx.h"
#include <iostream>
#include <math.h>
#include "conio.h"
#include "stdio.h"
using namespace std;
int main()
{
int n, k, i;
double Xn, Xe, dx, x, e = 1E-5, Fun;
const double pi = 3.141592;
k = 0;
cout << ("entere Xn=");
cin >> Xn;
cout << ("entere Xe=");
cin >> Xe;
cout << ("entere dx=");
cin >> dx;
x = Xn;
while (x <= Xe)
{
n = 0;
double result = pi / 2;
double sum = 0;
double E = 0;
k++;
do
{
sum += pow(-1.0, n + 1) / ((2 * n + 1)*pow(x, 2 * n + 1));
++n;
E = pow(-1.0, n + 1) / ((2 * n + 1)*pow(x, 2 * n + 1));
} while (fabs(E) >= e);
k++;
Fun = atan(x);
cout << " x = " << x << "\t atan = " << result - sum << "\t k=" << k << "\t arctg(x)=" << Fun << endl;
x += dx;
}
_getch();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question