A
A
Anton2020-04-28 06:28:35
Fortran
Anton, 2020-04-28 06:28:35

Fortran task, where is the MB error?

I am solving a problem in Fortran, I have already tried everything, but the answer does not converge. Soon the deadline is already, please at least tell me what the mistake is.
Display the table of values ​​of function Y (right column with arc tangent) and its expansion in series S(x), from the parameters of this option n=120, interval [a,b]=[0.1,1] step h=0.1. The bottom line is that the expansion of S and the function Y for equal X must be the same.
Here is the link to the code
5ea7a1e080272035242112.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2020-04-28
@Krivitskiy_Anton

s=0
    p=1
    do i=1, n
        p=p*((x**(2*i+1))/(4*(i**2)-1))
        s=s+p
    end do

an error in calculating p: firstly, you don’t need to multiply the next value by the previous one, and secondly, the series in the task is sign-alternating, but you don’t.
Corrected code .

Similar questions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question