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

William, I'll let Robert speak for himself. Personally, my Maple knowledge is very evolutionary. I started with some basic skills and techniques. Then, by following various online discussions, my knowledge increased. The Maple language has also evolved. While great pains have been taken to attempt to preserve backward compatibility, you will sometimes see reference to a solution that works only with a sufficiently new version of Maple. It is entirely possible that the solution presented by Robert would not work in an older version of Maple. I would not expect the vast majority of Maple users to come up with Robert's solution on their first attempt. Anyone who does, has done something similar in the past and has developed an ability to think in terms of functions. This can be very powerful, but is not always the most natural for the general user. There are lots of tricks like putting the square brackets around the command name. Whether you like these or not depends on your background. I know many users are completely baffled by this and find code written in this way to be unreadable (at their experience level). There are issues of performance, but for most users these are overwhelmed by issues of ease of understanding and the amount of time available to develop their solution. This is already longer than I intended it to be. Consider it as one user's opinion. Others can chime in with their personal opinions. 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/
William, I'll let Robert speak for himself. Personally, my Maple knowledge is very evolutionary. I started with some basic skills and techniques. Then, by following various online discussions, my knowledge increased. The Maple language has also evolved. While great pains have been taken to attempt to preserve backward compatibility, you will sometimes see reference to a solution that works only with a sufficiently new version of Maple. It is entirely possible that the solution presented by Robert would not work in an older version of Maple. I would not expect the vast majority of Maple users to come up with Robert's solution on their first attempt. Anyone who does, has done something similar in the past and has developed an ability to think in terms of functions. This can be very powerful, but is not always the most natural for the general user. There are lots of tricks like putting the square brackets around the command name. Whether you like these or not depends on your background. I know many users are completely baffled by this and find code written in this way to be unreadable (at their experience level). There are issues of performance, but for most users these are overwhelmed by issues of ease of understanding and the amount of time available to develop their solution. This is already longer than I intended it to be. Consider it as one user's opinion. Others can chime in with their personal opinions. 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/
William, I always enclose the Maple commands, and output, in a <pre> tag. So, what I really entered is: <pre> for P in [true,false,FAIL] do   for Q in [true,false,FAIL] do      ...    end do; end do; ... </pre> Now, entering the above so that you could see what I actually type, was a little more of a challenge. Note that the displayed title in the Recent Comments list shows the source for the subject. 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/
William, I always enclose the Maple commands, and output, in a <pre> tag. So, what I really entered is: <pre> for P in [true,false,FAIL] do   for Q in [true,false,FAIL] do      ...    end do; end do; ... </pre> Now, entering the above so that you could see what I actually type, was a little more of a challenge. Note that the displayed title in the Recent Comments list shows the source for the subject. 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/
It's not too difficult to access the specific data used by Maple to create plots. In particular, if you have a 2D data structure, Maple can export this directly to Excel - from which you should be able to get the data in almost any format you might need. To browse any array, simply select Browse from the context menu (right click on the array object). The precise form of the data depends on the type of problem from which the plot is generated. In different situations you will get either a GRID, ISOSURFACE, or MESH data structure. (See ?plot3d,structure for details.) Here are a couple of examples showing what I have in mind:
> P1 := plot3d( sin(x+y), x=0..Pi, y=0..Pi );
> op(1,P1);
> op([1,3],P1);
The first operand of this PLOT3D data structure is a GRID. The data are obtained by evaluating the function on a regular 25x25 grid on [0.3.14159] x [0,3.14159]. If you want to have [x,y,z] data, you could generate this with Maple or another data tool.
> P2 := plots[implicitplot3d]( z=sin(x+y), x=0..Pi, y=0..Pi, z=-1..1 );
> op(1,P2);
> op([1,1],P2);
In this case the data structure is an ISOSURFACE. This is a 4D data structure obtained by sampling on a regular 10x10x10 grid. The 4th component stores [x,y,z,F(x,y,z)] (where the surface is F(x,y,z)=0; here F(x,y,z)=z-sin(x+y)). This object is rendered by plotting the zero-surface of F. If you can provide a more clear description of exactly how you generate the plot and the format the data needs to be in for your other purposes, there's a good chance someone here will be able to give you a more complete and useful answer. 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/
It's not too difficult to access the specific data used by Maple to create plots. In particular, if you have a 2D data structure, Maple can export this directly to Excel - from which you should be able to get the data in almost any format you might need. To browse any array, simply select Browse from the context menu (right click on the array object). The precise form of the data depends on the type of problem from which the plot is generated. In different situations you will get either a GRID, ISOSURFACE, or MESH data structure. (See ?plot3d,structure for details.) Here are a couple of examples showing what I have in mind:
> P1 := plot3d( sin(x+y), x=0..Pi, y=0..Pi );
> op(1,P1);
> op([1,3],P1);
The first operand of this PLOT3D data structure is a GRID. The data are obtained by evaluating the function on a regular 25x25 grid on [0.3.14159] x [0,3.14159]. If you want to have [x,y,z] data, you could generate this with Maple or another data tool.
> P2 := plots[implicitplot3d]( z=sin(x+y), x=0..Pi, y=0..Pi, z=-1..1 );
> op(1,P2);
> op([1,1],P2);
In this case the data structure is an ISOSURFACE. This is a 4D data structure obtained by sampling on a regular 10x10x10 grid. The 4th component stores [x,y,z,F(x,y,z)] (where the surface is F(x,y,z)=0; here F(x,y,z)=z-sin(x+y)). This object is rendered by plotting the zero-surface of F. If you can provide a more clear description of exactly how you generate the plot and the format the data needs to be in for your other purposes, there's a good chance someone here will be able to give you a more complete and useful answer. 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/
Just to clarify something in Robert's posting. The apparent discrepancy in the last displayed output in the previous posting only appears to be incorrect. The problem is that Maple's prettyprinter has decided to omit a level of parentheses that we humans would generally leave in our scribblings. To be more explicit: not P or Q means (not P) or Q.
for P in [true,false,FAIL] do
  for Q in [true,false,FAIL] do
    print( (not(P and not Q)) = (not P or Q) );
  end do;
