Robert Israel

6582 Reputation

21 Badges

19 years, 51 days
University of British Columbia
Associate Professor Emeritus
North York, Ontario, Canada

MaplePrimes Activity


These are replies submitted by Robert Israel

> Abcds:= [seq([comb[4*n-3],comb[4*n-2],comb[4*n-1],comb[4*n]], 
     n=1..N/4)];
  Error := map(Err1 @ op, Abcds);
  Emin := min[defined](Error);
  member(Emin,Error,'p');
  abcdmin:= Abcds[p];

            abcdmin := [.1, 0, 1, 0]

Isn't it annoying the way VectorCalculus takes over the arithmetic operations, turning simple-looking expressions into monstrosities when copied and pasted?

Isn't it annoying the way VectorCalculus takes over the arithmetic operations, turning simple-looking expressions into monstrosities when copied and pasted?

On a Unix system, good old grep and its variants should work fine for searching for words in .mw files.  You'll want to use the -l option to print only the file name rather than the line containing the word (which would probably be rather long).  There are also, I think, versions of grep available for Windows.

On a Unix system, good old grep and its variants should work fine for searching for words in .mw files.  You'll want to use the -l option to print only the file name rather than the line containing the word (which would probably be rather long).  There are also, I think, versions of grep available for Windows.

You're on the right track. 
 

> M := pdsolve(diff(N(x,t),t)=0.05*diff(N(x,t),x,x),
   {N(x,0)=0, D[1](N)(0,t)=-0.00045/(7.86*0.05), D[1](N)(0.8,t)=0},
     numeric, timestep=0.1, method=CrankNicholson);

This returns a module whose exports are procedures to plot the solutions in 2D and 3D, produce an animation, find the values, and find or change the settings.

> valor := M:-value(t=1,output=listprocedure);

This produces a list 

[ x = proc(x) ... end proc, t = 1., N(x,t) = proc(x) ... end proc ]

where the right-hand-sides are procedures to evaluate the left-hand-sides at t = 1 and any value of x.  The only useful one, of course, is that for N(x,t).

> uval:= rhs(op(3, valor));

So now uval is a procedure that takes a value of x and gives you N(x,1).  Actually I would have preferred something like

>  uval:= subs(valor, N(x,t));

which doesn't depend on knowing that the third item in the list valor is the one for N(x,t).

If you just wanted a function of two variables giving the value N(x,t), you could try

> Nv:= subs(M:-value(output=listprocedure), N(x,t));

and then e.g. to find N(0.3, 1):

> Nv(0.3, 1);

        .629532561743333520e-4

> fsolve(uval(x)=0.05,x=0..0.8);

This is attempting to find x in the interval [0, 0.8] such that N(x,1) = 0.05.  Unfortunately in this case there is no such x, as the maximum value of N(x,1) is approximately 0.00028, so this fsolve command returns unevaluated.  However, you could try

> fsolve(uval(x) = 0.00005, x = 0 .. 0.8);

.3371872944

 

You're on the right track. 
 

> M := pdsolve(diff(N(x,t),t)=0.05*diff(N(x,t),x,x),
   {N(x,0)=0, D[1](N)(0,t)=-0.00045/(7.86*0.05), D[1](N)(0.8,t)=0},
     numeric, timestep=0.1, method=CrankNicholson);

This returns a module whose exports are procedures to plot the solutions in 2D and 3D, produce an animation, find the values, and find or change the settings.

> valor := M:-value(t=1,output=listprocedure);

This produces a list 

[ x = proc(x) ... end proc, t = 1., N(x,t) = proc(x) ... end proc ]

where the right-hand-sides are procedures to evaluate the left-hand-sides at t = 1 and any value of x.  The only useful one, of course, is that for N(x,t).

> uval:= rhs(op(3, valor));

So now uval is a procedure that takes a value of x and gives you N(x,1).  Actually I would have preferred something like

>  uval:= subs(valor, N(x,t));

which doesn't depend on knowing that the third item in the list valor is the one for N(x,t).

