acer

32343 Reputation

29 Badges

19 years, 328 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@mmcdara There are concrete benefits which support this point of view.

The representation is sparse, and so can take less space or memory.

That can hold for line-printing. It can also hold for round trip programmatic recreation, using `rtable`, `rtable_indfns`, `rtable_elems`, and `rtable_options`.

@mmcdara Right. The creating of a temporary rtable, and its processing by the garbage collector afterwards, incurs a relatively small time penalty.

The penalty in memory allocation incurred by the extra rtable is transient, and the collected memory can even be returned to the OS now.

Memory "used" just means memory processed by the garbage collector, and its significant effect is just whatever time that takes.

But, aside from that time overhead, memory "used" is not a penalty in itself.

On a related topic, I would like to see Statistics:-Sample become thread-safe. And I'd like to be able to parallelize it. I suspect it may be assigning to module locals in the usual thread-global way (although there is special syntax available now for thread-local module locals).

@Gabriel samaila So why did you upload an attachment saved with Maple 16 before?

@Gabriel samaila The worksheet you attached was saved using Maple 16, which was released in the year 2012.

That is not the same as Maple 2016, which was released in the year 2016.

The size option for 2D plotting commands was introduced in Maple 18, released in the year 2014.

Maple 16      (2012)
Maple 17      (2013)
Maple 18      (2014)
Maple 2015  (2015)
Maple 2016  (2016)
Maple 2017  (2017)
Maple 2018  (2018)

I look forward to Maple 2019, since there was no Maple 19.

 

@Carl Love Actually, It would only be slightly faster, since Statistics:-Sample is returning a Vector with datatype=float[8].

The elementwise operation cot~ applied over a float[8] Vector uses evalhf, and is already fast.

With map[evalhf,inplace] there is small benefit in avoiding creation of new Vector, with the copy semantics of the elementwise operation.

@Haqphy12015 I don't really see how your uploaded data could make a plot that looks exactly like that image. Leaving aside the integration, did you expect the blue curve of the data itself to loo like the image? The domain of w doesn't even match.

