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

@mmcdara Do you really need the symbolic integration?

The following numeric integration is pretty quick, 0.5sec to compute plot `p` on my machine, and about 7sec if I don't force the quadrature method.

restart: kernelopts(version);

`Maple 2015.2, X86 64 LINUX, Dec 20 2015, Build ID 1097895`

with(plots): with(Statistics):

U__1 := RandomVariable('Beta'(1, 1)): U__2 := RandomVariable('Beta'(5, 5)):
V__1 := U__1 * 2 + 1: V__2 := U__2 / StandardDeviation(U__2) / 3 + 3:

s__1 := Sample(V__1, 10^6): s__2 := Sample(V__2, 10^6): s := s__1 *~ s__2:
h    := FrequencyPlot(s, minbins=1000, color=blue,
                      transparency=0.4, title=typeset(pdf(''V__1''*''V__2''))):

support__1 := Support(V__1, 'output=range'):
f__1 := unapply(PDF(V__1, t), t): f__2 := unapply(PDF(V__2, t), t):

f__W := z -> Int(f__1(t)*f__2(z/t)*(1/abs(t)), t=support__1, method=_d01ajc):

p := CodeTools:-Usage( plot(f__W(z), z=0..15, color=red) ):
display(p, h, size=[1000, 400])

memory used=48.29MiB, alloc change=-3.60MiB, cpu time=547.00ms, real time=515.00ms, gc time=74.48ms

Download DoesThisWork_ac.mw

[edit] Actually, it can be produced even quicker, about 0.11sec on my machine using Maple 2015.2. (I omit the final plot below, which looks the same.)

restart: kernelopts(version);

`Maple 2015.2, X86 64 LINUX, Dec 20 2015, Build ID 1097895`

with(plots): with(Statistics):

U__1 := RandomVariable('Beta'(1, 1)): U__2 := RandomVariable('Beta'(5, 5)):
V__1 := U__1 * 2 + 1: V__2 := U__2 / StandardDeviation(U__2) / 3 + 3:

s__1 := Sample(V__1, 10^6): s__2 := Sample(V__2, 10^6): s := s__1 *~ s__2:
h    := FrequencyPlot(s, minbins=1000, color=blue,
                      transparency=0.4, title=typeset(pdf(''V__1''*''V__2''))):

support__1 := Support(V__1, 'output=range'):
f__1 := unapply(PDF(V__1, t), t, numeric): f__2 := unapply(PDF(V__2, t), t, numeric):

f__W := Z -> Int(subs(z=Z,t->f__1(t)*f__2(z/t)*(1/abs(t))), support__1, method=_d01ajc):

p := CodeTools:-Usage( plot(f__W, 0..15, color=red) ):

memory used=4.92MiB, alloc change=36.00KiB, cpu time=107.00ms, real time=108.00ms, gc time=0ns

display(p, h, size=[1000, 400]);

Download DoesThisWork_acc.mw

@Ronan 

For the kernel&GUI to pick up the location automatically it should be like:

   toolbox/foobar/lib/blah.mla

It looks like the following is automatically found ok, and indeed it is of that form:

toolbox/personal/lib/RationalTrigonometry.mla

But the following is not of that form, and indeed you showed it not getting found automatically after restart:

toolbox/personal/AlgCalc/AlgCalc.mla

So you ought to be able to adjust the folder name accordingly.

By "automatically" I mean that the location is automatically added to `libname`, upon launch/restart.

@tomleslie I get the following in Maple 2022.2, which corresponds to the what the OP described.

I don't have any additional Physics package update installed.

restart;

kernelopts(version);

`Maple 2022.2, X86 64 LINUX, Oct 23 2022, Build ID 1657361`

`Y__a,b`;

`Y__a,b`

`Y__a,b` := 1

1

Download dunder.mw

I I re-execute your backT2.mw file in my Maple 2022.2 then the output changes and the backtick problem appears.

My understanding is that Edgardo had corrected this issue previously (ie. prior to today) in a Physics package update. So if you have such installed you might already have a fix.

@tomleslie The OP is objecting to the presence of the backticks in the pretty-printed output of `X__a,b`.

The OP clearly has not mentioned any problem with entering these names as input.

Your worksheet was last saved in Maple 2022.1, in which version the output rendering problem being discussed does not occur.

The OP's problem occurs in Maple 2022.2 (with default settings, eg. typesetting=extended).

@Ronan If you did not create the AlgCalc.mla archive file then a call to savelib can inadvertantly store your modules/procedures in an unintended (other) .mla file in the libname path that just happens to be user-writable.

You may have inadvertantly stored your modules/procedures in some other .mla files from add-on packages that you installed -- that might have been the first writable and extant .mla files found during the savelib attempt.

That's why in my original Answer above I put a link to the LibraryTools package's Save command. You can first use that package's Create command (once) to create a .mla archive file, and then use its Save command to store modules/procedures in it.

I happen to know how to use march and savelib, but there are pitfalls (and the documentation of savelib is very poor), and I don't recommend that anyone who's not an expert use them. Such difficulties are part reason why LibraryTools was made.

But ignore all mention or use of savelibname, which was a sorry attempt at making savelib problems less common.

ps. If there is actually no writable .mla archive present then savelib can litter a directory in the libname path with .m files.

This appears to be a regression in behaviour, newly introduced between Maple 2022.1 and Maple2022.2.

I am going to submit a bug report.

