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

The output you report makes it sound as though Maple does not know what to do with the display command. The display command is in the plots package. You need to load this package before using the display command. This is done with: with( plots ); I will guess that the worksheet from your instructor had a with( plots ) command somewhere before the part of the code that you copied. 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/~meade/
The output you report makes it sound as though Maple does not know what to do with the display command. The display command is in the plots package. You need to load this package before using the display command. This is done with: with( plots ); I will guess that the worksheet from your instructor had a with( plots ) command somewhere before the part of the code that you copied. 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/~meade/
Todd, and all new Maple users, Welcome to the community. I think you will find the Maple community in general, and MaplePrimes in particular, to be very friendly and helpful. All of us are constantly learning -- new techniques for using Maple, features added to new releases, new problems that benefit from using Maple, ... Do not hesitate to ask questions. We have all been new users at one time, and remember all the help we received from other users. With wishes for a great weekend, 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/~meade/
Todd, and all new Maple users, Welcome to the community. I think you will find the Maple community in general, and MaplePrimes in particular, to be very friendly and helpful. All of us are constantly learning -- new techniques for using Maple, features added to new releases, new problems that benefit from using Maple, ... Do not hesitate to ask questions. We have all been new users at one time, and remember all the help we received from other users. With wishes for a great weekend, 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/~meade/
    Once it was pointed out I see that Maple was interpreting the range as -10 to .10 not -10 to 10 as I intended. This explains why I was only getting the third quadrant displayed in my plot. ...
Maple does not care how many periods are used to represent the range - provided there are at least two. The problem was that you used a single ellipsis character in your range specification.
    ... I'm more familiar with Mathcad that has a range button [m..n] that allows you to fill in the place holders, it would have taken me a while to even notice this error.Also, semi-colon I have to get used to adding those.
The palettes should have a way to enter a range by clicking, but I do not see a palette that it is on any of the palettes in Maple 10. (I did find the ellipsis - is that what you used?)
---------------------------------------------------------------------
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/~meade/
    Once it was pointed out I see that Maple was interpreting the range as -10 to .10 not -10 to 10 as I intended. This explains why I was only getting the third quadrant displayed in my plot. ...
Maple does not care how many periods are used to represent the range - provided there are at least two. The problem was that you used a single ellipsis character in your range specification.
    ... I'm more familiar with Mathcad that has a range button [m..n] that allows you to fill in the place holders, it would have taken me a while to even notice this error.Also, semi-colon I have to get used to adding those.
The palettes should have a way to enter a range by clicking, but I do not see a palette that it is on any of the palettes in Maple 10. (I did find the ellipsis - is that what you used?)
---------------------------------------------------------------------
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/~meade/
Not so fast. The problem in the original code is not the use of three dots to represent a range, it's that the dots were entered as a single character.
with(DEtools):
desgn := diff(y(x),x)=-x/y(x);
DEplot(desgn,y(x),x=-10…10,y=-10…10);
Compare this with the following:
with(DEtools):
desgn := diff(y(x),x)=-x/y(x);
DEplot(desgn,y(x),x=-10...10,y=-10...10);
Note that I have made two changes to the definition of desgn. To avoid the warning: Warning, y is present as both a dependent variable and a name. Inconsistent specification of the dependent variable is deprecated, and it is assumed that the name is being used in place of the dependent variable. it is necessary to list all references to the function y as y(x). Also, a semi-colon is needed. This "feature" is documented. The online help for range includes the item
  • Note that more than two dots in succession are also parsed as the range (`..`) operator.
This means that if you want the right endpoint of the range to be a floating point number between 0 and 1, you need to either put a space before the decimal point or write the number with a leading 0. Compare:
plot( sin(x), x=0...1 );
plot( sin(x), x=0.. .1 );
plot( sin(x), x=0..0.1);
You don't want to know the full story behind how I discovered this. But, now that I know about this feature, I am very careful to not be caught by it again. 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/~meade/
Not so fast. The problem in the original code is not the use of three dots to represent a range, it's that the dots were entered as a single character.
with(DEtools):
desgn := diff(y(x),x)=-x/y(x);
DEplot(desgn,y(x),x=-10…10,y=-10…10);
Compare this with the following:
with(DEtools):
desgn := diff(y(x),x)=-x/y(x);
DEplot(desgn,y(x),x=-10...10,y=-10...10);
Note that I have made two changes to the definition of desgn. To avoid the warning: Warning, y is present as both a dependent variable and a name. Inconsistent specification of the dependent variable is deprecated, and it is assumed that the name is being used in place of the dependent variable. it is necessary to list all references to the function y as y(x). Also, a semi-colon is needed. This "feature" is documented. The online help for range includes the item
  • Note that more than two dots in succession are also parsed as the range (`..`) operator.
