Question: Error, (in dsolve) type `System` does not exist when using dsolve inside threads.

I am trying to see if I can get speed up by using dsolve inside thread.

I made very simple example of global list of two differential equations to start with.

Next, created two threads where each picks one ode from the global list to process. So they should in theory run in parallel. The list of ode's is a global list in the worksheet for now.

But I keep getting error when calling dsolve 

               Error, (in dsolve) type `System` does not exist

I tried also passing the actual ode to the thread, still, same error.

Next, I did not pass anything, but called dsolve directly from inside thread proc on same ode. The ode is local variable inside the proc. I still get same error.

                        Does this mean dsolve is not supported by threads? 

But when I searched this subject, AI says it works in threads:

 

Everything works OK when I run dsolve in worksheet outside thread (i.e. normally).

I will show below worksheet showing these cases. I must not be doing something right. But what? Can one not pass data from global worksheet to the thread this way? Or does one needs to load something in each thread to make this work?

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1840 and is the same as the version installed in this computer, created 2024, December 2, 10:11 hours Pacific Time.`

libname;

"C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib", "C:\Program Files\Maple 2024\lib"

Example 1. Passing index of list to thread

 

restart;

g_list:=[sin(t)*diff(x(t),t$2)+cos(t)*diff(x(t),t)+2*x(t)=0,
         diff(y(x),x)=lambda*sin(lambda*x)*y(x)^2+a*cos(lambda*x)^n*y(x)-a*cos(lambda*x)^(n-1)]:

work_func:=proc(i::posint)  
  :-dsolve(g_list[i]):
end proc:

Threads:-Wait(  seq( Threads:-Create( work_func(i)), i=1..2) );

Error, (in dsolve) type `System` does not exist

Example 2. Passing actual ode itself to thread

 

restart;

g_list:=[sin(t)*diff(x(t),t$2)+cos(t)*diff(x(t),t)+2*x(t)=0,
         diff(y(x),x)=lambda*sin(lambda*x)*y(x)^2+a*cos(lambda*x)^n*y(x)-a*cos(lambda*x)^(n-1)]:

work_func:=proc(ode::`=`)  
  :-dsolve(ode):
end proc:

Threads:-Wait(  seq( Threads:-Create( work_func(g_list[i])), i=1..2) );

Error, (in dsolve) type `System` does not exist

 

Example 3. Normal processing. No threads

 

restart;

g_list:=[sin(t)*diff(x(t),t$2)+cos(t)*diff(x(t),t)+2*x(t)=0,
         diff(y(x),x)=lambda*sin(lambda*x)*y(x)^2+a*cos(lambda*x)^n*y(x)-a*cos(lambda*x)^(n-1)]:

work_func:=proc(ode::`=`)  
  :-dsolve(ode):
end proc:

for item in g_list do
    work_func(item);
od:

#no error

 

Example 4. do not pass anything. Just call dsolve

 

restart;

work_func:=proc(i::posint)  
  local x,t;
  local ode:=sin(t)*diff(x(t),t$2)+cos(t)*diff(x(t),t)+2*x(t)=0;
  :-dsolve(ode):
end proc:

Threads:-Wait(  seq( Threads:-Create( work_func(i)), i=1..2) );

Error, (in dsolve) type `System` does not exist

 

 

 

Download error_dsolve_using_threads_dec_26_2024.mw

Please Wait...