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 replies submitted by Doug Meade

Like this?

b := 4:
plot( sin(b*x), x=-Pi..Pi, title=sprintf("y=sin(%a*x)",b) );

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

Like this?

b := 4:
plot( sin(b*x), x=-Pi..Pi, title=sprintf("y=sin(%a*x)",b) );

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

I think you have the inequality backwards in your latest posting. Shouldn't it be m2<m1? Here's my analysis of the problem (mimicking your proof, but avoiding all uses of op:

ineq := m2 < m1;
         /        /                 2\         \                         
         |        |  2   alpha sigma |         |                         
         |(p - 1) |mu  + ------------|        2|                         
         |        \       2 - alpha  /   sigma |                         
   alpha |---------------------------- + ------|                         
         |              3                   2  |        2   2        2   
         \             p                   p   /   alpha  mu  (p - 1)    
   --------------------------------------------- + ------------------- < 
                     2 - alpha                                  2  4     
                                                     (2 - alpha)  p      

           /          2        2\
           |(p - 1) mu    sigma |
     alpha |----------- + ------|
           |     2          p   |
           \    p               /
     ----------------------------
              2 - alpha          
ineq1 := ineq - rhs(ineq);                       # move all terms to LHS
ineq2 := collect( ineq1, [sigma,mu] );           # reorder terms
ineq3 := Ineq2 - select(has,lhs(ineq2),sigma);   # move terms with sigma back to the RHS (no op!)
ineq3 := simplify( ineq3 );
                         /                 2    2      \   2     
           (p - 1) alpha \2 p - alpha - 2 p  + p  alpha/ mu      
           ------------------------------------------------- < - 
                                       2  4                      
                           (-2 + alpha)  p                       

                   /                 2    2      \      2
             alpha \2 p - alpha - 2 p  + p  alpha/ sigma 
             --------------------------------------------
                                       2  3              
                           (-2 + alpha)  p 

We want to divide by the RHS, but first need to determine if this expression is positive or negative (under appropriate assumptions):

ineqA := factor( rhs(ineq3)>0 );
                                                               2
                   alpha (p - 1) (-2 p + p alpha + alpha) sigma 
             0 < - ---------------------------------------------
                                             2  3               
                                 (-2 + alpha)  p                
denom(rhs(ineqA))>0;
                                            2  3
                            0 < (-2 + alpha)  p 
is( denom(rhs(ineqA))>0 ) assuming p>0, alpha<>2, p::real, alpha::real;  # denominator is positive
                                    true

ineqB := numer( rhs(ineqA) ) > 0;
                                                              2
             0 < -alpha (p - 1) (-2 p + p alpha + alpha) sigma 
ineqC := select( t->has(t,p) and has(t,alpha), rhs(ineqB) ) < 0;
                         -2 p + p alpha + alpha < 0
#solve( ineqC, p ) assuming alpha>0, alpha<1;
is( ineqC ) assuming alpha>0, alpha<1, p>1;                             # so is the numerator (w/assumptions)
                                    true

Now we return to the main inequality:

ineq4 := [lhs/rhs](ineq3)[]<1:         # divide by RHS
ineq5 := factor( ineq4 );              # simplify (easily seen to be true)
                                          2    
                                (p - 1) mu     
                              - ----------- < 1
                                        2      
                                 p sigma       

is( ineq5 ) assuming p>1, sigma::real, mu::real, sigma<>0;
                                    true

This was fun.

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

I think you have the inequality backwards in your latest posting. Shouldn't it be m2<m1? Here's my analysis of the problem (mimicking your proof, but avoiding all uses of op:

ineq := m2 < m1;
         /        /                 2\         \                         
         |        |  2   alpha sigma |         |                         
         |(p - 1) |mu  + ------------|        2|                         
         |        \       2 - alpha  /   sigma |                         
   alpha |---------------------------- + ------|                         
         |              3                   2  |        2   2        2   
         \             p                   p   /   alpha  mu  (p - 1)    
   --------------------------------------------- + ------------------- < 
                     2 - alpha                                  2  4     
                                                     (2 - alpha)  p      

           /          2        2\
           |(p - 1) mu    sigma |
     alpha |----------- + ------|
           |     2          p   |
           \    p               /
     ----------------------------
              2 - alpha          
ineq1 := ineq - rhs(ineq);                       # move all terms to LHS
ineq2 := collect( ineq1, [sigma,mu] );           # reorder terms
ineq3 := Ineq2 - select(has,lhs(ineq2),sigma);   # move terms with sigma back to the RHS (no op!)
ineq3 := simplify( ineq3 );
                         /                 2    2      \   2     
           (p - 1) alpha \2 p - alpha - 2 p  + p  alpha/ mu      
           ------------------------------------------------- < - 
                                       2  4                      
                           (-2 + alpha)  p                       

                   /                 2    2      \      2
             alpha \2 p - alpha - 2 p  + p  alpha/ sigma 
             --------------------------------------------
                                       2  3              
                           (-2 + alpha)  p 

We want to divide by the RHS, but first need to determine if this expression is positive or negative (under appropriate assumptions):

ineqA := factor( rhs(ineq3)>0 );
                                                               2
                   alpha (p - 1) (-2 p + p alpha + alpha) sigma 
             0 < - ---------------------------------------------
                                             2  3               
                                 (-2 + alpha)  p                
denom(rhs(ineqA))>0;
                                            2  3
                            0 < (-2 + alpha)  p 
is( denom(rhs(ineqA))>0 ) assuming p>0, alpha<>2, p::real, alpha::real;  # denominator is positive
                                    true

ineqB := numer( rhs(ineqA) ) > 0;
                                                              2
             0 < -alpha (p - 1) (-2 p + p alpha + alpha) sigma 
ineqC := select( t->has(t,p) and has(t,alpha), rhs(ineqB) ) < 0;
                         -2 p + p alpha + alpha < 0
#solve( ineqC, p ) assuming alpha>0, alpha<1;
is( ineqC ) assuming alpha>0, alpha<1, p>1;                             # so is the numerator (w/assumptions)
                                    true

Now we return to the main inequality:

ineq4 := [lhs/rhs](ineq3)[]<1:         # divide by RHS
ineq5 := factor( ineq4 );              # simplify (easily seen to be true)
                                          2    
                                (p - 1) mu     
                              - ----------- < 1
                                        2      
                                 p sigma       

is( ineq5 ) assuming p>1, sigma::real, mu::real, sigma<>0;
                                    true

This was fun.

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

I copied your procedure to a Maple *worksheet*, formatted the code (as 1-D input), and then copied it back to the reply window in Mapleprimes. Mapleprimes treats this as one object (CTRL-Enter is used to put text on a new line - this was done automatically). The only other thing I do is change the format of the code to Formatted (from Normal) by moving the cursor to any location in the code and selecting Formatted from the Format pull-down menu.

distrue := proc (n::posint)
 local L, j, i;
 L := Array(1 .. n, datatype = anything);
 for j to n do
   for i to n+1 while % <> FAIL do
    `assuming`([is(S < sigma^2/mu^2)], [1 < p, 0 < mu, 0 < sigma])
   end do;
   L[j] := i-2
 end do;
 convert(L, list);
end proc;

Personally, I use 1D input (Maple notation) in a worksheet. I like this because I can see exactly what I am working with and get exactly what I type. The appearance may not always be optimal, but there is much less ambiguity and uncertainty about what you entered and how Maple will interpret this input. Also, I find it easier to modify my code, if needed.

Note that I talk about "code". My style is based, largely, on the fact that a lot of what I do I want to save and re-use in other situations. This includes saving my work in a text file that can be read into Maple.

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

 

I copied your procedure to a Maple *worksheet*, formatted the code (as 1-D input), and then copied it back to the reply window in Mapleprimes. Mapleprimes treats this as one object (CTRL-Enter is used to put text on a new line - this was done automatically). The only other thing I do is change the format of the code to Formatted (from Normal) by moving the cursor to any location in the code and selecting Formatted from the Format pull-down menu.

distrue := proc (n::posint)
 local L, j, i;
 L := Array(1 .. n, datatype = anything);
 for j to n do
   for i to n+1 while % <> FAIL do
    `assuming`([is(S < sigma^2/mu^2)], [1 < p, 0 < mu, 0 < sigma])
   end do;
   L[j] := i-2
 end do;
 convert(L, list);
end proc;

Personally, I use 1D input (Maple notation) in a worksheet. I like this because I can see exactly what I am working with and get exactly what I type. The appearance may not always be optimal, but there is much less ambiguity and uncertainty about what you entered and how Maple will interpret this input. Also, I find it easier to modify my code, if needed.

Note that I talk about "code". My style is based, largely, on the fact that a lot of what I do I want to save and re-use in other situations. This includes saving my work in a text file that can be read into Maple.

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

 

My code was entered in the Maple 12 Standard interface, using 1D (Maple notation). I just copied an pasted into the response box.

I'd be surprised if you told me you, too, were using 1D input. I'll guess that you are using 2-D input.

Am I right?

One different between our codes is that I issued a restart before I started each test. What do you get if  you manually restart Maple's kernel before each test? Does this change anything? Are your results consistent, or are the runs of random lenghts?

A curious mind wants to know,

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

My code was entered in the Maple 12 Standard interface, using 1D (Maple notation). I just copied an pasted into the response box.

I'd be surprised if you told me you, too, were using 1D input. I'll guess that you are using 2-D input.

Am I right?

One different between our codes is that I issued a restart before I started each test. What do you get if  you manually restart Maple's kernel before each test? Does this change anything? Are your results consistent, or are the runs of random lenghts?

A curious mind wants to know,

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

I agree. The current default does not make much sense.

In a network installation, most users should not be able to write to the program directory.

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

I agree. The current default does not make much sense.

In a network installation, most users should not be able to write to the program directory.

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

It took a while, but I finally did see some FAILs on this. This is bound to be caused by the specific way in which Maple has expressions stored depending upon what has been done previously in the session. I've not investigated deep enough to give a complete diagnosis (maybe someone else can do this).

What I have found is somewhat interesting, and informative. Here's my first implementation of your question:

restart;
ineq := alpha*((p-1)*mu^2/p^2+sigma^2/p)/(2-alpha)
        > alpha*((p-1)*(mu^2+alpha*sigma^2/(2-alpha))/p^3
          +sigma^2/p^2)/(2-alpha)+alpha^2*mu^2*(p-1)^2/((2-alpha)^2*p^4);
is( ineq );
                                    false
is( ineq ) assuming alpha>0, alpha<1, p>1, mu>0, sigma>0;
                                    true

And, then repeated a few more times:

is( ineq ) assuming alpha>0, alpha<1, p>1, mu>0, sigma>0;
                                    true
is( ineq ) assuming alpha>0, alpha<1, p>1, mu>0, sigma>0;
                                    FAIL
is( ineq ) assuming alpha>0, alpha<1, p>1, mu>0, sigma>0;
                                    true

restart;
ineq := alpha*((p-1)*mu^2/p^2+sigma^2/p)/(2-alpha)
        > alpha*((p-1)*(mu^2+alpha*sigma^2/(2-alpha))/p^3
          +sigma^2/p^2)/(2-alpha)+alpha^2*mu^2*(p-1)^2/((2-alpha)^2*p^4):
is( ineq );
                                    false
for i to 100 while %<>FAIL do
  is( ineq ) assuming alpha>0, alpha<1, p>1, mu>0, sigma>0;
end do;
                                    true
                                    true
                                    FAIL

What's particularly interesting about this is that the FAIL on the third call is reproducable, and all subsequent calls appear to return true. (It's important to remember to restart Maple before each test.)

restart;
ineq := alpha*((p-1)*mu^2/p^2+sigma^2/p)/(2-alpha)
        > alpha*((p-1)*(mu^2+alpha*sigma^2/(2-alpha))/p^3
          +sigma^2/p^2)/(2-alpha)+alpha^2*mu^2*(p-1)^2/((2-alpha)^2*p^4):
is( ineq );
                                    false
R := NULL:
for i to 100 do
  R := R, is( ineq ) assuming alpha>0, alpha<1, p>1, mu>0, sigma>0;
end do:
nops( select( `=`, [R], true ) );
                                     99
R[3];
                                    FAIL

In general, it's easier to compare something against 0 than a more complicated expression like the RHS of your original inequality. The natural way to do this is to move everything to one side of the inequality by subtracting.

restart;
ineq := alpha*((p-1)*mu^2/p^2+sigma^2/p)/(2-alpha)
        > alpha*((p-1)*(mu^2+alpha*sigma^2/(2-alpha))/p^3
          +sigma^2/p^2)/(2-alpha)+alpha^2*mu^2*(p-1)^2/((2-alpha)^2*p^4):
ineq2 := factor(ineq - rhs(ineq));
                   /    2     2        2  \                             
     alpha (p - 1) \p mu  - mu  + sigma  p/ (-2 p + p alpha + alpha)    
     --------------------------------------------------------------- < 0
                                        2  4                            
                            (-2 + alpha)  p                             

is( ineq2 );
                                    false
R := NULL:
for i to 100 do
  R := R, is( ineq2 ) assuming alpha>0, alpha<1, p>1, mu>0, sigma>0;
end do:
nops( select( `=`, [R], false ) );
                                     99
R[3];
                                    FAIL

Once again, this returns FAIL on the third attempt.

Look carefully at how I have implemented this subtraction. I subtracted the right-hand side from the inequality. Because of the way Maple rewrites the inequality in terms of `<`, it would be INCORRECT to construct the new inequality as factor(lhs(ineq)-rhs(ineq))>0. Try it!

Another way to deal with inequalities is to divide by one side of the inequality (that is known to be positive) and compare against 1:

restart;
ineq := alpha*((p-1)*mu^2/p^2+sigma^2/p)/(2-alpha)
        > alpha*((p-1)*(mu^2+alpha*sigma^2/(2-alpha))/p^3
          +sigma^2/p^2)/(2-alpha)+alpha^2*mu^2*(p-1)^2/((2-alpha)^2*p^4):
ineq3 := factor(map(`/`,ineq,rhs(ineq)));
                                2 p - alpha      
                            - --------------- < 1
                               2                 
                              p  (-2 + alpha)    
solve(ineq3,alpha) assuming p>1;
                        /         2 p \              
                       { alpha < ----- }, {2 < alpha}
                        \        p + 1/              

Notice that p>1 assures us that 2p/(p+1)>1 and so the inequality does not need to be  reversed.

ineq4 := factor( rhs(ineq) ) > 0;
                                /    2     2        2  \
                          alpha \p mu  - mu  + sigma  p/
                    0 < - ------------------------------
                                  2                     
                                 p  (-2 + alpha)        
is( ineq4 );
                                    false
R := NULL:
for i to 100 do
  R := R, is( ineq4 ) assuming alpha>0, alpha<1, p>1, mu>0, sigma>0;
end do:
nops( select( `=`, [R], true ) );
                                     100
R[3];
                                    true

Now, there are no more FAILs.

None of this explains why the third time this is tested Maple returns FAIL in the first two implementations. This looks like it could be a bug.

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

It took a while, but I finally did see some FAILs on this. This is bound to be caused by the specific way in which Maple has expressions stored depending upon what has been done previously in the session. I've not investigated deep enough to give a complete diagnosis (maybe someone else can do this).

What I have found is somewhat interesting, and informative. Here's my first implementation of your question:

restart;
ineq := alpha*((p-1)*mu^2/p^2+sigma^2/p)/(2-alpha)
        > alpha*((p-1)*(mu^2+alpha*sigma^2/(2-alpha))/p^3
          +sigma^2/p^2)/(2-alpha)+alpha^2*mu^2*(p-1)^2/((2-alpha)^2*p^4);
is( ineq );
                                    false
is( ineq ) assuming alpha>0, alpha<1, p>1, mu>0, sigma>0;
                                    true

And, then repeated a few more times:

is( ineq ) assuming alpha>0, alpha<1, p>1, mu>0, sigma>0;
                                    true
is( ineq ) assuming alpha>0, alpha<1, p>1, mu>0, sigma>0;
                                    FAIL
is( ineq ) assuming alpha>0, alpha<1, p>1, mu>0, sigma>0;
                                    true

restart;
ineq := alpha*((p-1)*mu^2/p^2+sigma^2/p)/(2-alpha)
        > alpha*((p-1)*(mu^2+alpha*sigma^2/(2-alpha))/p^3
          +sigma^2/p^2)/(2-alpha)+alpha^2*mu^2*(p-1)^2/((2-alpha)^2*p^4):
is( ineq );
                                    false
for i to 100 while %<>FAIL do
  is( ineq ) assuming alpha>0, alpha<1, p>1, mu>0, sigma>0;
end do;
                                    true
                                    true
                                    FAIL

What's particularly interesting about this is that the FAIL on the third call is reproducable, and all subsequent calls appear to return true. (It's important to remember to restart Maple before each test.)

