Carl Love

Carl Love

28035 Reputation

25 Badges

12 years, 321 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@mehdi jafari 

Are you using matrix (lowercase m)? That's deprecated, and there's no good reason to ever use it. Use Matrix instead.

What's wrong with simply sin(erf(t))? Do you expect there to be some other simple analytic form?

@JD423 

Regarding version dependency of the restart issue: This is just my guess, but I think that it has more to do with operating-system issues than with the version of Maple. I think that it has something to do with synchronization between the "kernel" and the GUI, which run as separate (and rather independent) processes in all versions of Maple. 

The need to put restart in its own execution group is documented on its help page. It's not a "bug" in the strict sense of that word. People who have a whole vocabulary for making fine distinctions among software behaviors might call it a "wart".

Regarding loading packages with with: You may have gotten the wrong impression that I disdain the use of packages. That's not at all true. What I disdain is the loading of packages with with. Instead of that, I just put the package name together with the procedure name at the point where the procedure is used. In other words, instead of Distance I'd use Student:-Precalculus:-Distance. If the prefixes are annoyingly long, I do something like

StP:= Student:-Precalculus;
...
... StP:-Distance(......

In either case, when reading the code, it's clear that Distance comes from a module or package.

I think that it's worth pointing out that what you call b is formally called the skewness of x. This information may or may not be of help to you or to someone else who tries to answer your Question.

There seem to numerous bugs reported here related to the newer extended typesetting, which is now the default. Try doing this before running the above commands:

interface(typesetting= standard);

And what do you mean by ""sigma? That's not valid syntax. Usually I can figure out a user's intention despite their invalid syntax, but that one has me completely baffled.

This is essentially a duplicate of your previous Question. You've only changed the equations slightly. You seem to have completely ignored all the advice that both Tom Leslie and I gave you.

@cencen_cj wrote:

  • I have no clue what went wrong. Please kindly give me a hint.

But Tom did give you a substantial hint! I am certain that your usage of square brackets in the way that he pointed out is wrong. I am not certain that it is the cause of your error, but, nonetheless, it is wrong and must be corrected before you can proceed.

It's offensive to check all the boxes Maple, MapleNet, MapleSim, etc. Your Question is about Maple alone. Better yet, you should select your Maple version.

Please upload (at the very least) the code, the call that produces the error, and the exact error message. You can either upload a worksheet as an attached file, or just upload plaintext. It doesn't matter if it's in some other language; we can still figure it out.

@tarik_mohamadi 

Is the case R=0 meaningful to you? It certainly wouldn't be meaningful to me. This case is trivial and degenerate, and it needs special handling if you want to include it. Otherwise, just remove this case from the loop.

@tarik_mohamadi I need to see your complete code to provide further help. At the least, I need to see the value of eqns.

Generally, if it's possible to do something with Threads, then doing so is significantly faster and uses significantly less memory than using Grid. So, if some easy modification can make the code threadsafe, it may be worth pursuing that.

It's possible for code to be threadsafe even though it uses procedures not listed at ?index,threadsafe. That page lists procedures that are guaranteed to be threadsafe. The issue is whether the parallelized part of the code can make contradictory assignments to variables at a higher lexical level (including enviroment variables such as Digits). A common case is code running under evalhf. I believe that such is always threadsafe (and, if not, it certainly is threadsafe in the vast majority of cases). So, if that evalhf code uses sin, for example, it's still threadsafe even though sin, in general, is not.

@Joe Riel According to the relevant help page, combinat:-rankperm and combinat:-unrankperm were introduced in Maple 16; so, too late for this OP. And, I'm content with the code that I've written, but if you see the possibility of improvement, please let me know. I'm aware that with Maple 2019 syntax, the line

C[i..]:= C[i..] + rtable(i..n, j-> `if`(C[j] < c, 0, 1))

can be improved to 

C[i..]+= rtable(i..n, j-> `if`(C[j] < c, 0, 1))

@testht06 

My composition operator is the procedure &x that I already gave above:

[3,5,7,0,2,1,4,6] &x [2,4,0,5,3,1,6,7];
      
[5, 1, 7, 2, 0, 4, 3, 6]

Maple's sophisticated list indexing makes the code of this procedure so short that you may have missed it above:

`&x`:= (P,Q)-> Q[P+~1]:

@testht06 

Okay, your composition of permutations is what I called "compose right first", and that's how I left it in the following.

Once the sequence's orbit has been found, it's redundant to continue generating it. So, I've replaced MySeq (procedure above) with FindOrbit, which stops as soon as the orbit is found. Using c=4, x0=5, n=8 the orbit length is 177 (and is returned in about 1/20 of a second on my computer).

FindOrbit:= proc(c::realcons, x0::nonnegint, n::And(posint, satisfies(n-> x0 < Fact(n))))
local
   N:= Fact(n)-1, C:= (c+1)/(N+2), P:= Pi/2, l:= Lehmer, L:= LehmerInv, S, O, i, j, x,
   It:= x-> l(L(x,n) &x L(floor(N*sin(P*(x/N+C))), n))
;
   (x, S[0], O[x0]):= (x0, x0, 0);
   for i do
      x:= It(x);
      if O[x]::nonnegint then return i-O[x], [seq(S[j], j=  0..i-1)] fi;
      (S[i], O[x]):= (x, i)
   od         
end proc
:
`&x`:= (P,Q)-> Q[P+~1]: #Compose right first.
:
(Len, Seq):= CodeTools:-Usage(FindOrbit(4, 5, 8));

Len, Seq := 177, [5, 13, 30, 24, 105, 196, 590, 766, 3782, 8279, 20411, 13524, 
13496, 9576, 39969, 6110, 37175, 1470, 1749, 4636, 9958, 3331, 10039, 1167, 3499,
7082, 7923, 24720, 7913, 22906, 3029, 1751, 4831, 5059, 21591, 9385, 38428, 17012, 
26884, 27454, 34552, 20239, 39443, 996, 1093, 2568, 182, 475, 1243, 4224, 8551, 
29204, 17289, 15468, 12379, 36538, 18721, 37976, 879, 4779, 9236, 30551, 19993,
519, 1305, 4491, 8508, 27959, 14216, 15316, 38489, 6888, 557, 1083, 2817, 1752, 
4865, 6503, 2285, 2132, 4539, 8555, 28483, 17795, 24620, 23479, 23266, 37753, 
26326, 13309, 26102, 13299, 25398, 19246, 4983, 5500, 25942, 39541, 11698, 30111,
15606, 33425, 12072, 10824, 36352, 4119, 6599, 3017, 358, 655, 1094, 2585, 462, 
1014, 1310, 4896, 5760, 32619, 25650, 39754, 7045, 5731, 31460, 11862, 39758, 7041,
5747, 31434, 6641, 285, 698, 1434, 207, 562, 1049, 1381, 455, 1295, 5012, 9173, 
31495, 11530, 9649, 39249, 20510, 8557, 28641, 25632, 9115, 30301, 9526, 37674, 
16403, 19310, 32361, 10856, 36255, 4073, 7755, 16182, 9221, 31378, 6559, 4482,
8480, 27918, 6917, 2232, 427, 16, 28, 6, 23, 32, 42, 8, 7]

The returned values are the orbit length followed by the entire sequence upto (but not including) the first repeated element. It is just a coincidence in this case that the entire sequence is the orbit.

 

First 268 269 270 271 272 273 274 Last Page 270 of 708