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
< ? php function func ( $ x , $ y ) { return ( $ x + $ y + $ x * $ y ) ; } function euler ( $ x0 , $ y , $ h , $ x ) { $ temp = -0 ; while ( $ x0 < $ x ) { $ temp = $ y ; $ y = $ y + $ h * func ( $ x0 , $ y ) ; $ x0 = $ x0 + $ h ; } echo " Approximate ▁ solution ▁ at ▁ x ▁ = ▁ " , $ x , " ▁ is ▁ " , $ y , " STRNEWLINE " ; } $ x0 = 0 ; $ y0 = 1 ; $ h = 0.025 ; $ x = 0.1 ; euler ( $ x0 , $ y0 , $ h , $ x ) ; ? >