restart;
ineq := alpha*((p-1)*mu^2/p^2+sigma^2/p)/(2-alpha)
        > alpha*((p-1)*(mu^2+alpha*sigma^2/(2-alpha))/p^3
          +sigma^2/p^2)/(2-alpha)+alpha^2*mu^2*(p-1)^2/((2-alpha)^2*p^4):
is( ineq );
                                    false
R := NULL:
for i to 100 do
  R := R, is( ineq ) assuming alpha>0, alpha<1, p>1, mu>0, sigma>0;
end do:
nops( select( `=`, [R], true ) );
                                     99
R[3];
                                    FAIL

In general, it's easier to compare something against 0 than a more complicated expression like the RHS of your original inequality. The natural way to do this is to move everything to one side of the inequality by subtracting.

restart;
ineq := alpha*((p-1)*mu^2/p^2+sigma^2/p)/(2-alpha)
        > alpha*((p-1)*(mu^2+alpha*sigma^2/(2-alpha))/p^3
          +sigma^2/p^2)/(2-alpha)+alpha^2*mu^2*(p-1)^2/((2-alpha)^2*p^4):
ineq2 := factor(ineq - rhs(ineq));
                   /    2     2        2  \                             
     alpha (p - 1) \p mu  - mu  + sigma  p/ (-2 p + p alpha + alpha)    
     --------------------------------------------------------------- < 0
                                        2  4                            
                            (-2 + alpha)  p                             

