Question: How to make (if possible) this procedure ThreadSafe?

Hello

I have the following procedure that uses the Lie Derivatives of a vector field to build a set of equations.

LieDerList:=proc(h::symbol,f::list,vars::list)
description "This function returns the system of equations based on the Lie derivative.":
local i,n:=numelems(vars),L:=Array(0..n):
L[0]:=h:
for i from 1 to n do
    L[i]:=inner(f,map((a,b) -> diff(b,a),vars,L[i-1])):
end do:
return(zip((w,v)->simplify(w-v),[seq(L)],[seq](cat(h,i),i=0..n))):
end proc:

Below it is an example on how to call the procedure.

I used CodeTools:-ThreadSafetyCheck to check all the procedures used within LieDerList and LieDerList itself, but nothing wrong came out. However when I try to run 

LieEq4:=Threads:-Map(w->LieDerList(x,w,[x,y,z]),models4):

where models4 is a list of 1765 elements, maple returns "Error, (in factors) attempting to assign to `LinearAlgebra:-Modular:-Create` which is protected". If I change Threads to Grid, there is no problem at all.  

What am I overlooking? Is there a method to ensure the procedure is thread-safe?

Many thanks.   

PS.  I found one problem - inner, which is related to LinearAlgebra package, is not thread-safe.  

Please Wait...