acer

32313 Reputation

29 Badges

19 years, 312 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

Could you please upload and attach a Maple .mw worksheet that is self-contained enough to reproduce your problem (at least if run in the same version as your Maple 2019)?

Could you please check that the same example exists in the Programming Guide that is bundled in the Help system for your Maple 2019?

My Maple 2019 version of the Programming Guide has named sections and subsections, but no page numbers. But I'd like to not only know which example is problematic for you, but to see the worksheet in which it fails.

I'm supposing that you are using the last (freely upgraded) Maple 2019.2 point-release for that version.

Many calculations can be programmed in Maple in several different ways, some of which may be fast and efficient, and some of which may be slow and inefficient. In my experience it is common for the most important thing to be obtaining a fast and efficient scalar/nonparallelized implementation first and foremost, and then move on to parallelization only when that is very good. Often times the improvements possible for an inefficient scalar/nonparallelized implementation significantly outweigh the further benefits of parallelization. Hopefully you'll be able to share some of the crucial bits of your monte-carlo simulation code, if you suspect that might be optimized.

It's not clear to me that you read and digested the commentary in my answer.

Would you be prepared to accept a result closer to y=0? If so, how close?

restart;

inf:=10:

pdes:= diff(u(y,t),t)-xi*diff(u(y,t),y)=diff(u(y,t),y$2)/(1+lambda__t)+Gr*theta(y,t)+Gc*C(y,t)-M*u(y,t)-K*u(y,t),
         diff(theta(y,t),t)-xi*diff(theta(y,t),y)=1/Pr*diff(theta(y,t),y$2)+phi*theta(y,t),
         diff(C(y,t),t)-xi*diff(C(y,t),y)=1/Sc*diff(C(y,t),y$2)-delta*C(y,t)+nu*theta(y,t):
  conds:= u(y,0)=0, theta(y,0)=0, C(y,0)=0,
          u(0,t)=0, D[1](theta)(0,t)=-1, D[1](C)(0,t)=-1,
          u(inf,t)=0, theta(inf,t)=0, C(inf,t)=0:
  pars:= { Gr=1, Gc=1, M=1, nu=1, lambda__t=0.5,
           Sc=0.78, delta=0.1, phi=0.5, K=0.5, xi=0.5
         }:

Digits:=20:
PrVals:=[0.71, 1.00, 3.00, 7.00]:
colors:=[red, green, blue, black]:
plt:='plt':
for j from 1 to numelems(PrVals) do
    pars1:=`union`( pars, {Pr=PrVals[j]}):
    pdSol:= pdsolve( eval([pdes], pars1),
                     eval([conds], pars1),
                     numeric, timestep=0.01, spacestep=0.001
                   );
    U := (Y,T)->eval(u(y,t),pdSol:-value(t=T)(Y));
    try
      plt[j]:=plot(D[1](U)(1e-10,t), t=0..2, color=colors[j]);
    catch: end try;
od:
plots:-display(convert(plt,list));

Download badPDE_ac2.mw

@petit loup There is nothing abjectly wrong with your use of roll, assigned via RandomVariable.

You primary performance issue is mainly solved just by using the more appropriate syntax I gave, ie.   Sample(roll, [n,n]) .

On a related note, your work might require regenerating additional (possible large) samples from the same random variable. That can be done with a slight efficiency gain by reusing the Matrix container.  Eg,

   X := Sample(roll, [n,n]):

and then, later on, perhaps several times,

   Sample(roll, X):

That last call repopulates the existing Matrix X with a fresh collection of random values. If done many, many times the saved overhead of not having to construct/memory-manage the previous Matrix structures may be measurable.

@Muhammad Usman Your original image showed no labels or ticks or values on the axes, so I removed them. You can get them back by removing the relevant options, eg.

restart;

with(plots): with(plottools,polygon): with(ColorTools,Color):

f := 11-((x-4)^2+(y-3)^2)/25: (a,b,c,d) := -5,11,-5,11:

Q := plot3d(f, x=a..b, y=c..d): (zmin,zmax) := (min,max)(op([1,3],Q)):

display(densityplot(f, x=a..b, y=c..d, 'style'=':-surface',
                    'colorscheme'=["zgradient",["Blue","Red"],'colorspace'="HSV"]),
  seq(polygon([[0,0],[0,0]],'thickness'=0.3, 'legend'=sprintf("%5.3f",z),
              'color'=Color("HSV",[:-Hue(Color("Blue"))*(zmax-z)/(zmax-zmin),1,1])),
      z=zmax..zmin, 'numelems'=24),
  'legendstyle'=['location'=':-right'], 'size'=[580,500], axes=frame);

Download M2022_colorbar_fun2.mw

Other changes to the axes can be done by simply using the usual options in the usual ways.

ps. As for your sequence of space-curves, for which you obtained a surface using surfdata, have you considered creating a interpolating function F from sampling those space-curves? Such a function call F(x,t) could be used with plot3d, densityplot, etc, just like the example expression above. Or you might use some formula in x and t thst produced the sequence...

@Muhammad Usman What does that mean, the "contour plot of the sequence"?!

I'm giving up. You're only providing brief, inadequate (and, to me, meaningless) fragments. It's not a proper description.

@Muhammad Usman Why would you think that either of those would work in densityplot?!

You have not given a proper or adequate description of what you're actually trying to do.

@Muhammad Usman You assign to f the result from plots:-surfdata, and then pass that f as the first argument to plots:-densityplot.

What do you expect that to do?

You should describe what you're actually trying to do, in adequate detail. I can't help you, if you don't.

What version of Maple are you using? Is it still Maple 2015?

Please put close followup queries to this here, instead of spawning wholly separate new Question threads for such.

@C_R I started with the Help page ?dsolve,numeric,DAE because in your Question you showed that the call came from the example worksheet for ?examples,numeric_DAE.

ps. If I enter the following in the Google search bar of my Chromium web-browser then the first hit is to that ?dsolve,numeric,DAE Help page.
    maple help dsolve "differential option"

I'm merely reporting what worked for me. Searching is often tricky.

@Traruh Synred Your boostTo.mw attachment here was saved using Maple 2018.2 (released in the year 2018), and not Maple 18 (released in the year 2014).

The naming scheme was changed in 2015, to have the release number match the year.

@Traruh Synred Your dMemB1List and dMemB2List are rtables (eg. Arrays, or row Vectors), and not lists.

You could try and concatenate them with,

   <dMemB1List|dMemB2List>

Your worksheet is missing code that defines B_recursive.

@Rouben Rostamian  This is nicely explained. Vote up.

If I'm not mistaken, a savings in the size of the constructed plot structure can be had by using a value of 2 for the first entry of the grid option, eg, grid=[2,49]. (The default value is 49.)

mw_3_ac.mw

@zenterix It seems that you haven't understood what I wrote about calling value.

The name R occurs inside the inert call %log[10](R), so you can turn that into its active call and then solve it by,
    solve(value(expr), R)

An inert call (preceded by %) is inactive, like a placeholder. From the Help page for the value command, "During computations, inert functions remain unevaluated (the operations they represent remain unperformed)."

First 59 60 61 62 63 64 65 Last Page 61 of 591