Here's what I get from your uploaded data. Note that I don't know what you expect to happen when w becomes zero (especially given how your uploaded image doesn't show blowup). So I just fudged that case to act like w=1.

I don't see how higher order interpolation could be meaningful results for you large w increments (not to mention the division by small w).

I didn't bother to multiply the integration results by 2, which might be what you were trying to state in your question.

restart;

M := ImportMatrix(cat(kernelopts(homedir),"/mapleprimes/data-w-a2F(w).txt")):

M[1,..];

"[[["w",,,"a2F(w)"]]]"

m := op([1,1],M)-1;

200

W := M[2..,1]:
F := <seq(seq(M[j,i],i=2..4)[1],j=2..m+1)>:

A:=<W|F>;

A := Vector(4, {(1) = ` 200 x 2 `*Matrix, (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

H := proc(N::posint)
  local i, S1, S2;
  S1:=add(F[i]/`if`(W[i]=0,1,W[i])*(W[i]-W[i-1]),i=2..N):
  S2:=add(F[i]/`if`(W[i]=0,1,W[i])*(W[i+1]-W[i]),i=1..N-1):
  (S1+S2)/2;
end proc:

Hdata := [seq([W[i],H(i)],i=1..m)]:

plots:-display(
  plot(A, color=blue),
  plot(Hdata, color=black),
  size=[500,300]
);

 

Download numint_data.mw

@Preben Alsholm Just a few observations.

numint.mw

@sand15 You have it backwards in your comment. After executing with(Tolerances) the call `+`(a,b) is a shortcut for Tolerances:-`+`(a,b) .

I'll update the attachment in my Answer, to make it more clear, with comments in the relevent lines. The points I hoped to make in my attachment were that add([a,b]) is picking up the global :-`+`, and [3,2] *~ [x,y] is picking up the global :-`*`. I was trying to illustrate this by comparison of the outputs.

As Tom mentioned elsewhere, what I would do, hitting both package exports as desired, is:
    `+`(op( zip(`*`, [3,2], [x,y]) ));

As far as "loading" multiple packages by utilizing the with command, yes, that means only the latest rebinding of any commonly named export is available by short syntax. That's just a logical consequence of the fact that a name can only be bound to one thing at a time, though, and not directly related to your original Question.

In case it's not immediately obvious, I could mention that one benefit of the contourlabels option, which I've also now given to the legend option, is the use of the name 'contourvalue' to refer to any contour without knowing its value in advance.

The plots:-contourplot command allows you to specify explicitly the function values attained at each of the contours, or not.

Specifying the contour values means that you know what you're getting, but it puts the burden on you to know something about the range of the function up front.

Not specifying the contour values in the command's call can be convenient, but can also bring an extra desire for some visual cue about what function values the displayed contours actually have. The plots:-contourplot doesn't always choose the best spread of values, internally, but it often makes a decent choice and it is often convenient to let it choose.

The 'contourvalue' name acts like a placeholder in the contourlabels option, and also in my legend option. And it works whether the contour values are specified explicitly, or not.

@vv Yes, that is a very good point. I think that it's a key topic in 3D plotting, and it would be good to see documented examples that illustrate the consequences of what MESH vs GRID (and parametric form, or functional variable ranges) structures allow.

For some time I've been meaning to finish a Post about 3D plotting over irregular/incomplete 2D domains, including some examples (and even a some work on programmatically "solving" the issue). I'm busy with pressing work, but I'll try and find some free evening time.

@Joe Riel The OP has asked several questions in the past months that related to passing around expressions that happen to pretty-print in a particular manner.

So it's not a huge stretch to imagine that the OP is not looking for merely an immediate printing effect here. And even if he were, the previous indications are also that 2D Output, and centering, may be preferred (even if it's only an italic effect on names). So it could well be that printf and sprintf are not what he's after.

Of course I do not know for sure. The OP has a long history of providing very little in terms of background detail.

@vv Sometimes there are tricks...

restart;
c:=piecewise(u+v<Pi, 1/6, u+v<2*Pi, 2/3, 1):
opts:=coords=spherical,color=c,grid=[49,49],style=surface:
plots:-display(plot3d([1,u,v],u=0..2*Pi-2*v,v=0..Pi,opts),
               plot3d([1,u,v],u=2*Pi-2*v..2*Pi,v=0..Pi,opts));

One of the things this whole thread reminds me of is that the plotting structures are capable of representing some useful plots which cannot easily (if at all) be produced using stock plotting commands.

Here, I'm thinking about just the plot, plot3d, plots and plottools package commands. Consideration of the various visualization commands under the Student and VectorCalculus packages brings even more complexity.

I submitted some bug reports about gaps a few years ago, when doing a functionality review. But for me one of the big lessons was the reminder that the plotting structures can be manipulated programmatically. I knew that, of course, but a reminder can help. (Experimentation over the years have led to a few pleasant surprises/discoveries, eg. 1, 2, 3, 4, some of which have made there way in a new stock plotting options.) I plan to submit a Software Change Request for the OP's suggested functionality, too.

It is not helpful to omit a worksheet that demonstrates the problem, as well as the release number of the version that the Professor is using to open it.

You can use the green up-arrow of the Mapleprimes editor to upload and attach a file.

@Carl Love That's a good point, about syntax errors being subtly highlighted in a Code Edit Region.

In Maple 2018 there is even a way to get addtional information about syntax errors. The informations comes from the GUI's new use of mint.  The information becomes available by copying the 1D code to the Startup Code popup, which can be opened using File -> Edit from the main menubar.

In both a Code Edit Region and the Startup Code popup, the given example displays with the , fi , od , and end underlined with a red squiggle. As noted already, the problem is that there is no then , which bars the do-loops and proc from ending.

In the Startup Code popup the following appears in its bottom console:

Error: Line 5: Syntax error: syntax error - Probably missing the keyword then or an operator such as *
Error: Line 5: Syntax error: Syntax errorA "fi" was found without a previous matching "if" or "then".A "then" may be needed to close the "if" construct from line 5.
Error: Line 6: Syntax error: reserved word `od` unexpected
Error: Line 6: Syntax error: reserved word `od` unexpected
Error: Line 7: Syntax error: reserved word `end` unexpected

Unfortunately there is only one Startup Code popup (which might already be in use), while one can insert multiple Code Edit Regions.

For some people it might be nice to see the mint information become available via any Code Edit Region.

Personally, I am not any kind of fan of Code Edit Regions, as I find them far more awkward to use than simple 1D Execution Groups. What I would like to see is Execution Groups getting the syntax highlighting and mint checking, but without any of the awkwardness of Code Edit Regions.

 

@rath1 You should be able to submit a bug report (Software Change Requestion) here.

It's not very useful if it doesn't allow uploads, however, since you problem involved 2D Input and the palettes.

Perhaps you could just submit it with the URL of this thread.

First 226 227 228 229 230 231 232 Last Page 228 of 592