is( ineq2 );
                                    false
R := NULL:
for i to 100 do
  R := R, is( ineq2 ) assuming alpha>0, alpha<1, p>1, mu>0, sigma>0;
end do:
nops( select( `=`, [R], false ) );
                                     99
R[3];
                                    FAIL

Once again, this returns FAIL on the third attempt.

Look carefully at how I have implemented this subtraction. I subtracted the right-hand side from the inequality. Because of the way Maple rewrites the inequality in terms of `<`, it would be INCORRECT to construct the new inequality as factor(lhs(ineq)-rhs(ineq))>0. Try it!

Another way to deal with inequalities is to divide by one side of the inequality (that is known to be positive) and compare against 1:

restart;
ineq := alpha*((p-1)*mu^2/p^2+sigma^2/p)/(2-alpha)
        > alpha*((p-1)*(mu^2+alpha*sigma^2/(2-alpha))/p^3
          +sigma^2/p^2)/(2-alpha)+alpha^2*mu^2*(p-1)^2/((2-alpha)^2*p^4):
ineq3 := factor(map(`/`,ineq,rhs(ineq)));
                                2 p - alpha      
                            - --------------- < 1
                               2                 
                              p  (-2 + alpha)    
solve(ineq3,alpha) assuming p>1;
                        /         2 p \              
                       { alpha < ----- }, {2 < alpha}
                        \        p + 1/              