It is possible to workaround the issue by changing from extended to standard typesetting mode (when output is pretty-printed).

   interface(typesetting=standard):

I worry that may not be wholly satisfactory, since typesetting=extended is the default in recent releases, and you may find other things not to your liking if you change that setting.

@Christopher2222 I don't understand what "paper" has to do with it. My answer was about mathematical correctness. Maple's 2D math pretty-printing is not what we're discussing.

If I wrote sqrt(c/m) or sqrt(c)/sqrt(m) after having computed a result of sqrt(m*c)/m then that would be incorrect and wrong unless there were something special about the variables which justified the replacement.

There are values of m & c for which  expression sqrt(c)/sqrt(m) is not mathematically equivalent to sqrt(m*c)/m. There are real values where they're not equal. Worse still, there is a set of nonzero measure in RxR where they're not equal.

Plot the real and imaginary components of those expressions, and see for yourself.

@C_R Your question has built into its very words the idea that sqrt(c/m) is a simplification of sqrt(m*c)/m.

Even when the equivalence is true (ie, under some conditions) it is not obvious that the sqrt(c/m) is necessarily mathematically simpler than sqrt(m*c)/m. Yes, it may consist of less operations or leaves of computation. But there can be more to simplicity than mere brevity. Sometimes it can matter more which forms are more useful in terms of subsequent manipulation, and that in turn can even depend on the characteristics of the Computer Algebra System in question.

[edit] Sometimes assumptions might be part of some context, eg. `m` representing mass. In such situations it's not unnatural for the onus to be on the user to somehow convey that. Would you call that too as, "trial and error"?

By the way, next Wednesday & Thursday, Nov 2-3, is the Maple Conference 2022, hosted by Maplesoft.

The conference program shows a talk on the Thursday titled, "Maple Programming: An Overview on Creating Packages", Paul DeMarco, Senior Director, Maple Development.

@Ronan Put the code with the $include directives in a plaintext .mpl file. Then use the read command on that single file.

ps. It seems weirdly and unnecessarily roundabout to write the procedure such as your SignedArea in a Maple worksheet, then use commands in the worksheet that store/export it as a .mpl file. I'd rather write my source in plaintext files to begin with, so that I could use decent revision control, a code editor of my choice, etc. I could read them into any session as I wanted, while prototyping functionality. Once satisfied I could write a module (again: itself authored in a plaintext file, with $include directives for its member procedures) and either read that in or store it all in a .mla archive. It seems to me that you are having difficulty in letting go of the habit of having your long-term build methodology use the GUI for lower level steps.

The proposed idea is to have a long-term build methodology that is purely textfile based. In the end it could all be loaded (and optionally stored to .mla) by calling read on one master build .mpl plaintext file. That single read call could be made in the GUI, or from a shell (running command line interface of Maple, interactively or as a batch/script execution which I suspect is what Joe meant elsewhere as you cited).

Sorry, I don't have time just now to write in more detail, or to reconfigure your whole example.

@tomleslie I really like the way your procedure F accepts just a single parameter (which will become the animating parameter when F gets used in the animate call.) I vote up.

I think that's an important improvement because it makes the later animate call much simpler. Thus the programming difficulties (for those less proficient than you) are split more usefully. Producing any single frame is one programming subtask. And the animating subtask (which can challenge beginners, say) is now more straightforward.

@romanrieme

Perhaps you could have each frame contain a plotted circle (with some coloring or pattern), or a polygonal shape. Then you could have construction of that frame rotate that accordingly.

I suggest creating a procedure that will accept the two position values along with a rotation value, and construct the plot of a desired shape with its rotation visually apparent. In other words, that procedure would accept some three values and return a plot, which could be a frame of your animation. Then you could call animate on that procedure.

Did you somehow expect the pointplot command to know that the data you're passing it come from a system of differential equations in which the computed functions happen to represent a rotating ball? Otherwise I don't see how having a third component in the list for the pointplot command would be a natural way to specify the quite esoteric property of some rotation of the symbol.

@brian bovril Ok, so now we have the key detail that you want to copy&paste directly from the Maple interface. Before I suggested ExportMatrix in case you wanted to export to a file.

So here's a way, using printf, to produce plaintext output in the Maple interface that can be directly copy&pasted.

I had alluded to that in my Answer, but now that I know that's the effect that you're after I'll give it explicitly.

restart:
with(combinat):with(StringTools,DeleteSpace):
abil:=[1407,1408,1409,1411]:
DBL:=choose(abil,2):
score:=[2,0]:
ans:=seq([DBL[j][],score[1],DBL[numelems(DBL)-j+1][],score[2]],
         j=1..numelems(DBL)/2),
     seq([DBL[numelems(DBL)-j+1][],score[1],DBL[j][],score[2]],
         j=1..numelems(DBL)/2):

seq(printf("%s\n",
           DeleteSpace(sprintf("%a",
                               ans[i]))[2..-2]),
    i=1..nops([ans]));

1407,1408,2,1409,1411,0
1407,1409,2,1408,1411,0
1407,1411,2,1408,1409,0
1409,1411,2,1407,1408,0
1408,1411,2,1407,1409,0
1408,1409,2,1407,1411,0

There are other printf incantations which could get the same kind of result.

Which version of Maple?

Which version of Linux? Which JRE?

You might try changing the JRE.

I changed your Post into a Question.

Please try to be careful about submitting your queries as Question threads.

First 93 94 95 96 97 98 99 Last Page 95 of 591