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

I posted a report about my visit to Maplesoft on my blog.

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 don't have time to check this, but I believe your problem is with the your usage of with.

Within a proc, you should use uses, not with (see ?procedure ).

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 don't have time to check this, but I believe your problem is with the your usage of with.

Within a proc, you should use uses, not with (see ?procedure ).

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 first questions are:

  1. How are the matrices A[i,j] defined?
  2. What is in the (1,1) entry of these matrices?
  3. In your definition of graph, what is the value of j?
  4. What do you get when you try to create the individual plots?
    For example, plot( A[0,j][1,1], x=1..90 ); and plot( A[1,j][1,1], x=1..90 );

Assuming you graph is a list of expressions that depend only on x, you could create the plot as follows:

plotList := plot( graph[1..4], x=1..90 );
plots[display]( plotList );

Note that unless you are going to do something more with plotList, the plot could be displayed with the single command:

plot( graph[1..4], x=1..90 );

I hope this helps you to find where the source of your problems.

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

Following pagan's approaches above, here's one way to find the sum of the diagonal you are requesting:

M:=Matrix([[1,2,4],[4,6,8],[5,7,9]]);
                                    [1  2  4]
                                    [       ]
                               M := [4  6  8]
                                    [       ]
                                    [5  7  9]
add( M[i,-i], i=1..min(op(1,M)) );
                                     15

Note that I make use of negative indices to count element from the end: M[1,-1] is the last element of row 1, i.e., M[1,3].

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

Following pagan's approaches above, here's one way to find the sum of the diagonal you are requesting:

M:=Matrix([[1,2,4],[4,6,8],[5,7,9]]);
                                    [1  2  4]
                                    [       ]
                               M := [4  6  8]
                                    [       ]
                                    [5  7  9]
add( M[i,-i], i=1..min(op(1,M)) );
                                     15

Note that I make use of negative indices to count element from the end: M[1,-1] is the last element of row 1, i.e., M[1,3].

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

Your are, obviously, using 2D Input. In this mode you need to "escape" the underscore by preceeding it with a backslash..

That is, to enter rtable_dims you would type rtable\_dims

I have to add that if you are using Maple for this kind of technical dissection of Maple objects, I highly recommend changing to 1D input (i.e., Maple Notation). This will avoid your problem with typing _ in a name and will give you much more control over exactly how your input is interpretted by Maple. Don't get me wrong, 2D input is nice - but it's best for doing mathematics not "programming".

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

Your are, obviously, using 2D Input. In this mode you need to "escape" the underscore by preceeding it with a backslash..

That is, to enter rtable_dims you would type rtable\_dims

I have to add that if you are using Maple for this kind of technical dissection of Maple objects, I highly recommend changing to 1D input (i.e., Maple Notation). This will avoid your problem with typing _ in a name and will give you much more control over exactly how your input is interpretted by Maple. Don't get me wrong, 2D input is nice - but it's best for doing mathematics not "programming".

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

Why don't you use another loop? The inner loop sums the terms, and the outer loop goes through all the values of N.

You might have to be a little careful and tell Maple exactly what results you want to have displayed. When you start to have nested loops Maple might not show you everything it does at every step. (This is usually a good thing!)

You can play with the printlevel setting  ( ?printlevel ), or just insert explicit print statements that display what you want to see.

I'll let you play with this. If you have more questions, post your attempt and we'll respond directly based on how you've started.

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

Why don't you use another loop? The inner loop sums the terms, and the outer loop goes through all the values of N.

You might have to be a little careful and tell Maple exactly what results you want to have displayed. When you start to have nested loops Maple might not show you everything it does at every step. (This is usually a good thing!)

You can play with the printlevel setting  ( ?printlevel ), or just insert explicit print statements that display what you want to see.

I'll let you play with this. If you have more questions, post your attempt and we'll respond directly based on how you've started.

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

You need to be a little careful here.

While, in this case, using sum works, using add is preferrable.

Why? What's the difference?

Well, sum is intended for symbolic summation - either a finite (but not explicitly given as a definite number) number of terms or an infinite number of terms. These sums can be evaluated using an algorithm that uses ideas similar to those involved in the Fundamental Theorem of Calculus for definite integrals. That is, these sums are NOT found by the explicit addition of terms.

