John May

Dr. John May

2351 Reputation

17 Badges

12 years, 95 days
Maplesoft
Guru
Pasadena, California, United States

Social Networks and Content at Maplesoft.com

Maple Application Center

I am a Senior Developer in the Mathematical Software Group and have been with Maplesoft since 2007. I am also an Adjunct Assistant Professor in the School of Computer Science at the University of Waterloo.

I have a Ph.D in Mathematics from North Carolina State University as well as Masters and Bachelors degrees from the University of Oregon. I have been working on research in computational mathematics since 1997.

My main research interests in are computational linear and polynomial algebra, especially numerical polynomial algebra. I currently work on the exact algebraic solvers as well as other subsystems of Maple.

MaplePrimes Activity


These are replies submitted by John May

@Scot Gould It's the San Gabriel mountains but west of Baldy.  The picture from is the top of the Brown Mountain fire "road" where it turns into the Ken Burton Trail https://www.mtbproject.com/trail/4902656

You couldn't come up with a better answer than Batman, John? smdh

@Jakey  Jake,

I am not sure whether I can disclose the exact details since that code isn't pubic (but, it is pretty easy to figure out by poking at gmp_isprime with some known Miller-Rabin psuedo-primes). I can say that isprime uses Miller-Rabin to get very fast composite number detection.  As you can see in the code, it only trusts a "true" from gmp_isprime result if N < 5*109. For larger numbers, it throws out the Miller-Rabin answer and does a Lucas pseudoprime test which is implemented in pure Maple code.

I executed this in your worksheet and it seems to work fine:
DocumentTools:-SetProperty(Table1, fillcolor[1,1], [255, 99, 1]);

Nice work.

I was going to suggest adding colors to the numbers, but then I downloaded the worksheet and saw that you already had. :)

It's too bad that the cloud version doesn't seem to support that.  Did you try setting the table cell background color as well as the textArea?  That might partially work in the Cloud (and also look a little better in offline Maple).

@vv Thanks.  I will file a bug report for that.

@vv Oh yeah, SolveTools:-SemiAlgebraic might return them as well (they come from RegularChains), in parametric cases where they can't actually be converted to proper indexes.

Some favorite primes I've seen recently.
Prime burger:

111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111088636806853008808556500111111111111111111111111111
111111111111111111111086038885801800800808008800883868880111111111111111111111
111111111111111118888888083580838388888803880888650038838888811111111111111111
111111111111116658508830068803808856080688080351108580888088380311111111111111
111111111118060068005080600380860880808880588808063005886388088680111111111111
111111111808868608068113888886888388001115880066650888808080836808881111111111
111111118080665550683686885006680000500080806060000888858088830508860311111111
111111188068506806800880866060888806538883588836888888808508666868008051111111
111111083888008068838808688688080088008880600036838888111503808008688800111111
111118008580551188368060868508680850868811153308880868088003060600808083811111
111160860838588800888888860088883088888888508058088080868805006080508888011111
111183883850886888388856080886368888008083860063038888088006338638038880811111
111111111111111111111111111111111111111111111111111111111111111111111111111111
111838868000086586088568888880860808088060880000880856508888685630060880886111
111880388088688808688888888630886680683888068888888080088808003860888800600111
111111111111111111111111111111111111111111111111111111111111111111111111111111
111008003888008880088800380888888006811111111111111111111111111110380830581111
118863558668885008000880858806683008550006868061111111111111111188003888300011
188888008860638388888880808068680886588686838886811111111111150860888380880601
188080808808058880888880803658008600888060038586060811111108880880568650603001
100688808080888088888808668888088008060000060683388605888088806008880808088881
180606856838060680800050888068308668080088588886068586568880308308088008038661
110886685588086006888805083888668858008088068888888330808008860838580863605811
111188668060886086888608880066868008838005583858885883080580868886360585881111
111111111111111111111111111111111111111111111111111111111111111111111111111111
111188008030111111111111111806036088880368300808083560008838806080088000881111
111110880386581111111185886838008633888680850888688508003088008380866006611111
111116808888880111108060660863880080808006088880808800508506308853688880811111
111111885886800336630088880066800006838888868858800368608688868338880005111111
111111188588350080380883808680888886368665880308800838888888686008888381111111
111111111165063008066030068063085888600888055608860888506808365008081111111111
111111111111111305808088605086888066838633080508068000836608880111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111

