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

If you do not need your result to be used in anything else (purely visual), then you could use nprintf to create a more appealing output. Here's how this might look.
restart;
aa := [ [1,0,1,0], [1,1,0,0], [0,0,1,1] ]:
alias( a[1]=[1,0,1,0], a[2]=[1,1,0,0], a[3]=[0,0,1,1] ):
A := {aa[1],aa[2],aa[3]};
                             {a[1], a[2], a[3]}
MyAdd := (a,b)->a+b:
MyEqual := (a,b)->evalb(sort(a)=sort(b)):
EquivalenceClass := proc( A, BinOper, Equal )
  local b, B, s, S;
  S := combinat[choose](A,2);
  B := {};
  while S<>{} do
    for b in B do
      S := select( s->not Equal(BinOper(s[1],s[2]),BinOper(b[1],b[2])), S );
    end do;
    if S<>{} then B := B union {S[1]} end if;
  end do;
#  return B;                      # choose output format desired
#  return map( b->b[1]&+b[2], B );
  return map( b->nprintf("%a + %a",b[]), B );
end proc:
EquivalenceClass( A, MyAdd, MyEqual );
                         {a[1] + a[2], a[2] + a[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/~meade/
I was afraid that is what you wanted to see. Starting from my EquivalenceClass procedure posted earlier, here is a revised version that does what you ask. Two changes are needed. First, I use alias to have the elements displayed as a[1], etc. Then, the procedure uses the "neutral sum" (&+) to return an unevaluated sum instead of the actual pairs of elements.
restart;
aa := [ [1,0,1,0], [1,1,0,0], [0,0,1,1] ]:
alias( a[1]=[1,0,1,0], a[2]=[1,1,0,0], a[3]=[0,0,1,1] ):
A := {aa[1],aa[2],aa[3]};
                             {a[1], a[2], a[3]}
MyAdd := (a,b)->a+b:
MyEqual := (a,b)->evalb(sort(a)=sort(b)):
EquivalenceClass := proc( A, BinOper, Equal )
  local b, B, s, S;
  S := combinat[choose](A,2);
  B := {};
  while S<>{} do
    for b in B do
      S := select( s->not Equal(BinOper(s[1],s[2]),BinOper(b[1],b[2])), S );
    end do;
    if S<>{} then B := B union {S[1]} end if;
  end do;
  return map( b->b[1]&+b[2], B );
end proc:
EquivalenceClass( A, MyAdd, MyEqual );
                    {(a[1]) &+ (a[2]), (a[2]) &+ (a[3])}
I doubt this can be done with ListTools[Categorize], but I won't be surprised to learn something new either. 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 was afraid that is what you wanted to see. Starting from my EquivalenceClass procedure posted earlier, here is a revised version that does what you ask. Two changes are needed. First, I use alias to have the elements displayed as a[1], etc. Then, the procedure uses the "neutral sum" (&+) to return an unevaluated sum instead of the actual pairs of elements.
restart;
aa := [ [1,0,1,0], [1,1,0,0], [0,0,1,1] ]:
alias( a[1]=[1,0,1,0], a[2]=[1,1,0,0], a[3]=[0,0,1,1] ):
A := {aa[1],aa[2],aa[3]};
                             {a[1], a[2], a[3]}
MyAdd := (a,b)->a+b:
MyEqual := (a,b)->evalb(sort(a)=sort(b)):
EquivalenceClass := proc( A, BinOper, Equal )
  local b, B, s, S;
  S := combinat[choose](A,2);
  B := {};
  while S<>{} do
    for b in B do
      S := select( s->not Equal(BinOper(s[1],s[2]),BinOper(b[1],b[2])), S );
    end do;
    if S<>{} then B := B union {S[1]} end if;
  end do;
  return map( b->b[1]&+b[2], B );
end proc:
EquivalenceClass( A, MyAdd, MyEqual );
                    {(a[1]) &+ (a[2]), (a[2]) &+ (a[3])}
I doubt this can be done with ListTools[Categorize], but I won't be surprised to learn something new either. 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/
As I was preparing my post, Joe posted a better solution. It is nice to see that we used the same approach. Even though I did a search for "equivalence" in Maple, I did not find think to look in ListTools. Even if I had, I'm not sure I would have thought to look at Categorize. While, in hindsight, all of this makes sense, I doubt many mathematicians would have found this. This can be frustrating. I know it's difficult to predict all the different ways a user might want to refer to a specific algorithm, but I continue to hope that there might be better cross-referencing within the help system. 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/
As I was preparing my post, Joe posted a better solution. It is nice to see that we used the same approach. Even though I did a search for "equivalence" in Maple, I did not find think to look in ListTools. Even if I had, I'm not sure I would have thought to look at Categorize. While, in hindsight, all of this makes sense, I doubt many mathematicians would have found this. This can be frustrating. I know it's difficult to predict all the different ways a user might want to refer to a specific algorithm, but I continue to hope that there might be better cross-referencing within the help system. 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/
Now that your exam should be over, how did it go? Were you able to complete your Maple lab assignment? As for me, I am now having to grade a 6+ inch stack of exams. I always tell my students that I would rather study for and take an exam than prepare the exam, watch the class take the exam, and then grade the exam. It really can be a lot of work, particularly since I make lots of comments on the exam - to help students to learn from this experience. Hoping all went well, 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/
Now that your exam should be over, how did it go? Were you able to complete your Maple lab assignment? As for me, I am now having to grade a 6+ inch stack of exams. I always tell my students that I would rather study for and take an exam than prepare the exam, watch the class take the exam, and then grade the exam. It really can be a lot of work, particularly since I make lots of comments on the exam - to help students to learn from this experience. Hoping all went well, 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/
Evan after posting my previous response, here is something I just did as I was preparing the final exam that I will give in 3 hours.
> (((x-2)^2)(x-1))(x+1);
                                                2
                           (x(x - 1)(x + 1) - 2) 
> int( %, x );
                          /                     2   \
                       int\(x(x - 1)(x + 1) - 2) , x/
> (x-2)^2 (x-1) (x+1);
                                 2                
                          (x - 2)  (x - 1) (x + 1)
> int( %, x );

                               1  5    4    3      2
                        -4 x + - x  - x  + x  + 2 x 
                               5                    

If I have to insert a space to indicate multiplication, I would rather be forced to insert a *. 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/
Evan after posting my previous response, here is something I just did as I was preparing the final exam that I will give in 3 hours.
> (((x-2)^2)(x-1))(x+1);
                                                2
                           (x(x - 1)(x + 1) - 2) 
> int( %, x );
                          /                     2   \
                       int\(x(x - 1)(x + 1) - 2) , x/
> (x-2)^2 (x-1) (x+1);
                                 2                
                          (x - 2)  (x - 1) (x + 1)
> int( %, x );

                               1  5    4    3      2
                        -4 x + - x  - x  + x  + 2 x 
                               5                    

If I have to insert a space to indicate multiplication, I would rather be forced to insert a *. 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/
In this case, even the space is not required. Using 2D Math Notation, in a worksheet or a document, any of the following are acceptable:
> 5(7y+3) = 39;
                               35 y + 15 = 39
> 5 (7y+3) = 39;
                               35 y + 15 = 39
> 5(7 y+3) = 39;
                               35 y + 15 = 39
> 5 (7 y+3) = 39;
                               35 y + 15 = 39
> 5*(7*y+3) = 39;
                               35 y + 15 = 39
Spaces are not needed if the first term in the multiplication is a constant (e.g., 5 or 7). But, change the 5 to a name, say a, and the results are different. Compare
> a(7y+3) = 39; diff(%, y);
                               a(7 y + 3) = 39
                             7 D(a)(7 y + 3) = 0
> a (7y+3) = 39; diff(%, y);
                              a (7 y + 3) = 39
                                   7 a = 0
> a(7 y+3) = 39; diff(%, y);
                               a(7 y + 3) = 39
                             7 D(a)(7 y + 3) = 0
> a (7 y+3) = 39; diff(%, y);
                              a (7 y + 3) = 39
                                   7 a = 0
> a*(7*y+3) = 39; diff(%, y);
                              a (7 y + 3) = 39
                                   7 a = 0
Notice that when a is immediately followed by a left parenthesis this is interpreted as a function: the function a evaluated at 7*y+3. One of the consequences of this is the following
eval( a(7y+3) = 39, a=4 );
                                   4 = 39
In this context 4(7y+3) is interpreted as the value of the constant function 4 evaluated at (7*y+3), which is 4. Implied multiplication can be convenient but it also opens the door for unexpected 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/~meade/
In this case, even the space is not required. Using 2D Math Notation, in a worksheet or a document, any of the following are acceptable:
> 5(7y+3) = 39;
                               35 y + 15 = 39
> 5 (7y+3) = 39;
                               35 y + 15 = 39
> 5(7 y+3) = 39;
                               35 y + 15 = 39
> 5 (7 y+3) = 39;
                               35 y + 15 = 39
> 5*(7*y+3) = 39;
                               35 y + 15 = 39
Spaces are not needed if the first term in the multiplication is a constant (e.g., 5 or 7). But, change the 5 to a name, say a, and the results are different. Compare
> a(7y+3) = 39; diff(%, y);
                               a(7 y + 3) = 39
                             7 D(a)(7 y + 3) = 0
> a (7y+3) = 39; diff(%, y);
                              a (7 y + 3) = 39
                                   7 a = 0
> a(7 y+3) = 39; diff(%, y);
                               a(7 y + 3) = 39
                             7 D(a)(7 y + 3) = 0
> a (7 y+3) = 39; diff(%, y);
                              a (7 y + 3) = 39
                                   7 a = 0
> a*(7*y+3) = 39; diff(%, y);
                              a (7 y + 3) = 39
                                   7 a = 0
Notice that when a is immediately followed by a left parenthesis this is interpreted as a function: the function a evaluated at 7*y+3. One of the consequences of this is the following
eval( a(7y+3) = 39, a=4 );
                                   4 = 39
In this context 4(7y+3) is interpreted as the value of the constant function 4 evaluated at (7*y+3), which is 4. Implied multiplication can be convenient but it also opens the door for unexpected 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/~meade/
The Asymptotes command in the Student[Calculus1] package is useful for finding asymptotes of a function. Here is the Examples section of the help page for Asymptotes:
  with(Student[Calculus1]):
  Asymptotes(1/(x - 3) + 2*x, x);
                              [y = 2 x, x = 3]
  Asymptotes(1/(x - 3) + 2*x, x = 0..2);
                                  [y = 2 x]
  Asymptotes(tan(x), 0..10);
                       [    1         3         5   ]
                       [x = - Pi, x = - Pi, x = - Pi]
                       [    2         2         2   ]
  Asymptotes(tan(x), 0..10, numeric);
             [x = 1.570796327, x = 4.712388980, x = 7.853981634]
  Asymptotes((x^3 - 2*x^2 + x)/(x^3 - 3*x^2 - x + 3), x);
                           [y = 1, x = -1, x = 3]
Asymptotes can produce oblique asymptotes as well:
  Asymptotes((x^3 - 2*x^2 + x)/( x^2 - x + 3), x);
                                 [y = x - 1]
And, here is what it reports for cot(x), with no restriction on the domain:
  Asymptotes( cot(x), x );
    Warning, the expression has an infinity of asymptotes, some examples of which are given
                          [x = -Pi, x = 0, x = Pi]
It's unfortunate this command does not have an optional argument that would produce a graph (output=plot). This type of flexibility is provided in many other commands in this package, e.g., RiemannSum. Hopefully this can be added for the next release. 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/
To determine if you believe Maple's answers, you can look at the graphs of these functions. Also, re-check the definitions of critical points and inflection points. An inflection point is a point where the second derivative changes sign. One way this can happen is for the second derivative to be zero, but there is another way. I won't give you this answer, but I will tell you that I can see two points to check without doing any differentiation. But, to get started, look at the graphs. You will need to specify the domain and the range, for example,
plot( df, x=-3..3, y=-10..10 );
You might also want to include discont=true as an optional argument in the plot command. That's enough hints. Lastly, using RealDomain can have some unwanted consequences. This does not always work exactly as you would like. I prefer to let Maple give me the complex answers and then to ignore them if I don't want them. Something like this can be useful too:
remove( has,[ws1],I );
This will give you a list. To get just the elements of the list, append a [] to the end of the above command. You should be getting close. Even though Maple can do a lot for you, you cannot stop thinking about what you trying to do and what Maple's responses mean. 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/
To determine if you believe Maple's answers, you can look at the graphs of these functions. Also, re-check the definitions of critical points and inflection points. An inflection point is a point where the second derivative changes sign. One way this can happen is for the second derivative to be zero, but there is another way. I won't give you this answer, but I will tell you that I can see two points to check without doing any differentiation. But, to get started, look at the graphs. You will need to specify the domain and the range, for example,
plot( df, x=-3..3, y=-10..10 );
You might also want to include discont=true as an optional argument in the plot command. That's enough hints. Lastly, using RealDomain can have some unwanted consequences. This does not always work exactly as you would like. I prefer to let Maple give me the complex answers and then to ignore them if I don't want them. Something like this can be useful too:
remove( has,[ws1],I );
This will give you a list. To get just the elements of the list, append a [] to the end of the above command. You should be getting close. Even though Maple can do a lot for you, you cannot stop thinking about what you trying to do and what Maple's responses mean. 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/
My advice: check your work whenever possible. - Every antiderivative can be checked by differentiation. - Check that your answers "make sense" - areas, volumes are positive. - Remember to check units. Make sure there are no funny combinations in the original problem (feet and meters, seconds aand minutes, ...). And, be sure to put appropriate units on your answers. - Check that you have clearly identified your answers. - Try to keep your work organized and well labeled. Do not write y=x^2=y'=2*x. And, lastly, look through the exam and make sure you have enough time to work all of the problems that you KNOW how to solve and then come back to the ones you THINK you can solve and only then work on the ones that you are unsure about. Use your time wisely. Good luck, 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 56 57 58 59 60 61 62 Last Page 58 of 76