acer

32303 Reputation

29 Badges

19 years, 304 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@Scot Gould There is no super-convenient way to set a new/different default for an arbitrary Maple command's options, while also retaining ability to call it by its original name.

But, you could wrap it, eg. (possibly for an init file),

unprotect(Explore);
__kopts := kernelopts(':-opaquemodules' = false);
__Explore := eval(Explore:-ModuleApply);
Explore:-ModuleApply := (ee::uneval) -> __Explore(ee, 'adaptview' = false, _passed[2 .. ()]);
protect(Explore);
kernelopts(':-opaquemodules' = __kopts);

The above is slightly more complicated that a usual "wrap", because Explore is an appliable module and also Explore:-ModuleApply's first parameter has special evaluation rules.

Personally, I wouldn't disable functionality by default just to avoid an (apparently) rare issue. I'd just change my usage on the rare occsasion that needed it, and submit a report.

You could remove options remember and system from targeted procedures. That would disable the usual remembering of regular function calls to that procedure.

And for each procedure you'd only have to do it once per session, up front. That up-front act could then cover all your subsequent simplify calls.

For example,

strip_memo.mw

To be most effective you'd want to do this also to the procs internal to simplify. So you could map the act over a list of the relevant proc names. (There isn't a convenient automatic way that'd be analogous to forget's subfunctions option.) There are more `simplify/`... classical-extension procs, btw, including,
`simplify/recurse`
`simplify/normal`
`simplify/normal/check`
`simplify/normal/test`
`simplify/factor`
`simplify/do`

Anyway, the point of this is that you can disable remembering by simplify and its internals (if accomplished via usual procedure calls), which was your followup question. But I still think that my original suggestions to either wrap :-simplify or use a module export (so as to be able to forget, each time, without wide code changes by you) are safer in general.

ps. You've made the claim before that your above-described kind of crash is due to memoization. It might be. But it might be due to something else.

@Carl Love My first suggestion was to write (as you have just done) an export, and then make it part of his existing module(s), so that his other module members could pick it up. I don't know for a fact that all his code is in modules, but there have been indications that at least parts of it are so organized.

I can't recall all my tests, but at one point (using forget on :-simplify as you've done in your first implementation) I saw the forget action actually re-instating(!) the original to name :-simplify. Like a reread from archive. I was surprised. That's why I wrote a more complicated variant that took the extra step of replacing itself(!) from template after calling forget. Now I don't have the problematic example, sigh.

@dharr Is there a nice insightful way to show that the inner sum (m<>n) equals 3/(4*n^2), without that exact same splitting approach?

P1 := sum(1/(m^2-n^2), m=1..n-1);

-(1/2)*gamma/n-(1/2)*Psi(2*n)/n-(1/2)*Psi(n)/n+(1/2)*Psi(n+1)/n

P2 := sum(1/(m^2-n^2), m=n+1..infinity) assuming n::posint;

(1/2)*gamma/n+(1/2)*Psi(2*n+1)/n

expand(P1 + P2);

(3/4)/n^2

Download inner_s.mw

@nm Now (in followup, but also the original Quesion contents have been edited) you have asked for a way to disable use of remember tables. That sounds like a bad idea in general:
1) It'd degrade efficiency.
2) Doing so (were it possible) might even break functionality. There are other ways in which remember tables can be used to control programmatic flow; it's not always just about efficiency. A procedure might even use a technique of deliberately writing to a remember table as as way of preventing further attempts (if something does wrong, etc). I don't know whether that is ever done "under" simplify. Risking it seems like a bad idea in general.

nb. The "permanent" in the option forgetpermanent option of forget is about a flavour or Cache entry. It's not related to permanance in a disabling sense.

Any facility to disable remember table use shouldn't sensibly be an option to forget. That'd poorly conflate purposes.

I understand that you have a great deal of code which makes simplify calls, and so are looking for a tidy do-once-up-front approach.

My first suggestion would be to make a package export named simplify, so that fellow code in a package could pick that up binding. If your code is organized nice "enough" in modules then that could allow you to restrict your code edits almost entirely to a new export. The export could just be a wrapper which clears the remember tables under global :-simplify, and then calls it. You could even make the forget action happen acording to whether some environment variable were set -- in case all this is only a debugging technique for you.

Slightly dodgier is to clobber global name :-simplify with such a wrapping procedure (which calls the original).

Btw, I'm not sure whether your use of printlevel was just for exposition in your question, or actually an essential part of your intended process.