A dangerous vigilante:

111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111111111111181111111181111111111111111111111111111111111
111111111111111111113011111111111186111111081111111111110011111111111111111111
111111111111111183838111111111111108811110601111111111111008861111111111111111
111111111111160066880111111111111108086508861111111111111000588001111111111111
111111111136850500006111111111111188588586501111111111111388038588081111111111
111111118008806568338111111111111808888035680111111111111868806880588611111111
111111033008868080068111111111118808008088385811111111111088080886836580111111
111100050088668608008881111111108888008888883801111111186080808600800888331111
111006503608088866886088888008886868068688308088830860656383860800566600080111
118080883380888080883803588586680800088360663808060038650505000806038888888011
158080800886888688883060663000888886080800808606300855303888808688880588836861
150608080885856880008688806868886068088866685068803880808086888885808888886001
188008538660386666888868886608038850888803688808835888388550658068338806800381
108880866868608008806888888888885885688688056886008008000800888888006888008081
108538586038888880888530888856008858388008388588080838660888088800868588088851
168800885808068686835806688688888883808883866680803800580668880860888080605001
118500805858888308036660880658060886388688886036000808680080860803803068088011
111838880858688611111888068611110088805808008011118886860111110035888888580111
111188800006831111111111061111111108000088831111111188111111111108368580801111
111111838688881111111111111111111118665088011111111111111111111153308808111111
111111110868881111111111111111111111868888111111111111111111111185388811111111
111111111118865111111111111111111111163851111111111111111111111888811111111111
111111111111111011111111111111111111118811111111111111111111118111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111

The Jet Propulsion Laboratory Logo:

111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111188080351108888668860086888005608111100860651111111111111111
111111111111111108558861180886386080688806880058811108808881111111111111111
111111111111111188008801160308080865856000686850581100866081111111111111111
111111111111111180888831108680381111111111188565861133865601111111111111111
111111111111111168688681160538601111111111110606388168008881111111111111111
111111111111111138633051155388051111111111118883338183088681111111111111111
111111111111111186083661188880851111111111106866868188808061111111111111111
111111111111111138888381108868008808008508608835501133588631111111111111111
111111111111111180858681138888801008838005888088881188086801111111111111111
111111111111111185806081180300881108888800886088811180000381111111111111111
111111111111111800088001100803801116308008060011111185668881111111111111111
111188880800336500808581160805881111111111111111111108688085088003688851111
111006883888000886830011108880081111111111111111111110630668608883063688111
116608008080830085888111188636801111111111111111111111868880880880588388811
111111111111111111111111111111111111111111111111111111111111111111111111111

Finally <insert joke about Pi being prime>

111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111885888808008800000088856888803680888858886886088060811
111111111111118860858866058808088880886880880838888808805860380888606080808811
111111111180080080608088088863860030680503068506850585858888806860860858060611
111111111888680806080883886308063633080058860368806380035688008880688656005311
111111108808833000880600080000803330688058805850008803088888808888688088880511
111111888880008886086860566008006835888583838060856888068088800808085336858811
111111868850063111111111188688881111111111111111300035880311111111111111111111
111118306601111111111111180838881111111111111111808088356811111111111111111111
111168568111111111111111136080081111111111111111606080800611111111111111111111
111886311111111111111111188858611111111111111111880880508011111111111111111111
111808111111111111111111100003611111111111111111068380880611111111111111111111
118081111111111111111111808066011111111111111111008808886611111111111111111111
111111111111111111111111508888311111111111111110086808530811111111111111111111
111111111111111111111111838086611111111111111118863803800311111111111111111111
111111111111111111111111383000811111111111111115608068800111111111111111111111
111111111111111111111118058005111111111111111110080888638111111111111111111111
111111111111111111111118585006111111111111111118668068085111111111111111111111
111111111111111111111118800865111111111111111100688038885111111111111111111111
111111111111111111111186068568111111111111111108800538838111111111111111111111
111111111111111111111055638830111111111111111168888886861111111111111111111111
111111111111111111111888565086111111111111111168308800081111111111111111111111
111111111111111111110558560301111111111111111180830800081111111111111111111111
111111111111111111168858888531111111111111111138600086081111111111111111111111
111111111111111111180588088861111111111111111808085868861111111111111111111111
111111111111111111300656350601111111111111111880568088051111111111111111111111
111111111111111110058808880661111111111111111080888883061111111111111111111111
111111111111111688688806608511111111111111111838888088661111111111111111111111
111111111111110888868888088811111111111111111688086800883111111111111111185611
111111111111188886803606008811111111111111111080303880050111111111111111100011
111111111118360306330800086811111111111111111300008668803811111111111111635111
111111111158808808883000806111111111111111111680088380008801111111111180808111
111111111868005688803300806111111111111111111063888686868806600888803006081111
111111118380880885888008801111111111111111111130388058886830858888868085011111
111111110885836508888886881111111111111111111185865680068088868806808008111111
111111110006888858656658611111111111111111111116388088880000066885038081111111
111111111088858068330868111111111111111111111111180888066850580066608811111111
111111111100658808003811111111111111111111111111111083856008088568811111111111
111111111111160886611111111111111111111111111111111111118865088111111111111111
111111111111111111111111111111111111111111111111111111111111111111111111111111

 

