acer

32363 Reputation

29 Badges

19 years, 332 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

How far have you gotten with this so far, on your own?

What Maple procedures have you found in the help system, that deal with checking primality or generating primes?

Do you think that it would be easier to check whether the number which is two greater than a given prime is also prime (repeating that test for every given prime in your range), or to check which consecutive pairs of entries in the set of ordered primes in your range happen to be two apart?

Work out the basics of how you want your code to work, first (even if only in words to yourself or "pseudocode"), and then try writing it in Maple.

acer

I've been working on some blog post(s) on this topic, including some code, in a few spare moments. I intend it as a branched continuation of this interesting thread.

Pls stay tuned. I'll add a link here when I post.

The code consists of improving on the naive approach of doubling-Digits-until-it-stops-changing by using shake instead at each increase to the working precision (Digits). I started off focusing on constant expressions, but then got a little side-tracked with 2-argument `eval`.

Since I'm using `shake` then my approach relies on the existence of an appropriate `evalr` extension in order handle function calls. So it doesn't do anything for hypergeom, for counterexample.

To the original poster: Note that some numerical commands in Maple provide optional arguments to specify an error tolerance. Eg, dsolve/numeric or evalf/Int.

acer

I've been working on some blog post(s) on this topic, including some code, in a few spare moments. I intend it as a branched continuation of this interesting thread.

Pls stay tuned. I'll add a link here when I post.

The code consists of improving on the naive approach of doubling-Digits-until-it-stops-changing by using shake instead at each increase to the working precision (Digits). I started off focusing on constant expressions, but then got a little side-tracked with 2-argument `eval`.

Since I'm using `shake` then my approach relies on the existence of an appropriate `evalr` extension in order handle function calls. So it doesn't do anything for hypergeom, for counterexample.

To the original poster: Note that some numerical commands in Maple provide optional arguments to specify an error tolerance. Eg, dsolve/numeric or evalf/Int.

acer

@Axel Vogt Hey Axel.

It needs the Standard GUI of Maple 14 or later, since accessing Maple Cloud worksheets can only be done at present via a special "cloud" entry in the palette panel.

So yes, one can upload a .mws worksheet, once one has opened that in the Standard GUI. But when someone else downloads it then it doesn't seem to be either .mw or .mws until such time as it gets saved to a file.

cheers,
acer

Not as terse as may be done in APL, but still,

Vector(5,exp);

exp~(<($1..5)>);

exp~([$1..5]);

More seriously, could it be that the Original Poster's issue is related to exp(1), exp(2), etc being exact quantities rather than float approximations? If so, then just apply the command evalf to most of the earlier responses.

acer

Not as terse as may be done in APL, but still,

Vector(5,exp);

exp~(<($1..5)>);

exp~([$1..5]);

More seriously, could it be that the Original Poster's issue is related to exp(1), exp(2), etc being exact quantities rather than float approximations? If so, then just apply the command evalf to most of the earlier responses.

acer

You have not told us what platform or operating system you are using.

Can you use keyboard short-cuts instead? (Ie. on Windows, Ctl-v instead of right-click->Paste)

acer

restart:

Mnemosyne:=proc(x::posint)

  option remember;
  local Xc;

  if x=1 then return x,0; end if;

  if x=2 then Xc := 1,0;

  elif irem(x,2)=0 then Xc := procname(x/2);

  else Xc := procname(3*x+1);

  end if;
  x, Xc[2]+1;

end proc:

st:=time():

plots:-pointplot([seq(Mnemosyne(i),i=1..10000)]);

time()-st;

acer

restart:

Mnemosyne:=proc(x::posint)

  option remember;
  local Xc;

  if x=1 then return x,0; end if;

  if x=2 then Xc := 1,0;

  elif irem(x,2)=0 then Xc := procname(x/2);

  else Xc := procname(3*x+1);

  end if;
  x, Xc[2]+1;

end proc:

st:=time():

plots:-pointplot([seq(Mnemosyne(i),i=1..10000)]);

time()-st;

acer

How about applying it to a quasirandom sequence generated by Rule 30.

(nb. Rule 30 must be somebody's obsession, by rules 34 and 36.)

acer

FWIW, this is integer sequence A006577 from OEIS.

Wikipedia also has information on the Collatz Conjecture.

acer

FWIW, this is integer sequence A006577 from OEIS.

Wikipedia also has information on the Collatz Conjecture.

acer

A followup comment.

You can now find the Harmonic Analysis package on the Application Center.

The (slightly thin) documentation suggests a command for removing high frequency noise from a signal. Here's what I get when I apply that same call to the data M above.

MHA := HarmonicAnalysis:-AFT(M, 0.97, 0):
plots:-pointplot([seq([i, Re(MHA[i])],i=1..n)], style=line,view=[0..1000,-20..20]);

 

You can compare the above result with the very last plot in my Answer (which to my eye looked much like the completely straight line I expected for the main signal will all noise removed).

acer

A followup comment.

You can now find the Harmonic Analysis package on the Application Center.

The (slightly thin) documentation suggests a command for removing high frequency noise from a signal. Here's what I get when I apply that same call to the data M above.

MHA := HarmonicAnalysis:-AFT(M, 0.97, 0):
plots:-pointplot([seq([i, Re(MHA[i])],i=1..n)], style=line,view=[0..1000,-20..20]);

 

You can compare the above result with the very last plot in my Answer (which to my eye looked much like the completely straight line I expected for the main signal will all noise removed).

acer

@gkokovidis Those two data files are have links on the page from which this Post was branched.

Namely, MontrealWL.txt and TorontoWL.txt on this page.

First 449 450 451 452 453 454 455 Last Page 451 of 592