MaplePrimes Questions

Search Questions:

Latest Questions Latest Questions Feed

HI there,

 

I have the following problem: I want to improve the runtime of my script (Maple 2016) and want to use multithreading/tasking.

First I have this script (let's start with an easy example):

>restart;
  with(LinearAlgebra): 
  with(Student[MultivariateCalculus]):
  with(plots):
  with(Statistics):
  with(Threads):
  with(RealDomain): #I know, I don't need all of that here

>cdf := x-> int(PDF(GammaDistribution(4.5/100,2.5),xi-0.068),xi=0.068..x):
>N:= 20:
>sample := (i) -> solve( (1/(2*(N+1))+1/(N+1)*i)=cdf(x),x): #this is an equidistant sampling

> smpl := [Seq(sample(i),i=1..(N-1))]; #I try to run a multithread seq -> got it from the documentation

   Error, (in assuming) when calling 'Engine:-Process'. Received: 'type `System` does not exist'

I get this error message, but I don't really know what to do with it. I googled and searched, but I couldn't find useful help. Note that when I run this command, I still use only one processor (at least until it returns the error). I also tried:

>smpl := Map(sample,sample_dists);>N:= 20:
   Error, (in assuming) when calling 'Engine:-Process'. Received: 'type `System` does not exist'

I also tried to implement it with threads:

> cont := proc()
      global mutex_sample, smpl:
      smpl := [op(smpl), _passed]: #add the results of the tasks to the smpl var.
      print("Sampling Done");
   end proc:

> sample := proc(cdf, min, max, N) #samle the region
      local output:
      seq(solve(,x),i=0..(N-1)); #return value
   end proc:

> startSampling := proc()
      local sampling_tasks,i:

      print("Starting Sampling!");
      sampling_tasks := []:
      for i from 1 to kernelopts(numcpus) do #for each processor
          sampling_tasks := [op(sampling_tasks), Task=[sample, cdf, i/(kernelopts(numcpus)+1),(i+1)/(kernelopts(numcpus)+1),ceil(N/kernelopts(numcpus))]]; #sample a region
      end do:

      print("Starting Sampling Tasks!");
      Threads:-Task:-Continue( cont, op(sampling_tasks)); #start sampling threads
      print("Sampling Tasks started!");
   end proc:

> Threads:-Task:-Start( startSampling ); #start everything

"Starting Sampling!"
"Starting Sampling Tasks!"
"Sampling Tasks started!"
Error, (in assuming) when calling 'Engine:-Process'. Received: 'type `System` does not exist'

 I know I'm doing here something systematically wrong, but I can't figure it out.

I would be very greatful, for your help or insiged.  

 

EDIT: 
1) The presented script might doesn't make sense (or might be pointless), because I have a much larger and more complex (model) in my original script. But, my script didn't work (exactly same error). So, I tried this simple example, to figure out what the problem is. But it didn't work either. I thought, it might be better (didactically) to find the problem in the simple code. It might be easier to explain in a forum and easier to analyse. (SO I could then see why my more complex code is not working).

2) I was running the script in Linux (Ubuntu 16.04 x64) and it produced this error. I also run the script in Windows 10.2 where I got the same error (and sometimes I got an "Maple Kernel cannot be reached" message where I had to restart Maple.

3) I noticed that solve sometimes returns a complex solution (usually it returned: "value + 0.0 I"). I therefore added "with(RealDomain): ", which had the consequence that some sample points were "NULL". I know that, and that is another issue, which I'm not bothered about (right now).

SOLUTION: (most likely)
Thanks to everyone who replied. But Carl_Love probably is right by pointing out that int, solve, fsolve ... are not thread-safe and therefore caused the crahses/error messages, while calling thesefunctions in different threads.

Hello

I wonder if there is a function to retrieve only the monomials from a multivariable polynomial in x, y and z. Below is one such polynomail.

 

