I have a problem using numerical methods to solve a differential equation, and thought it might be a good opportunity to learn some basic Haskell. I have the following recurrence relation:

and the initial condition u(x, 0) = x^2
. I translated them into Haskell like this (adding the appropriate values ββfor a, b, c, h and k from a specific problem and noting that u_ij is defined as u(i*h, j*k)
):
u :: (Floating a, Eq a) => a -> a -> a
u x 0 = x*x
u x t = a*k / b*h * (u (x-h) (t-k))
+ (1 - (3*k/2*h))*(u x (t-k))
+ k/b * cos x
where
a = 3
b = 2
k = 0.1
h = 0.2
main = putStrLn (show (u 1 0.5))
, . , , u x 0
. , , - , epsilon, , , . , , . , , ?