i have 2 lists and i want to add together the corresponding rows like as in matrix addition.

midpoint_system = function(f, a, b, x0, N){

h = (b-a)/N

time_seq = seq(a, b, h)

hat_x = matrix(0, ncol = length(x0), nrow = (N+1))

hat_x[1,] = x0

for (i in 1:N){

w = hat_x[i,] + h*f(time_seq[i], hat_x[i,])/2
hat_x[i+1,] = hat_x[i,] + h*f(time_seq[i]+h/2, w)

}

return(list(t=time_seq, x=hat_x))

return(c(0,list(h)))

return(list(((t=time_seq[i]) + (x=hat_x[i]))*-1))

}

this is the code and as you can see in the first return i have a list with 2 columns and i want to add these together.