Carl Love

Carl Love

28100 Reputation

25 Badges

13 years, 105 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@Preben Alsholm 

A great substitution; I didn't know that IntegrationTools:-Change could make use of assumptions. Vote up. In some versions of Maple (notably Maple 16), an expand may be required before the eval to force the y outside the integral to cancel with the y in the denominator of the integrand.

If Gamma is entered as the exact value 1/5 rather than 0.2, you can use value on the integral and prove that it is exactly 1.

@ecterrab 

If you are using 1D input, there is a preliminary step needed before you can use Edgardo's Answer. Highlight the expression, right click, and Convert To -> 2D Math Input. Then follow Edgardo's instructions.

@hazif firas 

Sorry, I can't solve your problem. I got past the "initial Newton..." error, but then I get a division by zero.

I just want to point out that Runge Kutta Fehlberg 4 5 (rkf45) is a method for IVPs, not BVPs. There is no way to tell Maple to solve a BVP with rkf45.

I haven't looked at your worksheet yet (I will). But I want to point out that undefined and Float(undefined) are not errors; they are mathematically valid answers. For example limit(1/x, x= 0) is undefined.

@sercan 

Can you supply ranges for the constants and variables? For example, are any of them guaranteed to be positive? Are there also relations such as w > c that hold? Maple can often prove an inequality when given some assumptions on the variables.

By "better", I assume that you mean ProfitB >= ProfitC for all values of the variables and and constants. Is that right? Then there's really no distinction between variables and constants.

[I edited your Question due to excessive whitespace.]

I doubt that there's any simplification for that. Just looking at n=2, I see no simplification. Are you sure that you want a summation rather than a product? If you change Sigma to PI (Maple command product) then there's a simplification.

Is the issue that you want to prove that the functions are identical?

How about posting your Maple code with the functions?

@Kitonum 

Change 3 to length(j).

@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!

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