For example, clearing only under `simplify/do` (which might be all that's needed):

how_to_clear_simplify_cache_V2_march_24_2025_ac1.mw

A more complicated variant on that, which forgets under :-simplify itself (and guards against re-reads, and maintains your printlevel stuff without showing verbose forget details):

how_to_clear_simplify_cache_V2_march_24_2025_ac2.mw

[edit] My two worksheets take the unprotect/clobber/protect route, which I see that Carl has also now utilized gracefully.

@WD0HHU 

mmcdara's Answer's worksheet explained it in a comment, "...for versions >= 2018 use InsertContent(Worksheet( T ))".

A_few_ideas_ac.mw

@nm One of the items on that list is Sublime Text (which runs on OS X).

Maplesoft Math Group developer John May wrote an old post about syntax highlighting for Sublime Text. Perhaps mmcdara might find it usefu.

@eithne 

It's not possible to delete Maple "Art" Posts/Replies as spam. (The red icon's there, but doesn't function. The spammers have now realized this.

It would be nice if someone could revert the top-down ordering of Answers that took effect some months ago. It worked properly (newest at bottom) for twenty years.

It would be a really big improvement if someone could fix the back-end to use .png instead of .jpg for plot inlining of attached worksheets. (png would be best. jpg is about the worst choice, of several, and looks very grainy)

The backend misunderstands what it means if a plot structure lack the gridlines spec. So it incorrectly adds gridlines to every 2D plot that it inlines here (unless specifically told not to, which is the opposite of how the Maple GUI works since about 15 years ago).

@C_R In an Execution Group, you can press Ctrl-t to toggle into Text mode.

I do the combo, F3, then Ctrl-t, quite often.

@Christopher2222 It doesn't work if T__4 has been parsed as a subscript in 2D Input (regardless of whether its in an Execution Group or Document Block).

Worksheet or Document mode is also not the essential criterion. Being a parsed 2D Input subscript is what makes the difference.

It is possible to enter a literal T__4 in 2D Input mode. By literal I mean that it's not parsed/shown as a subscripted name, but rather as a double-underscore. In that case "Find/Replace" works.

Find/Replace on parsed 2D Input is very weak. I work around that by using 1D Input.

If I had a huge document from someone else, with very large input statements to search, then I might export all its input (either Export as Text, or WorksheetToMapleText) and work with that instead. At least I could be sure I didn't miss stuff, even if the GUI didn't give me the ease of automated cursor moves.

@studentX369 A significant change to set ordering came with Maple 12 (released, 2008).

Before that such sets (of lists) were ordered by the addresses in memory of their elements. That sometimes led to a few surprises.

I don't recommend it as generally useful, but you can still force the old set ordering scheme by launching modern Maple with the
   -setsort=0
option. If you do then the following code illustrates the additional risk of so-called session dependent results (due to address ordering). After each restart, and with kernelopts(setsort) thus being zero, the set is uniquified (and later, automatically simplified) to the same order in which the elements first get addresses in memory.

restart;
{ [3, 6], [-1, 6], [-1, 1], [-1, -2], [3, -2] };
plot( { [3, 6], [-1, 6], [-1, 1], [-1, -2], [3, -2] }, x=-3..4, y=-4..10, style=line);
restart;
# create them fresh, in this order (which happens
# to make their addresses be ordered of a particular way).
[-1, -2], [-1, 1], [-1, 6], [3, -2], [3, 6]:
{ [3, 6], [-1, 6], [-1, 1], [-1, -2], [3, -2] };
plot( { [3, 6], [-1, 6], [-1, 1], [-1, -2], [3, -2] }, x=-3..4, y=-4..10, style=line);

That older behaviour of sorting a collection of numeric lists (here, your points/elements) was more confusing. The dependence upon addresses appeared almost non-deterministic.

See also the setsort items on the Help Pages,
      ?maple
      ?kernelopts
and,
      ?updates,Maple12,symbolic

@WD0HHU I am not sure why the embedded zoomed/scaled plot loses its dimensions, sorry. (It seems related to being in an embedded Task Region, but didn't happen for at least one shorted example I'd tried).

You can manually zoom-in on the PZ plot, displayed in the usual manner rather than with InsertContent ,etc, as an alternative way to reduce the plot-title gap. It's a little extra manual effort, but it seems to do better on Close/Reopen:  AGAM_ac.zip

@studentX369 You can first do a shortcut to get a fresh/empty prompt.

@WD0HHU Could you attach an example?

@MichaelVio You're not using all the amended files from my earlier Reply. They have edits by me that allow their problematic plots to attain better.

First 9 10 11 12 13 14 15 Last Page 11 of 591