Y
Y
yaroslavklimuk2021-01-12 19:37:21
C++ / C#
yaroslavklimuk, 2021-01-12 19:37:21

Function decomposition series. What was wrong?

Sketched, but not sure if it works correctly, can someone help?

For each x changing from a to b with step h, find the values ​​of the function Y(x), the sums S(x) and |Y(x)–S(x)| and output it as a table. The values ​​a, b, h and n are entered from the keyboard. Since the value of S(x) is a decomposition series of the function Y(x), with the correct solution, the values ​​of S and Y for a given argument x (for test values ​​of the initial data) must match in the integer part and in the first two to four positions after the decimal point. Execute with RECURRENT Sequence.
Check the operation of the program for a = 0.1; b = 1.0; h = 0.1; n = 15;

for(x = a; x<=b; x+=h)
{
                p1 = s = p = 1;
                for(k = 1; k<=n; k++)
                {
                        f=pow(-1,k+1)*(pow(x,2*k))/(2*k*(2*k-1);
                        s+=f;

                  }

y=-log(sqrt(1+pow(x,2)))+x*atan(x);
p1=fabs(y-s);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Petryaev, 2021-01-12
@Gremlin92

First you have s=1 at the beginning, but you need s =0 and ne1 is the same. Also, pe is not used, it is not clear where the curly brace is closing the second. And in terms of mathematics, everything seems to be clear, but I won’t say for sure what kind of sequence it is recurrent or not, and the correctness of its expansion in a row

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question