Question: Optimization problem with Matrix values - MS Excel vs. Maple

I got an MS Excel file where the matrix (7054x60) is created and the last row of the matrix is used for optimization of its (the matrix) values. In Maple you can create the matrix as follows:

M := Matrix(7054, 60):
for i to 10 do M[1, i] := 1 end do:

Mat_proc := proc(x)
  local i, j;
  global M;
  for i from 2 to 7054 do
    M[i, 1] := M[i-1, 2];
    M[i, 60] := M[i-1, 59];
    for j from 2 to 59 do
      M[i, j] := M[i-1, j] + x * (M[i-1, j-1] - 2*M[i-1, j] + M[i-1, j+1])
    end do
  end do;
return [seq((1/10)*add(M[7054, i+10*j], i = 1 .. 10), j = 1 .. 3)]
end proc:

The values in the first row are given, the values in the next rows are computed recursively depending on a parameter x. We are also given a list of values y and try to find such matrix which minimizes the sum of squares of differences between the returned list from a procedure and y. It can look like:

y:=[0.8045, 0.1834, 0.0006]:
with(Optimization):

Minimize(add((Mat_proc(x)[i]-y[i])^2, i = 1 .. 3), x = 1e-3 .. 1);

My problem is that it lasts so so long, I even don't know how long it lasts when it finds a solution, since I always stopped it after some time. If you want to try it I recommend to use only some small number (like 7 or 10) instead of those 7054.

In the Excel file the matrix is created (or better said: updated) for given x in approximately half time than it is in Maple. The optimization by the Excel's solver takes around 1:30min, in Maple I never had patience longer than around 20min. So I would like to ask what I'm doing wrong. How is it possible that it is (much) more efficient in Excel?

Please Wait...