Notice that p>1 assures us that 2p/(p+1)>1 and so the inequality does not need to be  reversed.

ineq4 := factor( rhs(ineq) ) > 0;
                                /    2     2        2  \
                          alpha \p mu  - mu  + sigma  p/
                    0 < - ------------------------------
                                  2                     
                                 p  (-2 + alpha)        
is( ineq4 );
                                    false
R := NULL:
for i to 100 do
  R := R, is( ineq4 ) assuming alpha>0, alpha<1, p>1, mu>0, sigma>0;
end do:
nops( select( `=`, [R], true ) );
                                     100
R[3];
                                    true

Now, there are no more FAILs.

None of this explains why the third time this is tested Maple returns FAIL in the first two implementations. This looks like it could be a bug.

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

These questions should be in separate threads. If the administrators can do this, thanks! If not, could the feature be created?

Maple keeps track of the working directory through the currentdir command.

CWD := currentdir();
                     "C:\Program Files\Maple 12\bin.win"

Your "home directory" is stored in kernleopts( homedir). To set this to your current working directory, use

kernelopts( homedir );
                      "C:\Documents and Settings\meade"
currentdir( kernelopts( homedir ) );
                     "C:\Program Files\Maple 12\bin.win"

Notice that the currentdir command returns its setting upon input, not the new value to which it has been set. To check the current setting, call currentdir with no argument.