It is easier for people to answer if you copy and paste your problem as plain text or upload your document via the green arrow button.

@JohnS Since there is some randomness in the choices of the "black" "pixels" the time it takes to find a prime can vary a lot.  I've found a prime of the Maple logo in less than two minutes, but I've also had it take more than 10 minutes on my three year old, but not especially powerful desktop computer.

@Axel Vogt It's tricky to isolate the image to ASCII image stuff as "code only" since the threshhold value that works best in the conversion to 1-bit color depends a lot on the input image, therefore I wrote it from almost the begining as an interactive application.   But here is some of the code from a very early version:

opic :=  ImageTools:-Read(foo);
m := ImageTools:-Height(opic); n := ImageTools:-Width(opic);

bwpic := ImageTools:-RGBtoGray(opic);

W := 78; # width of ASCII image
pic := ImageTools:-Scale(bwpic, (W-2)/(1.4*n), (W-2.)/n);

# pad with 1-character border - Array(Matrix is a hack, ArrayTools has a better way
spic := Array(Matrix(ImageTools:-PadImage(pic, top = 1, left = 1, border = 1, fill = 0.)));

black := RandomTools:-Generate(choose([3, 5, 6, 8, 8, 8, 8, 9, 0, 0]), makeproc = true);
white := RandomTools:-Generate(choose([1, 1, 1, 1, 1, 2, 4, 7]), makeproc = true);

# the 0.15 value may be far from optimal depending on the source image
pic := ImageTools:-Threshold(spic, 0.15, high = 0., low = 1.)

# this is the array of numerals that makes the picture:
ipic := Matrix(64, 64, datatype = integer,(i, j)-> `if`(pic[j,i] = 0, black(), white()));

# this proc prints the picture
displaymatrix := proc (A) local r, c, i, j; r,
    c := rhs~([rtable_dims(A)])[];
    for j to r do
         for i to c do
            printf("%d", A[i, j]);
         end do;
         printf("\n");
    end do;
end proc;

 

@fereydoon_shekofte Thanks! I've always though of myself as more of a wizard than a sorceror

Yes!  Pineapple and hot peppers!

You can improve the rendering slightly by reordering so that you draw the kite beginning and ending at the origin. 

M:= [[[-.55, 0.95e-1], [-.733, .236], [-.49, .245]],
 [[-.342, .536], [-.355, .859], [-.138, .622]],
 [[.342, .536], [.355, .859], [.138, .622]],
 [[.55, 0.95e-1], [.733, .236], [.49, .245]],
 [[0, 0], [-.216, .216], [-.81, 0], [-.216, -.216], [0, 0]],
 [[0, 0], [0, .376], [-.705, .705], [-.376, 0], [0, 0]],
 [[0, 0], [.376, 0], [.705, .705], [0., .376], [0, 0]],
 [[0, 0], [.216, -.216], [.81, 0], [.216, .216], [0, 0]],
 [[0, 0], [.267, .267], [0, 1], [-.267, .267], [0, 0]]];

I did:

plots:-display(seq(plot(M[i], thickness = 8, color = cat("Niagara ", 10-i)), i = 1 .. numelems(M)),
       plot([[0, -.5], [0, 0]], thickness = 8, color = "Niagara 1"), axes = none, scaling = constrained)

@quo Type double underscores in 2D math: m__a these will show up as subscripts and don't have some of the problems of using m[a] instead.

1 2 3 4 5 6 7 Last Page 1 of 19