theta[2]*x3*x0-theta[8]*x2*x1*x0-theta[2]*x2*x1-theta[6]*theta[2]*x2*x0^2-theta[4]*theta[2]*x2*x0-theta[2]*theta[7]*theta[10]*x1*x0^3+theta[8]*theta[2]*theta[9]*x1*x0^2-theta[2]*theta[5]*theta[10]*x1*x0^2-theta[2]^2*theta[3]*theta[10]*x0^3+theta[6]*theta[2]^2*theta[9]*x0^3+theta[4]*theta[2]^2*theta[9]*x0^2

and the result

[x3*x0,x2*x1*x0,x2*x0^2,x2*x0,x1*x0^3,x1*x0^2,x0^3,x0^2]

Many thanks

 

Ed

 

I downloaded a maplesoft apps, and wat to activate, an activeation form displayed requiring me to put in a purchase code of which i don't know or have. How can i get it or where can i find it? please some one help.

Does anyone know what the default function is for the pre-subscript and pre-superscript?  I would like to use them for a variable name to represent the local reference frame and global reference frame in my multibody calculations.  Thanks

1.I want to plot (x-x0)^2 from x=0..10 with a value for x0 in the plot function not in the procedure. The procedure should 

test x against x0 and if x<x0 then y=0 else y=(x-x0)^2

2.Is it possible to use explore and use x0 as a slider?

 

Regards

Staffan

 

http://mathforum.org/kb/message.jspa?messageID=685890

i find equation above

for ii from 0 by 5 to 365 do
eq1 := x^2 + y^2 = arccos(x/r);
eq2 := y = evalf((atan(-1) - ii*Pi/180)/Pi)*(-1.0)*x;
xy := fsolve({eq1, eq2});
print("M",rhs(xy[1]),rhs(xy[2]),","):
od:

but i do not understand how to set r

i use a line scanning 365 degrees to get the path of swirl 

would like to get path data for c# WPF animation

but this method may have multiple solution because an intersection of swirl 

and a line can have multiple points

how to change rotation angle into slope of line?

with(MTM):
evalf(solve(atan(-1) - 45*Pi/180 = atan(x), x))*180/Pi;

above can not be solved

 

if angle is 30 degree

is following correct?

with(MTM):
angle := 30:
evalf((atan(-1) - 30*Pi/180)/Pi)*(-1.0);

Hello people in mapleprimes,

I have a question:
What are you doing when you use maple in calculating, for example, your paper,
to avoid missing, for example, variables you use, or for your needs to look back the outcomes you obtained before?
If this is a paper-using work, on considering what to do next, you will read some pieces of papers you wrote and
on which you had calculated and obtained necessary equations. But, with small monitor 13 inch, and with
inconvenience of dealing with things in PC, compared with papers, I feel some stress in using maple in writing a paper.
So, now, I am asking you what kind of methods you has devised to make what you are writing compact and easy,
for you to handle with what you are writing.

I know surely that there are the document block, which enables output or input to not be shown, the workbook,
which is helpful in putting attached worksheets or jpg files together at one workbook, and the distinction of ":" and ";",
which in the case of the former, hides expressions in the outcome.

But, yet, I want to ask you about the ways you use to make it easy to write something.
If you have some, I will be very glad if you show it here.

Best wishes.

taro

 

 

 

 

 

 

I would like compute the vertices of the convex hull of finitely many points in some \mathbb{R}^{n}, where the coordinates of these points could be rational numbers or irrational numbers like \sqrt{2}.

I know that PolyhedralSets[ConvexHull] is a direct command, however it does not support irrational numbers. But if I transform all coordinates into floating point numbers, for some rational numbers the rounding error would be large enough to affect the result. For example, after the transform some collinear points are no longer collinear.

Thanks!

 

 

 

Dear All

I need to reduce system of differential equation system into triangular system which I came to know can be done using Maple package "DifferentialAlgebra", but I do not know how to use this package for triangularization.

The differential system is DetSys derived from  some PDE:

 

with(PDEtools):

DepVars := [f(u(x, t)), u(x, t)]; 1; declare(f(u(x, t)), u(x, t))

[f(u(x, t)), u(x, t)]

 

f(u(x, t))*`will now be displayed as`*f

 

