function runge_antideriv ( x ) c*********************************************************************72 c cc runge_antideriv() evaluates the antiderivative of the Runge function. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 24 March 2025 c c Author: c c John Burkardt c c Input: c c double precision x: the argument of the function. c c Output: c c double precision runge_antideriv: the value of the antiderivative. c implicit none double precision runge_antideriv double precision x runge_antideriv = atan ( 5.0D+00 * x ) / 5.0D+00 return end function runge_deriv ( x ) c*********************************************************************72 c cc runge_deriv() evaluates the derivative of the Runge function. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 23 March 2025 c c Author: c c John Burkardt c c Input: c c double precision x: the argument of the function. c c Output: c c double precision runge_deriv: the value of the derivative. c implicit none double precision runge_deriv double precision x runge_deriv = -50.0D+00 * x / ( 1.0D+00 + 25.0D+00 * x * x )**2 return end function runge_deriv2 ( x ) c*********************************************************************72 c cc runge_deriv2() evaluates the second derivative of the Runge function. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 23 March 2025 c c Author: c c John Burkardt c c Input: c c double precision x: the argument of the function. c c Output: c c double precision runge_deriv2, the value of the second derivative. c implicit none double precision runge_deriv2 double precision u double precision up double precision v double precision vp double precision x u = - 50.0D+00 * x up = - 50.0D+00 v = ( 1.0D+00 + 25.0D+00 * x * x )**2 vp = 2.0D+00 * ( 1.0D+00 + 25.0D+00 * x * x ) * ( 50.0D+00 * x ) runge_deriv2 = ( up * v - u * vp ) / v**2 return end function runge_fun ( x ) c*********************************************************************72 c cc runge_fun() evaluates the Runge function. c c Discussion: c c This function causes a breakdown for c polynomial interpolation over equally spaced nodes in [-1,+1]. c c Runge originally considered the function 1/(1+x^2) over the c interval [-5,+5]. For convenience, a rescaled version is considered c over the interval [-1,+1]. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 23 March 2025 c c Author: c c John Burkardt c c Input: c c double precision x: the argument of the function. c c Output: c c double precision runge_fun: the value of the function. c implicit none double precision runge_fun double precision x runge_fun = 1.0D+00 / ( 1.0D+00 + 25.0D+00 * x * x ) return end function runge_power_series ( x, n ) c*********************************************************************72 c cc runge_power_series() evaluates a power series for the Runge function. c c Discussion: c c The Runge function considered here has the form c f(x) = 1 / ( 1 + 25x^2 ) c c The power series is 1 - (5x)^2 + (5x)^4 - (5x)^6 + (5x)^8 - (5x)^10 ... c c The power series is only well defined in the open interval c -1/5 < x < 1/5 c where successive terms gradually go to zero. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 25 March 2025 c c Author: c c John Burkardt c c Input: c c real x: the argument of the function. c c integer n: the number of terms to be computed. c c Output: c c real value: the value of the function. c implicit none integer i integer n double precision runge_power_series double precision term double precision value double precision x value = 0.0D+00 term = 1.0D+00 do i = 1, n value = value + term term = - term * ( 5.0D+00 * x )**2 end do runge_power_series = value return end