#*****************************************************************************80 # ## euler_test tests euler. # # Licensing: # # Copyright 2016 James P. Howard, II # # The computer code and data files on this web page are distributed under # https://opensource.org/licenses/BSD-2-Clause, the BSD-2-Clause license. # # Modified: # # 23 March 2020 # # Author: # # John Burkardt # cat ( date ( ), "\n" ) cat ( "\n" ) cat ( "euler_test\n" ) cat ( " ", version$version.string, "\n" ) cat ( " euler uses the Euler method to solve an ordinary differential equation.\n" ) source ( "/home/john/public_html/r_src/euler/euler.R" ) f <- function ( t, y ) { y / ( 2.0 * t + 1.0 ) } cat ( "\n" ) cat ( " f(t,y) = y/(2*t+1)\n" ) cat ( "\n" ) t0 = 0.0 y0 = 1.0 tstop = 1.0 n = 5 solution <- euler ( f, t0, y0, tstop, n ) print ( solution ) t0 = 0.0 y0 = 1.0 tstop = 1.0 n = 10 solution <- euler ( f, t0, y0, tstop, n ) print ( solution ) # # Terminate. # cat ( "\n" ) cat ( "euler_test\n" ) cat ( " Normal end of execution.\n" ) cat ( date ( ), "\n" ) quit ( )