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 will begin by reiterating my suggestion to not try to put everything inside the definition of the maplet.

In this case, I recommend creating a separate proc to create the plot. So, I changed the defintion of action AC to:

Action[AC](Evaluate(P = 'myPlot'))

and defined the proc myPlot as follows:

myPlot := proc()
  local T;
  T := convert(Get('DD'),string);
  plot(x^2, x = 0 .. 10, title = T, font = [times, roman, 14], color = red, thickness = 3);
end proc:

Note that you need to use Get to access the current contents of DD, and that this must be converted to a string (you would need quotes around the names in the data file to make them strings). This is why the names that have spaces caused problems.

This structure should make it much easier for you to build your actual plots.

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 second Alec's suggestion -- use 1d input.

It's not possible to completely explain why Maple is responding the way it is without knowing exactly how you entered your expression. This includes knowing exactly where the cursor was located and what state it was in at the time. (This is virtually impossible to ascertain after the fact, making debugging - or avoiding - these problems very difficult.)

If you still have the worksheet that shows these responses you might put the cursor in this line of input and use the right-arrow to move through the expression. You should be looking for times when the cursor changes appearance (normal vs. italic, ...). You might also find some places where there are invisible spaces (locations where the right-arrow key does not perceptibly move the cursor to the right). I might guess you will find something like one of these happening between the C and 3 and between RE and T.

I hope this is helpful for 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 second Alec's suggestion -- use 1d input.

It's not possible to completely explain why Maple is responding the way it is without knowing exactly how you entered your expression. This includes knowing exactly where the cursor was located and what state it was in at the time. (This is virtually impossible to ascertain after the fact, making debugging - or avoiding - these problems very difficult.)

If you still have the worksheet that shows these responses you might put the cursor in this line of input and use the right-arrow to move through the expression. You should be looking for times when the cursor changes appearance (normal vs. italic, ...). You might also find some places where there are invisible spaces (locations where the right-arrow key does not perceptibly move the cursor to the right). I might guess you will find something like one of these happening between the C and 3 and between RE and T.

I hope this is helpful for 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

Are you looking for a parametric curve: x=f(t), y=g(t), t=0..Pi/2 ?

If so, you can plot it using the syntax:

plot( [sin(t),1+cos(t),t=0..Pi/2] );

You might want to use more arguments, e.g., view, labels, color, linestyle, etc. to customize the plot.

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

Are you looking for a parametric curve: x=f(t), y=g(t), t=0..Pi/2 ?

If so, you can plot it using the syntax:

plot( [sin(t),1+cos(t),t=0..Pi/2] );

You might want to use more arguments, e.g., view, labels, color, linestyle, etc. to customize the plot.

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

If you have a differential equation that reads

diff( x(t),t ) = sqrt( x(t)^2 + y(t)^2 )

replace it with

diff (x(t),t ) = Re( sqrt( x(t)^2 + y(t)^2 ) )

Because you are working numerically you should not need to use evalc after applying Re. You generally use evalc to tell Maple that unassigned names are real-valued; otherwise, they are assumed to be complex. Compare:

restart;
Re( x );
                                    Re(x)
Re( evalc(x) );
                                    Re(x)
evalc( Re(x) );
                                      x

I hope this helps.

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's solution, which uses the =~ for component-wise equality works only in Maple 13. You can achieve the same result in earlier versions with

OrderL2 := table([ seq(L[i]=i,i=1..nops(L)) ]);

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's solution, which uses the =~ for component-wise equality works only in Maple 13. You can achieve the same result in earlier versions with

OrderL2 := table([ seq(L[i]=i,i=1..nops(L)) ]);

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

Kate,

Don't be so quick to assume you need to use loops. This is a common misconception. Why don't you share a little more about what you are attempting to do and I think we might be able to give you some pointers to making more efficient use of Maple, and maybe even some enhancements that you have not (yet) imagined.

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

Kate,

Don't be so quick to assume you need to use loops. This is a common misconception. Why don't you share a little more about what you are attempting to do and I think we might be able to give you some pointers to making more efficient use of Maple, and maybe even some enhancements that you have not (yet) imagined.

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

Having done extensive work on exterior problems, I have seen all kinds of attempts to avoid dealing with infinity. That is what I assume the OP is attempting to accomplish. The usual way of doing this is to simply truncate the domain. The suggestion of replacing ln(r) by ln(r/r[max]) is, I beleve, an attempt to truncate the interval (to [ 0, r[max] ]. But this is not going to work, as Robert points out, because it changes the solution in such a way that it no longer solves the differential equation.

I'm guessing that the OP likes this approach because ln(r/r[max])=0 when r=r[max]. That's nice, but you can't just impose this on the problem and expect it to retain any relevance to the original problem.

It's better to deal with the realities of the problem and get a useful solution. For example, if you know the solution behaves like ln(r), why not create a new problem for Y(r) = y(r) - ln(r). I doubt your problem can be handled this simply, but it gives an idea about what could be possible.

Of course, if you tell us more about your problem maybe one of us can give you more specific suggestions on how to proceed. What's clear is that you cannot simply ignore real features of your problem.

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

Having done extensive work on exterior problems, I have seen all kinds of attempts to avoid dealing with infinity. That is what I assume the OP is attempting to accomplish. The usual way of doing this is to simply truncate the domain. The suggestion of replacing ln(r) by ln(r/r[max]) is, I beleve, an attempt to truncate the interval (to [ 0, r[max] ]. But this is not going to work, as Robert points out, because it changes the solution in such a way that it no longer solves the differential equation.

I'm guessing that the OP likes this approach because ln(r/r[max])=0 when r=r[max]. That's nice, but you can't just impose this on the problem and expect it to retain any relevance to the original problem.

It's better to deal with the realities of the problem and get a useful solution. For example, if you know the solution behaves like ln(r), why not create a new problem for Y(r) = y(r) - ln(r). I doubt your problem can be handled this simply, but it gives an idea about what could be possible.

Of course, if you tell us more about your problem maybe one of us can give you more specific suggestions on how to proceed. What's clear is that you cannot simply ignore real features of your problem.

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

Just reset the appropriate infolevels to 1:

infolevel[all] := 1:

I should have included this in my original posting - sorry.

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

Just reset the appropriate infolevels to 1:

infolevel[all] := 1:

I should have included this in my original posting - sorry.

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

If you really want to change the definition, just edit the earlier command and re-execute. There is no need to remove the assignment.

x := 3*sin(y);

Oops. This should have been cos:

x := 3*cos(y);

You do need to unassign a name if you want to completely erase all assignments that have been made to a name. For this I recommend unassign or back quotes:

unassign( 'x' ); # here the single quotes are used to delay evaluation
x:

x := A;
x := `x`;  # but here back quotes are needed to assign the symbol x to the name x (thereby replacing any current value assigned to x)

I hope this provides some additional understanding,

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 24 25 26 27 28 29 30 Last Page 26 of 76