Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@nm 

There is nothing wrong with having text or any other data structure in a matrix. Indeed, certain commands in Maple require an Array, Matrix, or Vector of plots. I understand your point about "lists of lists," but note that a Maple Matrix is different from a Maple list of lists.

There is nothing wrong with having keys in a set.

@mzaman 

There are two issues now. The first is that you need with(LinearAlgebra) at the top of your program so that RowDimension and ColumnDimension are meaningful. The second is incorrect parentheses in the second statement in your loop. You currently have

newaa[i,j]:= (add(add(subimage(m,n), m= 1..(2*k+1), n= 1..(2*k+1))));

You should change that to

newaa[i,j]:= add(add(subimage[m,n], m= 1..2*k+1), n= 1..2*k+1);

I recommend (and I think that Acer does also) that you change all subscripted array references to use square brackets instead of parentheses. You've just changed the reference on the left side of :=.

Once you have this program perfected, note that it can be made much, much faster by using evalhf for the loop. But let's work on that after you have it perfected.

 

My guess that using the timelimit wouldn't be worthwhile was correct. But I include the technique here to show how to use the command. In the worksheet below, I call it with the minimal amount of time, .01 seconds. I tried it at 5 seconds, but the program ran for 40 minutes without completing any factorizations.

I also improved the code for selecting the kp2 closest to 56 bits. In the run below, you can see that p is 511 bits and q is 512 bits.


# Wu/Sun Schema A RSA key-generation algorithm

#Step 1:

e:= 1+2*rand(2^566..2^567-1)();

616906047496055035149439341834264057660378620796655787803463902693475012634003755960320577298644035724199637408761666313496192025290722877328780014316174890067168500657609

R160:= rand(2^159..2^160-1):

WuSun:= proc(e::posint)
local kp1, x, P, p, dp, kp2, d;
     do
          #Step 2,5:
          kp1:= R160();
          while igcd(kp1,e) <> 1 do kp1:= R160() end do;

          #Step 3,6:
          x:= 1/e mod kp1;
          P:= (e*x-1)/kp1 + e;
          # We need P even.
          if irem(P,2) <> 0 then next end if;
          dp:= x+kp1;

          #Step 4,7:

          #In the case of partial factorization, extract the integer part.
          #If the factorization is complete, kp2 is just P.
          kp2:= lcoeff(expand(ifactor(P/2, easy)));
          if ilog2(kp2) > 56 then
               d:= numtheory:-divisors(kp2)
          else
               try  d:= timelimit(.01, numtheory:-divisors(P/2))
               catch "time expired":  next
               end try
          end if;
          
          #Find a divisor of kp2 that exceeds 55 bits but is as
          #close to 56 as we can get.
          kp2:= select(x-> ilog2(x) > 56, d)[1];
          if ilog2(kp2) > 100 then next end if;
          p:= P/kp2+1;
          if isprime(p) then return (P,p,dp) end if               
     end do
end proc:  

(P,p,dp):= WuSun(e);

879239812628163159983757312860965961118875309041231589628969375306307959965733015588185341506125893720156423920152250395463116590970865880981502973728616740385639923002588, 6095437916843643553470239005470154499257599062533480778699609837502578606913684661527033370889412955067682354039420516215170880347520666679372448242223373, 1555245142549442662414422115907789204120106526561

ilog2(p);

510

(Q,q,dq):= WuSun(e);

1233226060762304705518463423465654468200420102752734627070749380004697731571219107381515248030426082164439567743207429154900573245518788354416488221289317224255670984425120, 8430245160676125871174692900652962975129002000463080845183044982032623127324969247986225385386648477681126186612054194602412348901579797832429713369665949, 1592336112960585900199990408509632394687079215449

ilog2(q);

511

 


Download WuSun.mw

@gdoug 

What version of Maple are you using? The above works for me, even with a single vector, in Maple 16 through 2015.

Also, did you cut and paste the code exactly as I had it? Or did you retype it? If you retyped it, please post the retyped version here.

@Yiannis Galidakis 

Those are wonderful animations. Could you post the Maple code to generate them?

And your Reply above would make an excellent Post. Please consider Posting it.

What makes you think that the precision is currently set at 100 digits? The default is 10. To control the number of digits, set the Digits environment variable. For example,

Digits:= 15:

However, I doubt that reducing the number of digits will do much to speedup your problem, even if your precision is currently 100.

How about posting your code?

@J4James 

What "issue" do you mean? And what is the significance of the plot that you posted? It has three curves. The sum from 10001 to infinity (the part that I truncated) is much too small to make any difference in the plot!

Could you please provide the complete code, such as the definitions of bc_cond, slope_cond, etc.? You can upload a Maple worksheet by using the green uparrow, which is the last item on the second row of the toolbar in the MaplePrimes editor.

By "use procedure programming structure in order to get the same results," do you mean that you want to use something like Newton's method?

@GPY 

It does invoke the function; it just doesn't show you the results. The results of statements nested two or more levels deep are by default not displayed. If you want to see it, then you can wrap the invocation in print(...), as in print(cubesum(cubeprod)).

And, yes, the check iroot(cubeprod,3) = i is redundant.

@nm 

Your screen shot shows that you are using Adode Acrobat 9 Pro, which is a PDF reader and writer, not just a PDF reader, such as Adobe Postscript. And, I don't think that Acrobat is freely available.

@Chia 

Your eval statement contains the following list of variables:

That list should contain only the boolean variables, and there should be nv of them.

@Yiannis Galidakis 

You do have a reputation of 10, which is enough to vote up Answers. Also, it does not require any reputation to select an Answer as the best Answer to one's own Question.

@GPY 

Yes, I noticed that you started a new thread for this question. I am about to Answer your Question in that thread. So please end discussion of it here in this thread.

@GPY 

It's an interesting problem. Yes, I believe that it would work. Note that you'd be finding solutions to x^3+y^3 = n, not x^3+y^3 = n^3. The command analogous to isqrt is iroot. There's some question as to whether it's worth using an alternative to x3:= x^3.

@Yiannis Galidakis 

What you want to do with animations can't be done as a frame-by-frame animation. It's a severe limitation of Maple animation. There will always be one fixed set of axes that applies to every frame of the animation.

However, you can use the viewpoint option of plot3d to "get closer to" or "fly by" or even "fly through" a surface. This essentially creates an animation with a single frame viewed from multiple positions. See ?plot3d,viewpoint.

First 504 505 506 507 508 509 510 Last Page 506 of 709