Euler Method for solving differential equation | Consider a differential equation dy / dx = ( x + y + xy ) ; Function for Euler formula ; Iterating till the point at which we need approximation ; Printing approximation ; Initial Values ; Value of x at which we need approximation
function func ( x , y ) { return ( x + y + x * y ) ; } function euler ( x0 , y , h , x ) { let temp = - 0 ; while ( x0 < x ) { temp = y ; y = y + h * func ( x0 , y ) ; x0 = x0 + h ; } document . write ( " " + x + " " + y ) ; } let x0 = 0 ; let y0 = 1 ; let h = 0.025 ; let x = 0.1 ; euler ( x0 , y0 , h , x ) ;