acer

32333 Reputation

29 Badges

19 years, 323 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

This straightforward approach seems relatively competitive, performance-wise.

     (u->[f(op(u))])~(L)

It appears to perform better than does [`?()`]~(f,L) for large examples.

I see that the OP mentioned speed, as he had 400k+ sets of data (lists). Code being as terse as possible didn't seem a priority of the OP.

restart;
g := rand(1..10^5):
L := [seq([seq(g(),i=1..10^2)],j=1..10^5)]:
CodeTools:-Usage( [`?()`]~(f,L) ):

memory used=28.97MiB, alloc change=16.00MiB, cpu time=223.00ms, real time=224.00ms, gc time=0ns

restart;
g := rand(1..10^5):
L := [seq([seq(g(),i=1..10^2)],j=1..10^5)]:
CodeTools:-Usage( (u->[f(op(u))])~(L) ):

memory used=23.63MiB, alloc change=16.00MiB, cpu time=153.00ms, real time=153.00ms, gc time=0ns


Download map_ex_perf.mw

@Aixleft math It's a good question, btw.

Historically, and up until Maple 2021, the following would produce the curve data only for x=-10..10 (default for non-trig expression, if no range is explicitly supplied),
     plot(x^2, view=[-20..20,default])
It's only as of Maple 2022 that -- in the absence of a supplied range argument -- the basic plot command utilizes the first part of the supplied view option for determining a range for computing the curve data. The implicitplot command hasn't had the same kind of tweak.

Why do you state that the problem is due to remembered/cached computations? How do you know for sure that is the problem?

There are other (albeit relatively rare) mechanisms that can cause ordering differences and other seemingly random effects. It might well be that some cached results are the cause, but how are you so sure of it?

Please provide an example that explicitly illustrates the proplem, with full code-to-reproduce (either all necessary text code, or a worksheet attached with Mapleprimes' editor's green up-arrow).

It sounds as if you might be using plots:-textplot twice, separately for each of letter and subscript. Is that what you're doing? If so, why do you not use the usual mechanisms which render subscripts in 2D Output? Eg, an indexed name such as x[i] or a double-underscore such as x__i

plots:-display(
  plots:-textplot([1,2,x[i]], font=[Times,20]),
  plots:-textplot([1,1.25,x__i], font=[Times,20]),
  view=1..2.2, size=[200,200]);

@mmcdara The first of your two ways seems to have problems, since Maple 2017.3 (at least).

The second way works, except that I don't (as yet) see how gridlines could be added easily, or a common t-range be used for all parameter choices. If I'm not mistaken, these are some of what the OP asked.

@nm I don't understand why you wouldn't provide the example that reproduces the issue, if you already had it at hand when you originally posted.

I have a recollection of this happening for someone else recently. (Rouben R., perhaps)

IIRC, the cause seemed to be with a worksheet that had Vector/Matrix output, that was saved to .mw in Maple 2024.2.

Resaving in Maple 2023.2 (or, maybe, 2024.0...) removed the problem.

My guess was that it was something to do with new scrollable rtable display; something in the .mw tjat the Mapleprimes backend .mw renderer baulked at.

I didn't confirm exact detail by rigorous experimentation.

The following image is a screenshot from my Maple 2024.2 for Linux (ubuntu).

I have no Maple init file or style sheet in play.

The numerals in the above screenshot image appear exactly as they do in 2D Input in that session.

The Maple GUI's toolbar indicates that the font is DejaVu Serif.

That is the default for modern Maple on Linux, AFAIK.

@nm I use Maple 2024.2 for Linux, with no init file or hidden options.

The plot that you see in my posting is the result of right-click export-to-PNG, which I always do when inlining plots on this forum because the default bahavior of this site's back-end is to show 2D plots with gridlines (if not specified as false, even!) and low-quality jpeg.

@salim-barzani That is offensively inconsiderate to all the member's who have responded.

You could, instead, simply add any new content in a Reply/Comment to a Question.

Deleting the whole Question -- once responded to meaningfully -- is antisocial.

Why did you delete the original of this query, even after janhardo had posted a response with content?

As far as I can tell, you have deleted almost half of your original Questions of the past month or so, even after people have Answered or responded with useful content. Deleting (or editing to remove the content of) a Question, after someone has taken the time to Answer, is incredibly rude.

@Christopher2222 If your case only involves a few integers then why not use the syntax that is more likely to be quickly recognized and understood by you when you look at the code a long time from now.

@dharr fwiw, that could be collapsed to b::identical(10,20,30)

@mmcdara 
1) Starting in Maple 2021 (IIRC) the Warning appears when the local is implicitly declared in the procedure, ie. as of that version, Maple no longer just silently add/declares it. It's more about a reminder to the reader of the code that it's a local, than it is about it being more safe, IMO.

2) As the thickness increases so does the visual/rendered extent of the dashed segments. Once it gets very thick (perhaps relative to the window dimensions, etc), it might no longer appear as dashed.

restart

plots:-setoptions(size=[400,200]);

ecdf := proc(S, {color::string:="blue", thickness::posint:=1})
  local i;
  local N   := numelems(S):
  local M   := sort(S):
  local opt := [':-color'=color, ':-thickness'=thickness]:
  plots:-display(
    plot([ seq(op([[M[i], (i-1)/N], [M[i], i/N], [M[i+1], i/N]]), i=1..N-1) ], opt[])
    , plot([ [M[N], (N-1)/N], [M[N], 1] ], opt[])
    , plot([ [M[N], 1], [(max+(max-min)*0.2)(S), 1] ], opt[], linestyle=3)
    , plot([ [M[1], 0], [(min-(max-min)*0.2)(S), 0] ], opt[], linestyle=3)
  )
end proc:

S := Statistics:-Sample(Uniform(0, 1), 10):

K:=ecdf(S, 'color'="black", 'thickness'=4):

plots:-animate(
  T->subsindets(K,specfunc(THICKNESS),t->THICKNESS(T)),
  [Thickness], Thickness=1.0 .. 4.5);

Download ecdf_acc.mw

@Blanc The command matrix (all lowercase), the linalg package, and the rank command (from linalg) have all been deprecated in Maple for over twenty years. You should not use them.

Instead, you could use Matrix (capital M), the LinearAlgebra package, and its commands such as Rank and NullSpace.

First 12 13 14 15 16 17 18 Last Page 14 of 591