When you have a finite sum of a definite number of terms the add command just adds the terms.

So, in this case, for N=1, I would use:

add( 1/k^2+3, k=1..20 );
                             667608487627785841
                             ------------------
                             10838475198270720
 

Moreover, for a general N, the sum command is appropriate. Here's how I might proceed in that case:

S := sum( 1/k^2+3, k=1..20*N );
                                                 1   2
                       60 N - Psi(1, 20 N + 1) + - Pi 
                                                 6    
seq( S, N=1..30 );
         667608487627785841  3471882955795558480635682730386309  
         ------------------, ----------------------------------, 
         10838475198270720    28546916554875489385168794240000   

                              1   2                     1   2  
           180 - Psi(1, 61) + - Pi , 240 - Psi(1, 81) + - Pi , 
                              6                         6      

                               1   2                      1   2  
           300 - Psi(1, 101) + - Pi , 360 - Psi(1, 121) + - Pi , 
                               6                          6      

                               1   2                      1   2  
           420 - Psi(1, 141) + - Pi , 480 - Psi(1, 161) + - Pi , 
                               6                          6      

                               1   2                      1   2  
           540 - Psi(1, 181) + - Pi , 600 - Psi(1, 201) + - Pi , 
                               6                          6      

                               1   2                      1   2  
           660 - Psi(1, 221) + - Pi , 720 - Psi(1, 241) + - Pi , 
                               6                          6      

                               1   2                      1   2  
           780 - Psi(1, 261) + - Pi , 840 - Psi(1, 281) + - Pi , 
                               6                          6      

                               1   2                      1   2  
           900 - Psi(1, 301) + - Pi , 960 - Psi(1, 321) + - Pi , 
                               6                          6      

                                1   2                       1   2  
           1020 - Psi(1, 341) + - Pi , 1080 - Psi(1, 361) + - Pi , 
                                6                           6      

                                1   2                       1   2  
           1140 - Psi(1, 381) + - Pi , 1200 - Psi(1, 401) + - Pi , 
                                6                           6      

                                1   2                       1   2  
           1260 - Psi(1, 421) + - Pi , 1320 - Psi(1, 441) + - Pi , 
                                6                           6      

                                1   2                       1   2  
           1380 - Psi(1, 461) + - Pi , 1440 - Psi(1, 481) + - Pi , 
                                6                           6      

                                1   2                       1   2  
           1500 - Psi(1, 501) + - Pi , 1560 - Psi(1, 521) + - Pi , 
                                6                           6      

                                1   2                       1   2  
           1620 - Psi(1, 541) + - Pi , 1680 - Psi(1, 561) + - Pi , 
                                6                           6      

                                1   2                       1   2
           1740 - Psi(1, 581) + - Pi , 1800 - Psi(1, 601) + - Pi 
                                6                           6    
evalf( % );
61.59616324, 121.6202440, 181.6284056, 241.6325119, 301.6349839, 361.6366354, 

  421.6378167, 481.6387036, 541.6393939, 601.6399466, 661.6403990, 

  721.6407761, 781.6410953, 841.6413690, 901.6416063, 961.6418140, 

  1021.641997, 1081.642160, 1141.642306, 1201.642437, 1261.642556, 

  1321.642664, 1381.642762, 1441.642853, 1501.642936, 1561.643013, 

  1621.643084, 1681.643150, 1741.643211, 1801.643269

The fact that Maple reports the general sum in terms of the Psi function is an artifact of the use of sum's definite summation.

The misuse of sum and the unfamiliarity of add is very common (I know it's been discussed before, and I thought this in a Top Ten Tricks of Maple Experts - but I can't find such a forum or blog entry. Can anyone find this and provide a link to it?).

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

 

You need to be a little careful here.

While, in this case, using sum works, using add is preferrable.

Why? What's the difference?

Well, sum is intended for symbolic summation - either a finite (but not explicitly given as a definite number) number of terms or an infinite number of terms. These sums can be evaluated using an algorithm that uses ideas similar to those involved in the Fundamental Theorem of Calculus for definite integrals. That is, these sums are NOT found by the explicit addition of terms.