This means that if you want the right endpoint of the range to be a floating point number between 0 and 1, you need to either put a space before the decimal point or write the number with a leading 0. Compare:
plot( sin(x), x=0...1 );
plot( sin(x), x=0.. .1 );
plot( sin(x), x=0..0.1);
You don't want to know the full story behind how I discovered this. But, now that I know about this feature, I am very careful to not be caught by it again. 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/~meade/
If you don't want to insert print statements, and you really want to see everything, you can change the printlevel. Here is an excerpt from the online help for printlevel:
  • The top (interactive) level is level 0; statements within conditional/repetition statements are level 1, or level 2 if doubly nested, etcetera. The first procedure is level 5; statements within conditional/repetition statements within a procedure are level 6, etcetera. The nth nested procedure is level 5*n.
  • The setting of printlevel causes the display of the results of all statements executed up to the level indicated by printlevel. Initially, printlevel is set to 1.
  • Higher values of printlevel will cause more information to be displayed; negative values will cause no information to be displayed.
  • When execution errors are encountered and printlevel > 2 a summary of calling routines, such as provided by tracelast, is also provided.
  • For debugging purposes, printlevel := 1000 is not uncommon.
The final statement is a bit extreme. If you have that many nested function calls, you might want to think about using the Maple debugger.
---------------------------------------------------------------------
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/~meade/
If you don't want to insert print statements, and you really want to see everything, you can change the printlevel. Here is an excerpt from the online help for printlevel:
  • The top (interactive) level is level 0; statements within conditional/repetition statements are level 1, or level 2 if doubly nested, etcetera. The first procedure is level 5; statements within conditional/repetition statements within a procedure are level 6, etcetera. The nth nested procedure is level 5*n.
  • The setting of printlevel causes the display of the results of all statements executed up to the level indicated by printlevel. Initially, printlevel is set to 1.
  • Higher values of printlevel will cause more information to be displayed; negative values will cause no information to be displayed.
  • When execution errors are encountered and printlevel > 2 a summary of calling routines, such as provided by tracelast, is also provided.
  • For debugging purposes, printlevel := 1000 is not uncommon.
The final statement is a bit extreme. If you have that many nested function calls, you might want to think about using the Maple debugger.
---------------------------------------------------------------------
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/~meade/
Vladimir, There should not be any problem doing what you want to do. To better analyze and resolve your problems, could you please post the full worksheet (or document) that you are preparing. 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/~meade/
`if` is the operator form of the conditional if .. then .. end if is the conditional statement There are some instances where it is not feasible to use the conditional statement but the operator can be used. A primary functional difference is in the way the arguments are evaluated. `if` has special evaluation rules that evaluate arguments only as they are needed. This can save a lot of needless work and, sometimes, avoids evaluation errors. The online help for if (?if) gives more details. 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/~meade/
Maple's sum command is designed to produce closed form summation formulas. If you really want to add a sequence of numbers, you should use add. You are are also encountering Maple's evaluation rules. Let me see if I can explain.
  • sum(`if`(k=0,n,binomial(n,k)),k=0..n);
    
    When this is executed Maple evaluates the argument of sum. Since k does not have a value, k<>0, and so this is equivalent to
    sum( binomial(n,k), k=0..n );
    
    Maple reports the closed form expression for this sum: 2^n.
  • n + sum(binomial(n,k),k=1..n);
    
    This is similar, except now the closed form for the sum is 2^n-1; adding n gives Maple's result: n-1+2^n.
  • sum(g(3,x),x=0..2);
    
    In the same way, Maple expands this to
    sum( 3^2, x=0..2 );
    
    which is 27
What can you do to avoid these problems? To add a sequence of numbers, use the add command. The add command is essentially equivalent to a for - do loop. In particular,
add(g(3,y),y=0..2);
is equivalent to g(3,0)+g(3,1)+g(3,3) which evaluates to 21. To prevent Maple from evaluating the function when it is first seen in the sum command, you need to define the function to return unevaluated whenever the argument is not a number. For example,
G := (n,k) -> `if`(not k::numeric,
                   'procname(args)',
                   `if`(k=0,n,n^2));
Now, G(3,k) returns as G(3,k) while G(3,0) returns as 3. Then, either sum or add gives the same result:
sum( G(n,k), k=0..2 );
add( G(n,k), k=0..2 );
both return n+2*n^2. I hope this has been instructive, 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/~meade/
The previous post is WRONG. There are many polynomials with an odd number of real roots (counting multiple solutions). Every first-degree polynomial has exactly one real root: P(x) = a*x+b = 0 iff x = -b/a (a<>0) Polynomials with real coefficients have an even number of complex roots - because they must appear in conjugate pairs. Two consequences of this are
  1. that every polynomial with an odd degree must have an odd number of real roots
  2. that every polynomial with an even degree must have an even number of real roots.
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/~meade/
I think Axel was a little premature in his comments about "mw" files. I agree that it is frustrating to not see the full input. The real culprit here is 2d math input. If you use Maple notation for input, then there is no hiding of characters. Well, it would be even better if - like Word - there was a way to truly see every character in a worksheet. Just my two cents, 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/~meade/
First 69 70 71 72 73 74 75 Page 71 of 76