u(x, t)*`will now be displayed as`*u

(1)

PDE1 := diff(u(x, t), t, t)-(diff(u(x, t), x, x))-f(u) = 0

diff(diff(u(x, t), t), t)-(diff(diff(u(x, t), x), x))-f(u) = 0

(2)

G := [xi(x, t, u), tau(x, t, u), phi(x, t, u)]

[xi(x, t, u), tau(x, t, u), phi(x, t, u)]

(3)

declare(G)

phi(x, t, u)*`will now be displayed as`*phi

 

tau(x, t, u)*`will now be displayed as`*tau

 

xi(x, t, u)*`will now be displayed as`*xi

(4)

DetSys := DeterminingPDE(PDE1, G, integrabilityconditions = false)

{-2*(diff(diff(tau(x, t, u), t), u))+diff(diff(phi(x, t, u), u), u), 2*(diff(diff(tau(x, t, u), u), x))-2*(diff(diff(xi(x, t, u), t), u)), 2*(diff(diff(xi(x, t, u), u), x))-(diff(diff(phi(x, t, u), u), u)), 2*(diff(tau(x, t, u), x))-2*(diff(xi(x, t, u), t)), 2*(diff(xi(x, t, u), x))-2*(diff(tau(x, t, u), t)), diff(diff(tau(x, t, u), x), x)+2*(diff(diff(phi(x, t, u), t), u))-(diff(diff(tau(x, t, u), t), t))-3*(diff(tau(x, t, u), u))*f(u), diff(diff(xi(x, t, u), x), x)-2*(diff(diff(phi(x, t, u), u), x))-(diff(diff(xi(x, t, u), t), t))-f(u)*(diff(xi(x, t, u), u)), -(diff(diff(phi(x, t, u), x), x))+diff(diff(phi(x, t, u), t), t)-phi(x, t, u)*(diff(f(u), u))+(diff(phi(x, t, u), u))*f(u)-2*(diff(tau(x, t, u), t))*f(u), diff(diff(tau(x, t, u), u), u), diff(diff(xi(x, t, u), u), u), diff(tau(x, t, u), u), diff(xi(x, t, u), u)}

(5)

for EQ in sort([op(DetSys)], length) do EQ = 0 end do:

 

 

Download [1117]_Symmetries_determination.mw

Regards

USB and or RS232 porting from inside maple console. Title explains what i need, or how to port an externally built java app into the maple console, either which will engine my dispatch tonight

Hello everybody!
I have a PDE with initial and boundary conditions. I want to plot its solution by taking "t" as x axis. I have seen the documentation. It only has the space variable on x axis. Please show me a way to achieve what I intend.

here is the file pdsolve.mw

The value of x can be chosen as 0.16 or 0.21

I wish to define a function which is the derivative of another function.

> f:=(x)->x^2:

> g:=(x)->diff(f(x),x):

> g(x);

2 x

> f(2);

4

> g(2);
Error, (in g) invalid input: diff received 2, which is not valid for its 2nd argument

 

I cannot find a way in which I can define the function g, using the functional operator, so that I can actually evaluate g(x).

 

How can I do this?

 

i think i might have asked this before for another thing if so im sorry but anyway i think its @ or something, i would like to plot the final output here indexed against th

NrANGE := (rand(0 .. 20))()

Š := {}

Y := proc (X) local N, S1, Š; if X <> `union`(X, S1[N]) then N := (rand(1 .. NrANGE))(); S1[N] := {K[1](N+1), K[1](N)}; Š := `union`(X, S1[N]) else  end if end proc

NULL

NrANGE := (rand(0 .. 20))(); nops(Y(Y(Y(Y({}))))); nops(Y(Y(Y({})))); nops(Y(Y({}))); nops(Y({}))

``

 

Download mapleprimes90916.mw

e number of iterations of Y conducted besides the original performed on the empty set

I am trying to solve a PDE using pdsolve-numeric. I am getting an error related to boundary conditions.
Please see the follwing worksheet and suggest me some solutions

pdsolve.mw

3 4 5 6 7 8 9 Last Page 5 of 1358