When you have a finite sum of a definite number of terms the add command just adds the terms.

So, in this case, for N=1, I would use:

add( 1/k^2+3, k=1..20 );
                             667608487627785841
                             ------------------
                             10838475198270720
 

Moreover, for a general N, the sum command is appropriate. Here's how I might proceed in that case:

S := sum( 1/k^2+3, k=1..20*N );
                                                 1   2
                       60 N - Psi(1, 20 N + 1) + - Pi 
                                                 6    
seq( S, N=1..30 );
         667608487627785841  3471882955795558480635682730386309  
         ------------------, ----------------------------------, 
         10838475198270720    28546916554875489385168794240000   

                              1   2                     1   2  
           180 - Psi(1, 61) + - Pi , 240 - Psi(1, 81) + - Pi , 
                              6                         6      

                               1   2                      1   2  
           300 - Psi(1, 101) + - Pi , 360 - Psi(1, 121) + - Pi , 
                               6                          6      

                               1   2                      1   2  
           420 - Psi(1, 141) + - Pi , 480 - Psi(1, 161) + - Pi , 
                               6                          6      

                               1   2                      1   2  
           540 - Psi(1, 181) + - Pi , 600 - Psi(1, 201) + - Pi , 
                               6                          6      

                               1   2                      1   2  
           660 - Psi(1, 221) + - Pi , 720 - Psi(1, 241) + - Pi , 
                               6                          6      

                               1   2                      1   2  
           780 - Psi(1, 261) + - Pi , 840 - Psi(1, 281) + - Pi , 
                               6                          6      

                               1   2                      1   2  
           900 - Psi(1, 301) + - Pi , 960 - Psi(1, 321) + - Pi , 
                               6                          6      

                                1   2                       1   2  
           1020 - Psi(1, 341) + - Pi , 1080 - Psi(1, 361) + - Pi , 
                                6                           6      

                                1   2                       1   2  
           1140 - Psi(1, 381) + - Pi , 1200 - Psi(1, 401) + - Pi , 
                                6                           6      

                                1   2                       1   2  
           1260 - Psi(1, 421) + - Pi , 1320 - Psi(1, 441) + - Pi , 
                                6                           6      

                                1   2                       1   2  
           1380 - Psi(1, 461) + - Pi , 1440 - Psi(1, 481) + - Pi , 
                                6                           6      

                                1   2                       1   2  
           1500 - Psi(1, 501) + - Pi , 1560 - Psi(1, 521) + - Pi , 
                                6                           6      

                                1   2                       1   2  
           1620 - Psi(1, 541) + - Pi , 1680 - Psi(1, 561) + - Pi , 
                                6                           6      

                                1   2                       1   2
           1740 - Psi(1, 581) + - Pi , 1800 - Psi(1, 601) + - Pi 
                                6                           6    
evalf( % );
61.59616324, 121.6202440, 181.6284056, 241.6325119, 301.6349839, 361.6366354, 

  421.6378167, 481.6387036, 541.6393939, 601.6399466, 661.6403990, 

  721.6407761, 781.6410953, 841.6413690, 901.6416063, 961.6418140, 

  1021.641997, 1081.642160, 1141.642306, 1201.642437, 1261.642556, 

  1321.642664, 1381.642762, 1441.642853, 1501.642936, 1561.643013, 

  1621.643084, 1681.643150, 1741.643211, 1801.643269

The fact that Maple reports the general sum in terms of the Psi function is an artifact of the use of sum's definite summation.

The misuse of sum and the unfamiliarity of add is very common (I know it's been discussed before, and I thought this in a Top Ten Tricks of Maple Experts - but I can't find such a forum or blog entry. Can anyone find this and provide a link to it?).

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

 

Roman,

Would you please post your question about why Maple won't automatically compress worksheets in the Maple 15 - Wish List topic on my blog?

I've asked this question before, and would appreciate more support for this functionality.

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

Maybe you could show us what you can do, and ask for some comments or other feedback.

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

Maybe you could show us what you can do, and ask for some comments or other feedback.

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 9 10 11 12 13 14 15 Last Page 11 of 76