end do;
                                 true = true
                                false = false
                                 FAIL = FAIL
                                 true = true
                                 true = true
                                 true = true
                                 true = true
                                 FAIL = FAIL
                                 FAIL = FAIL
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/
Just to clarify something in Robert's posting. The apparent discrepancy in the last displayed output in the previous posting only appears to be incorrect. The problem is that Maple's prettyprinter has decided to omit a level of parentheses that we humans would generally leave in our scribblings. To be more explicit: not P or Q means (not P) or Q.
for P in [true,false,FAIL] do
  for Q in [true,false,FAIL] do
    print( (not(P and not Q)) = (not P or Q) );
  end do;
end do;
                                 true = true
                                false = false
                                 FAIL = FAIL
                                 true = true
                                 true = true
                                 true = true
                                 true = true
                                 FAIL = FAIL
                                 FAIL = FAIL
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 will guess that you are looking at vector-valued functions. In this case these are also parametric curves. The two plots can be obtained as follows:
plot( [3*cos(2*t),-2*sin(2*t),t=0..2*Pi], scaling=constrained );
plot( [sqrt(t),t^2-2*t,t=0..5] );
Notice that the first curve is traversed twice with this range for the parameter t. And, the curve is traced out in a clockwise manner. These are easier to see with an animation. It's very easy to get these as well:
with( plots ):
animatecurve( [3*cos(2*t),-2*sin(2*t),t=0..2*Pi], scaling=constrained );
animatecurve( [sqrt(t),t^2-2*t,t=0..5] );
Note that all that has changed is the command. The arguments to plot and to animatecurve are exactly the same. To see the animation, click in the plot region and then use the VCR-like controls in the menu bar (or in a context menu). 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/
I will guess that you are looking at vector-valued functions. In this case these are also parametric curves. The two plots can be obtained as follows:
plot( [3*cos(2*t),-2*sin(2*t),t=0..2*Pi], scaling=constrained );
plot( [sqrt(t),t^2-2*t,t=0..5] );
Notice that the first curve is traversed twice with this range for the parameter t. And, the curve is traced out in a clockwise manner. These are easier to see with an animation. It's very easy to get these as well:
with( plots ):
animatecurve( [3*cos(2*t),-2*sin(2*t),t=0..2*Pi], scaling=constrained );
animatecurve( [sqrt(t),t^2-2*t,t=0..5] );
Note that all that has changed is the command. The arguments to plot and to animatecurve are exactly the same. To see the animation, click in the plot region and then use the VCR-like controls in the menu bar (or in a context menu). 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/
All of this is a matter of definitions. You have to realize that commonly-used words may not have the same meaning every time they are used. You have to look at the definitions (help page) for int and solve to see exactly what they are designed to produce, and how they can be tweaked to give slightly different performance. Both int and solve pay attention to the environment variable _EnvAllSolutions. See ?int,details and ?solve,details (both of which are mentioned in the Details section of the help for solve and int). Unfortunately, this does not change the say int responds for your example. But, for solve, it does what you want.
> restart;
> _EnvAllSolutions := true;
                                    true

> solve( sin(x)=0, x );
                                   Pi _Z1
> about( _Z1 );
Originally _Z1, renamed _Z1~:
  is assumed to be: integer
To get a better feel for what is possible here, consider:
solve( sin(x)=1/2, x );
                         1      2                  
                         - Pi + - Pi _B2 + 2 Pi _Z2
                         6      3                  
about( _Z2, _B2 );
Originally _Z2, renamed _Z2~:
  is assumed to be: integer

Originally _B2, renamed _B2~:
  is assumed to be: OrProp(0,1)
I hope this is useful. 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 would really like to be able to have Maple automatically simplify a piecewise-defined expression. Probably
combine( expr, piecewise, x );
In the absence of this functionality, yes, I do recommend the conversion to Heaviside and then back to piecewise. As your example illustrates, this is not always automatic or foolproof. But, usually it is not too difficult to work as in my previous post to get to something that is useful. So, while it is unrealistic to expect Maple (or any software) to be able to automatically handle all possibilities, I don't believe it is inappropriate to ask the developers to think about starting to provide some support for this type of manipulation. 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 would really like to be able to have Maple automatically simplify a piecewise-defined expression. Probably
combine( expr, piecewise, x );
In the absence of this functionality, yes, I do recommend the conversion to Heaviside and then back to piecewise. As your example illustrates, this is not always automatic or foolproof. But, usually it is not too difficult to work as in my previous post to get to something that is useful. So, while it is unrealistic to expect Maple (or any software) to be able to automatically handle all possibilities, I don't believe it is inappropriate to ask the developers to think about starting to provide some support for this type of manipulation. 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/
Jacques, My apologies. And, since you have responded, I cannot correct this. It's permanent. I'll try harder next time. 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/
How is Maple finding a repeated root of 0? If it's splitting the abs into a piecewise, then 0 is only in the domain for one piece. Is this there another explanation for the double roots?
---------------------------------------------------------------------
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 63 64 65 66 67 68 69 Last Page 65 of 76