If you just wanted a function of two variables giving the value N(x,t), you could try

> Nv:= subs(M:-value(output=listprocedure), N(x,t));

and then e.g. to find N(0.3, 1):

> Nv(0.3, 1);

        .629532561743333520e-4

> fsolve(uval(x)=0.05,x=0..0.8);

This is attempting to find x in the interval [0, 0.8] such that N(x,1) = 0.05.  Unfortunately in this case there is no such x, as the maximum value of N(x,1) is approximately 0.00028, so this fsolve command returns unevaluated.  However, you could try

> fsolve(uval(x) = 0.00005, x = 0 .. 0.8);

.3371872944

 

You are aware, I suppose, that this determinant will have 10! different terms.  I was able to calculate (without printing!) LinearAlgebra[Determinant](M) , an expression for which Maple shows a length of 344373121.   But factoring something this big is not going to be easy.   Execution stopped: Memory allocation failed, with the Bytes indicating 1.58G.   All in all pretty reasonable, I'd say, but "your mileage may vary".  This is using (32-bit) Classic Maple 13.02 under Windows Vista.  I had no trouble interrupting the computation when the Bytes indicator passed 1G, either in Classic or Standard GUI.

 

Like this:

f := (r, x) -> r*x - sin(x);
    with(plots):
    display([implicitplot(f(r,x),x = -10 .. 10, r=-2 .. cos(x), 
      colour=green, axes=box, gridrefine=3, crossingrefine=3),
             implicitplot(f(r,x),x = -10 .. 10, r=cos(x) .. 2,  
      colour=red,   axes=box, gridrefine=3, crossingrefine=3),
    fieldplot([f(r,x),0], x=-10..10, r=-2..2, grid=[10,10],
        arrows=SLIM, fieldstrength=log)]); 

Like this:

f := (r, x) -> r*x - sin(x);
    with(plots):
    display([implicitplot(f(r,x),x = -10 .. 10, r=-2 .. cos(x), 
      colour=green, axes=box, gridrefine=3, crossingrefine=3),
             implicitplot(f(r,x),x = -10 .. 10, r=cos(x) .. 2,  
      colour=red,   axes=box, gridrefine=3, crossingrefine=3),
    fieldplot([f(r,x),0], x=-10..10, r=-2..2, grid=[10,10],
        arrows=SLIM, fieldstrength=log)]); 

It's simply not the Miller Rabin test.  In Miller-Rabin, for a to be a witness for the compositeness of n, where k = n/2d is the largest odd factor of n,  you need ak ≠ 1 mod n and a(2r k) ≠ -1 mod n for all r with 0 ≤ rd-1.

. You only checked ak mod n.

It's simply not the Miller Rabin test.  In Miller-Rabin, for a to be a witness for the compositeness of n, where k = n/2d is the largest odd factor of n,  you need ak ≠ 1 mod n and a(2r k) ≠ -1 mod n for all r with 0 ≤ rd-1.

. You only checked ak mod n.

There is no Classic in the 64-bit version of Maple.   It ought to be possible to use a 32-bit version of Maple in a 64-bit operating system, but problems have been reported with that too (see e.g. www.mapleprimes.com/forum/wheresclassic).

There is no Classic in the 64-bit version of Maple.   It ought to be possible to use a 32-bit version of Maple in a 64-bit operating system, but problems have been reported with that too (see e.g. www.mapleprimes.com/forum/wheresclassic).

That is a bug in the Standard GUI.  I hope you'll submit an SCR.  The problem, it seems, is that you get a CURVES plot structure with all its points [undefined, undefined, undefined].  But this should not crash the GUI.  Classic just produces

Warning, The use of global variables in numerical ODE problems is deprecated, and will be removed in a future release. Use the 'parameters' argument instead (see ?dsolve,numeric,parameters)

Warning, plot may be incomplete, the following errors(s) were issued:
   parameter 'a' must be assigned a numeric value before obtaining a solution
Plotting error, VIEW must contain numeric ranges
 

First 57 58 59 60 61 62 63 Last Page 59 of 187