currentdir();
                      "C:\Documents and Settings\meade"

Of course, you can set the current directory to any valid location, just be careful to appropriately escape the directory separators.

Note that the currentdir is not affected by the restart command. (There is a typo in the online help [resart should be restart]; I've submitted an SCR for this.)

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

These questions should be in separate threads. If the administrators can do this, thanks! If not, could the feature be created?

Maple keeps track of the working directory through the currentdir command.

CWD := currentdir();
                     "C:\Program Files\Maple 12\bin.win"

Your "home directory" is stored in kernleopts( homedir). To set this to your current working directory, use

kernelopts( homedir );
                      "C:\Documents and Settings\meade"
currentdir( kernelopts( homedir ) );
                     "C:\Program Files\Maple 12\bin.win"

Notice that the currentdir command returns its setting upon input, not the new value to which it has been set. To check the current setting, call currentdir with no argument.

currentdir();
                      "C:\Documents and Settings\meade"

Of course, you can set the current directory to any valid location, just be careful to appropriately escape the directory separators.

Note that the currentdir is not affected by the restart command. (There is a typo in the online help [resart should be restart]; I've submitted an SCR for this.)

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

On the surface it seems correct to be using sum to implement this function. But, it has to be remembered that Maple provides two different ways to work with a sum of terms: sum and add.

sum is for symbolic sums; ones that you expect to be replaced with another expression.

add is for the (numeric) sum of several terms.

In this case, since Maple does not recognize the inner sum as one that it recognizes, you should be using add. Here's how I would do this (with the corrected sums):

restart:
with(plots):
f:=n->add(add((-1)^(k-j)*binomial(k,j)*j^(n), j=1..k ), k=1..n):

As for generating the plot, there's no need to resort to PLOT or POINTS. Here are two ways to use Maple's basic plot command:

plot( [seq([n,f(n)],n=4..10)], style=point );
plot( f, 4..10, numpoints=7, style=point, adaptive=false );

Each creates the same plot as has appeared previously in this thread.

I hope this is helpful,

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
First 27 28 29 30 31 32 33 Last Page 29 of 76