Robert Israel

6577 Reputation

21 Badges

18 years, 209 days
University of British Columbia
Associate Professor Emeritus
North York, Ontario, Canada

MaplePrimes Activity


These are replies submitted by Robert Israel

Somewhat simpler and more efficient:

...
if evalf(abs(sin(n*Pi/x))) < 0.4 then print(n) end if
...

Somewhat simpler and more efficient:

...
if evalf(abs(sin(n*Pi/x))) < 0.4 then print(n) end if
...

It is hard to tell what's going wrong without seeing your actual code.  If it's too big to comfortably post the text here, you could upload a worksheet and post a link to it (use the green up-arrow).

Well, here's what I get using GlobalSolve in the Global Optimization Toolbox.

> f:= x -> M*(  (1 -  ( 1 - q*(0.0012/M)^(1-q))*exp(-k*q*x)) 
    /q)^(1/(1-q)) :
  residuals := map(p -> (f(p[1])-p[2]), DATA):
  S:= GlobalSolve(add(r^2,r=residuals),{1-(1-q*(.0012/M)^(1-q))*exp(-k*q*DATA[1,1]) >= 0},
    k=0..1, q=0.001 ..1, M=40..1000);

S := [.0682323723481939038, [M = 684.346063551151019, k = .0193668947556888127, q = .999981375129361694]]

> with(plots):
  display(pointplot(DATA), plot(eval(f(x),S[2]),x=13 ..35));
 

 It's still not a good fit, but I don't think there's much better..

.

Well, here's what I get using GlobalSolve in the Global Optimization Toolbox.

> f:= x -> M*(  (1 -  ( 1 - q*(0.0012/M)^(1-q))*exp(-k*q*x)) 
    /q)^(1/(1-q)) :
  residuals := map(p -> (f(p[1])-p[2]), DATA):
  S:= GlobalSolve(add(r^2,r=residuals),{1-(1-q*(.0012/M)^(1-q))*exp(-k*q*DATA[1,1]) >= 0},
    k=0..1, q=0.001 ..1, M=40..1000);

S := [.0682323723481939038, [M = 684.346063551151019, k = .0193668947556888127, q = .999981375129361694]]

> with(plots):
  display(pointplot(DATA), plot(eval(f(x),S[2]),x=13 ..35));
 

 It's still not a good fit, but I don't think there's much better..

.

The code for semilogplot checks which interface is being used.  If this is Standard, and not plotting to gif, maplet etc, it calls Plot:-LogPlot2D, and otherwise it calls `plots/semilogplot`.  And the latter does a better job of choosing points to plot. 

By the way, Plot:-LogPlot2D was fixed in Maple 12.

 

The code for semilogplot checks which interface is being used.  If this is Standard, and not plotting to gif, maplet etc, it calls Plot:-LogPlot2D, and otherwise it calls `plots/semilogplot`.  And the latter does a better job of choosing points to plot. 

By the way, Plot:-LogPlot2D was fixed in Maple 12.

 

Was Perelman "the only one that could solve the problem"?  He was the first to succeed, and he's obviously a very brilliant mathematician, but I strongly suspect that if he hadn't been around somebody else would have done it, maybe not immediately but within 10 or 20 years. 

What parts of Maple are relevant?  The DifferentialGeometry package, presumably.

 

... except that due to a bug, in Maple 13 Standard this will only give you half the torus.  You might try

 

> plots:-implicitplot3d(z^2=1-(r-5)^2, r = 0..7, theta = 0..2*Pi, z = -2..2, 
  coords = cylindrical, grid=[40,40,40], scaling=constrained, style=patchcontour,
  view=[-7..7,-7..7,-2..2]);

 

... except that due to a bug, in Maple 13 Standard this will only give you half the torus.  You might try

 

> plots:-implicitplot3d(z^2=1-(r-5)^2, r = 0..7, theta = 0..2*Pi, z = -2..2, 
  coords = cylindrical, grid=[40,40,40], scaling=constrained, style=patchcontour,
  view=[-7..7,-7..7,-2..2]);

 

odeplot from the plots package.  For example:

> Sol:= dsolve({EDP, IBC}, numeric); 
  plots[odeplot](Sol, [[z,s(z)],[z,i(z)]], z=0..100, colour=[red,blue], legend = [s(z), i(z)]);
 

odeplot from the plots package.  For example:

> Sol:= dsolve({EDP, IBC}, numeric); 
  plots[odeplot](Sol, [[z,s(z)],[z,i(z)]], z=0..100, colour=[red,blue], legend = [s(z), i(z)]);
 

I think the reason subsindets fails here is because of the special evaluation rules of evalhf.
The code for subsindets contains

transformer(env[1],args[4 .. -1])

In this case transformer would be evalhf, and args[4 .. -1] would evaluate to NULL, but because of the special evaluation rules that evaluation doesn't occur before evalhf is called, so evalhf sees two arguments.

My suggestion would have been

map(term -> applyop(t -> 
   if type(t,numeric) then Hfloat(t) else Hfloat(1)*t end if, 1, term), f);

but that's slower than Roman's method by more than a factor of 3 on his example.

If you really want an array, you could do it with

> plotter := array(1..3,[[10, 2, -3], [5, -5, 6], [17, -8, 1]]);

But it's probably better to use Array.

If you really want an array, you could do it with

> plotter := array(1..3,[[10, 2, -3], [5, -5, 6], [17, -8, 1]]);

But it's probably better to use Array.

First 40 41 42 43 44 45 46 Last Page 42 of 187