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've read, and re-read, the online help for sum and sum,details. I see nothing that indicates that the indices in a sum will be treated as integers. In fact, I had the opposite (and incorrect) understanding based on the examples showing sums over the roots of equations.  The add command does not make this assumption.

This should be clearly explained in the help. Alec's examples would be very useful to include in the Examples section.

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

Which strange rule?

The one that explains the difference between Maple's sum and add commands? (see ?sum and ?add)

In short, use sum only when dealing with a symbolic or infinite sum. When you really want to add a list of numbers, use add.

sum( a, j=0..-2 );
                                     -a
add( a, j=0..-2 );
                                      0
sum( a, j=lo..hi );
                               (hi - lo + 1) a

All of this is completely consistent. You might not like it, but this is all well-documented in Maple's help system.

Note that sum uses a general formula and does not do any sanity checking to ensure that the formula really makes sense and is applicable.

sum( a, j=lo..hi );
                               (hi - lo + 1) a

On the other hand, add tries to add explicit numbers, so it does not work well with general (or infinite) limits.

add( a, j=lo..hi );

Error, unable to execute add

Just so you don't think I am too sympathetic to your concerns, take a look at this example:

sum( a, j=5/2..17/3 );
                                     3 a
add( a, j=5/2..17/3 );
                                     4 a

I do not know where this is explained in the help system, but this difference is somewhat surprising.

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

Do you really need the index, or would you be just as happy to have that actual equation? When I learned about the search and remove (and searchremove) commands, I found my thinking moving away from thinking about specific indices. If this would work for you, then you can modify Alec's ideas to:

select( has, A, sin );    # returns all equations that involve sin
select( has, A, sin )[1]; # returns first equation that involves sin

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

Do you really need the index, or would you be just as happy to have that actual equation? When I learned about the search and remove (and searchremove) commands, I found my thinking moving away from thinking about specific indices. If this would work for you, then you can modify Alec's ideas to:

select( has, A, sin );    # returns all equations that involve sin
select( has, A, sin )[1]; # returns first equation that involves sin

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

Maybe like this?

B:=Matrix(3,4,[1,2,3,4,5,6,8$6]):
ListTools:-Flatten(convert(B,listlist));
                    [1, 2, 3, 4, 5, 6, 8, 8, 8, 8, 8, 8]

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 like this?

B:=Matrix(3,4,[1,2,3,4,5,6,8$6]):
ListTools:-Flatten(convert(B,listlist));
                    [1, 2, 3, 4, 5, 6, 8, 8, 8, 8, 8, 8]

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

Joe,

Very useful. When was this introduced in Maple? Has this always been available?

Thank you!

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

Joe,

Very useful. When was this introduced in Maple? Has this always been available?

Thank you!

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 have not yet read the information pointed to by Joe's comment, so I might not be aware of some benefits of overload.

When I first saw the original post, here is how I would have approached the problem:

f := proc(a::list,b::list)
  if _params['b']=NULL then
    print(`received ONE list`);
  else
    print(`received TWO lists`);
  end if;
end proc:

f(1);
Error, invalid input: f expects its 1st argument, a, to be of type list, but received 1
f([1]);
                              received ONE list
f([1],[2]);
                             received TWO lists
f([1],2);
Error, invalid input: f expects its 2nd argument, b, to be of type list, but received 2

For more information about _params, _nparams, _rest, etc., please see the online help for using_parameters. This has improved significantly since the days of args and nargs.

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 have not yet read the information pointed to by Joe's comment, so I might not be aware of some benefits of overload.

When I first saw the original post, here is how I would have approached the problem:

f := proc(a::list,b::list)
  if _params['b']=NULL then
    print(`received ONE list`);
  else
    print(`received TWO lists`);
  end if;
end proc:

f(1);
Error, invalid input: f expects its 1st argument, a, to be of type list, but received 1
f([1]);
                              received ONE list
f([1],[2]);
                             received TWO lists
f([1],2);
Error, invalid input: f expects its 2nd argument, b, to be of type list, but received 2

For more information about _params, _nparams, _rest, etc., please see the online help for using_parameters. This has improved significantly since the days of args and nargs.

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 I see what you are talking about.

I think what you are requesting is that all of the minor tick lines are below all of the major ticklines which are below the actual curves in the plot.

I will submit an SCR about this.

Thanks for being patient with me about 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

I think I see what you are talking about.

I think what you are requesting is that all of the minor tick lines are below all of the major ticklines which are below the actual curves in the plot.

I will submit an SCR about this.

Thanks for being patient with me about 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

Interesting. But, I still cannot reproduce this. I've tried copying from MaplePrimes and input from an existing document. The .maplet file Maple produces has either 772 or 774 bytes. Both versions function the same way.

Can you provide more explicit and complete description of the steps you use to make your observations?

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

Interesting. But, I still cannot reproduce this. I've tried copying from MaplePrimes and input from an existing document. The .maplet file Maple produces has either 772 or 774 bytes. Both versions function the same way.

Can you provide more explicit and complete description of the steps you use to make your observations?

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 cannot confirm what you are reporting.

Here is how I tried to reproduce your experience.

  1. Open new Maple document (not worksheet) with 2D input
  2. Paste code from MaplePrimes into empty document (this is a 2D input region with no prompt)
  3. Press Enter [at this point the maplet launches]
  4. Play with maplet, then kill it
  5. Export document as maplet (File : Export As ...  : Maplet (.maplet))
  6. Double-click on .maplet file [again, the maplet lauches]
  7. Play with maplet, then kill it

Based on this, everything works fine. The only difference I see in the .maplet file created by these steps is everything is on one long line.

This is not the usual way in which I use Maple. I work with worksheets and 1D input (so I do see the prompt), or with text files.

To give you something specific to compare with, I am uploading the .mw files for the worksheet and document versions of the maplet - and the corresponding .maplet files: UniqueWkst.maplet and UniqueDoc.maplet .

If I have misinterpretted your report, please point out my error and I will see what I can do.

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 18 19 20 21 22 23 24 Last Page 20 of 76