Doug Meade

 

Doug

---------------------------------------------------------------------
Douglas B. Meade <><
Math, USC, Columbia, SC 29208 E-mail: mailto:meade@math.sc.edu
Phone: (803) 777-6183 URL: http://www.math.sc.edu

MaplePrimes Activity


These are questions asked by Doug Meade

The following example has been a cornerstone in the computer lab exercises for Calculus II:

a := n -> (-1)^n*arctan(n):
Limit( a(n), n=infinity ):
% = value( % );
/ n \ 1 1 1 1
lim \(-1) arctan(n)/ = - - Pi - - I Pi .. - Pi + - I Pi
n -> infinity 2 2 2 2

The new VolumeOfRevolution command in the Student[Calculus1] package has lots of nice features for controlling the output (Riemann sum, 3D plot, animation, inert integral, numerical approximation, ...).

The default colors for the plot are not very appealing. Not only is the pink easily washed out by a projector in a moderately light room, but the detail is missing. To illustrate, consider

with(Student[Calculus1]):
VolumeOfRevolution(2-x^2, x, x=0..1, output=plot );

A user recently sent to me a Maplet that includes the display of an array of plots. This maplet works fine when run under the classic interface but not under the standard interface. As I tried to understand this problem I believe I have narrowed it down to a difference in the way the classic and standard interfaces handle an array of plots.

The attached worksheet is a very simplified example that shows the problem. What should happen is that pressing the "Plot single" button should show a single graph, pressing the "Plot array" button plots the empty axes, and pressing the "Plot displayed array" button displays a 2x2 array of plots. The second and third buttons illustrate the need for "plots:-display" in the action definition for this button.

Unfortunately, this works only in the classic interface. In the standard interface the "plot displayed array" button does not display anything. I should add that it appears to work correctly when exported as a .maplet file and run with the Maplet Viewer.

I have uploaded the worksheet: PlotArrayMapletDem.mw

I have a worksheet that I want to close from within the same worksheet.

Does anyone have any ways of doing this?

I had hoped there might be something to do this in the Worksheet package -  but that's not really what that package is designed to do.

I can imagine something that raises a sufficiently problematic error code that causes the worksheet to kernel connection to be lost, but don't really know how to go about doing this in a reliable and nondestructive way.

Maybe there is a way to issue a system (or ssystem) command to kill the appropriate process? This would need to be sufficiently robust as to work for Windows, Mac, Linux, and Unix - as well as any other supported Maple platform.

Has anyone ever done this? If so, how did you do it?

Thanks in advance,

Earlier this week a colleagues approached me with a problem he was trying to solve with Maple.

The basic problem is to compute the asymptotic expansion of an expression. It's not difficult to see the leading term of this expansion, but Maple's result does not match this expectation. Let me demonstrate:

B := (n,h) -> (n+h)!/r^(n+h) * (1+(P0+h*P1)*r/n);
                           /    (P0 + h P1) r\
          factorial(n + h) |1 + -------------|
                           \          n      /
(n, h) -> ------------------------------------
                         (n + h)             
                        r                    

simplify( asympt( B(n,1)/B(n,0)-1, n, 3 ) );
                            n + O(1)
asympt( simplify( B(n,1)/B(n,0)-1 ), n, 3 );
                                   2                         
 n   1 + r P1 - r   P0 r + r P1 - r  P0 + (-1 - r P1 + r) P0 r
 - + ------------ + ------------------------------------------
 r        r                            r n                   

      /            2   \          
      \-r P1 + P0 r  P1/ P0    /1 \
    + --------------------- + O|--|
                2              | 3|
               n               \n /

 

The real issue is the drastically different results from the previous two commands.  The only difference in the commands is the explicit simplify before or after the call to asympt.

It would be best if this last expression could be seen in the form:

(n+1)/r + (P1-1) + (1-r*P0)*P1/n - r*(1-r*P0)*P0*P1/n^2 + O(1/n^3);
  n + 1            (1 - P0 r) P1   r (1 - P0 r) P0 P1    /1 \
  ----- + P1 - 1 + ------------- - ------------------ + O|--|
    r                    n                  2            | 3|
                                           n             \n /

What's the difference in the two uses of asympt? This simpler example appears to show the essence of what is going on. On one hand,

B := (n,h) -> 1/r^(n+h);
             1   
(n, h) -> --------
           (n + h)
          r      

simplify( asympt( B(n,1)/B(n,0)-1, n, 3 ) );
Error, (in asympt) unable to compute series

while on the other hand

asympt( simplify( B(n,1)/B(n,0)-1 ), n, 3 );
                              r - 1
                            - -----
                                r 
1 2 3 4 5 6 Page 2 of 6