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

 

What Axel is suggesting is that you look, closely, at the output from each of the commands executed when you call your procedure. You can do this by assigning values to the arguments in your procedure (f, N, a, b) and then executing each command from your procedure.

Another way to see (almost) the same information is to tell Maple to "trace" the execution of your procedure. You do this with the command:

trace( Simpson ):

Note that the trace command (?trace) must be executed after the procedure is defined. Now, Maple will show you the list of arguments and the result of each command within the procedure.

Simpson( cosh(x),4,-2,2 );
{--> enter Simpson, args = cosh(x), 4, 2, 2
                                      1
                              S + 4 cosh(x)(-1)
                      S + 4 cosh(x)(-1) + 4 cosh(x)(1)
                              T + 2 cosh(x)(0)
           1     4               4              1     2           
           - S + - cosh(x)(-1) + - cosh(x)(1) + - T + - cosh(x)(0)
           3     3               3              3     3           
<-- exit Simpson (now at top level) = (1/3)*S+(4/3)*(cosh(x))(-1)+(4/3)*(cosh(x))(1)+(1/3)*T+(2/3)*(cosh(x))(0)}
           1     4               4              1     2           
           - S + - cosh(x)(-1) + - cosh(x)(1) + - T + - cosh(x)(0)
           3     3               3              3     3           

To turn off tracing, execute:

untrace( Simpson ):

When you do this you will find that Maple expects the first argument to be a function, and you are providing an expression for the value of a function. Recall that a function is a rule that assigns an element of the domain to an element of the range. You can either change your calling sequence to provide a function or change the the code for Simpson to accept an expression. Which you choose is up to you.

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

 

 

What Axel is suggesting is that you look, closely, at the output from each of the commands executed when you call your procedure. You can do this by assigning values to the arguments in your procedure (f, N, a, b) and then executing each command from your procedure.

Another way to see (almost) the same information is to tell Maple to "trace" the execution of your procedure. You do this with the command:

trace( Simpson ):

Note that the trace command (?trace) must be executed after the procedure is defined. Now, Maple will show you the list of arguments and the result of each command within the procedure.

Simpson( cosh(x),4,-2,2 );
{--> enter Simpson, args = cosh(x), 4, 2, 2
                                      1
                              S + 4 cosh(x)(-1)
                      S + 4 cosh(x)(-1) + 4 cosh(x)(1)
                              T + 2 cosh(x)(0)
           1     4               4              1     2           
           - S + - cosh(x)(-1) + - cosh(x)(1) + - T + - cosh(x)(0)
           3     3               3              3     3           
<-- exit Simpson (now at top level) = (1/3)*S+(4/3)*(cosh(x))(-1)+(4/3)*(cosh(x))(1)+(1/3)*T+(2/3)*(cosh(x))(0)}
           1     4               4              1     2           
           - S + - cosh(x)(-1) + - cosh(x)(1) + - T + - cosh(x)(0)
           3     3               3              3     3           

To turn off tracing, execute:

untrace( Simpson ):

When you do this you will find that Maple expects the first argument to be a function, and you are providing an expression for the value of a function. Recall that a function is a rule that assigns an element of the domain to an element of the range. You can either change your calling sequence to provide a function or change the the code for Simpson to accept an expression. Which you choose is up to you.

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

 

I would do this with the pointplot command:

pointplot([D0,E0],symbol=solidcircle,symbolsize=18)

or, combined with your original circle generating plot:

c0 := display(circle([D0, E0], R0),pointplot([D0,E0],symbol=solidcircle,symbolsize=18));

Play with the symbol and symbolsize to get the exact affect you desire.

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 would do this with the pointplot command:

pointplot([D0,E0],symbol=solidcircle,symbolsize=18)

or, combined with your original circle generating plot:

c0 := display(circle([D0, E0], R0),pointplot([D0,E0],symbol=solidcircle,symbolsize=18));

Play with the symbol and symbolsize to get the exact affect you desire.

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

This student's response is fairly common. Unfortunately, I've heard my own students use it (not just with regards to Maple) and it's just not true - at least in my cases. I ALWAYS take special care to be certain that I have either given specific instructions on how to do something or given the students all of the tools they need to be able to figure out what needs to be done.

Too many students don't l ike the latter situation. But, from my perspective, it's this synthesis of knowledge that is, after all, the point of education.

I am not saying this student is not being truthful. I do have to admit that I have seen situations where instructors have not given their students what they need to complete a project. If they really have not been given the information needed to complete the assignment, their first stop should be the instructor - to see what help they are willing to provide. If that is not successful, then they should complain higher within their institution - course coordinator, undergraduate director, department chair, dean, ... .

We know nothing about this student, the instructor, the course, the assignment, ... .

I need to see more effort and input from the student before I offer any explicit information about solving this 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

This student's response is fairly common. Unfortunately, I've heard my own students use it (not just with regards to Maple) and it's just not true - at least in my cases. I ALWAYS take special care to be certain that I have either given specific instructions on how to do something or given the students all of the tools they need to be able to figure out what needs to be done.

Too many students don't l ike the latter situation. But, from my perspective, it's this synthesis of knowledge that is, after all, the point of education.

I am not saying this student is not being truthful. I do have to admit that I have seen situations where instructors have not given their students what they need to complete a project. If they really have not been given the information needed to complete the assignment, their first stop should be the instructor - to see what help they are willing to provide. If that is not successful, then they should complain higher within their institution - course coordinator, undergraduate director, department chair, dean, ... .

We know nothing about this student, the instructor, the course, the assignment, ... .

I need to see more effort and input from the student before I offer any explicit information about solving this 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

While I do not have access to an active Maple license right now, why don't you just use:

plot3d( [ sin(x*y), 0.5 ], x=-Pi..Pi, y=-Pi..Pi, axes=box );

Of course, if you really do want the surface and the plane plotted on different domains, then you will have to use 2 separate plot3d commands, or a fancier defintion of the plane that automatically truncates to the smaller domain.

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

While I do not have access to an active Maple license right now, why don't you just use:

plot3d( [ sin(x*y), 0.5 ], x=-Pi..Pi, y=-Pi..Pi, axes=box );

Of course, if you really do want the surface and the plane plotted on different domains, then you will have to use 2 separate plot3d commands, or a fancier defintion of the plane that automatically truncates to the smaller domain.

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 you shouldn't have placed your faith in Maple in the first place. (Maple's not going to help clean my house in preparation for Thanksgiving.)

What, exactly, are you trying to achieve?

Does this come any closer to what you are trying to achieve?

p := proc(A)
  while true do print(A) end do
end proc:
timelimit( 0.02, p(A) );

This prints A for 0.02 seconds (which is more than enough times to see the letter A scroll down the display).

You might also want to remember that the time command returns the CPU time. To get the actual elapsed time you would need to use time[real] (see ?time).

It sounds to me as though you want to let the user work for a set amount of time, 2 seconds in this case, and then cut off their ability to execute more commands. If this is the case, there might be other ways to achieve this.

Can you let us know the bigger picture in which your problem exists?

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 you shouldn't have placed your faith in Maple in the first place. (Maple's not going to help clean my house in preparation for Thanksgiving.)

What, exactly, are you trying to achieve?

Does this come any closer to what you are trying to achieve?

p := proc(A)
  while true do print(A) end do
end proc:
timelimit( 0.02, p(A) );

This prints A for 0.02 seconds (which is more than enough times to see the letter A scroll down the display).

You might also want to remember that the time command returns the CPU time. To get the actual elapsed time you would need to use time[real] (see ?time).

It sounds to me as though you want to let the user work for a set amount of time, 2 seconds in this case, and then cut off their ability to execute more commands. If this is the case, there might be other ways to achieve this.

Can you let us know the bigger picture in which your problem exists?

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

The correct definition of eta is:

eta:= (x,y) -> ( (D[1](u)(x,y))^2 + (D[2](v)(x,y))^2 )^n:

The two first partial derivatives of this function are:

D[1](eta);
                                          /                                 n   
                         n                |/             2                2\    
(x, y) -> ------------------------------- \\D[1](u)(x, y)  + D[2](v)(x, y) /   
                       2                2                                       
          D[1](u)(x, y)  + D[2](v)(x, y)                                        

                                                                       \
                                                                       |
  (2 D[1](u)(x, y) D[1, 1](u)(x, y) + 2 D[2](v)(x, y) D[1, 2](v)(x, y))/
D[2](eta);
                                          /                                 n   
                         n                |/             2                2\    
(x, y) -> ------------------------------- \\D[1](u)(x, y)  + D[2](v)(x, y) /   
                       2                2                                       
          D[1](u)(x, y)  + D[2](v)(x, y)                                        

                                                                       \
                                                                       |
  (2 D[1](u)(x, y) D[1, 2](u)(x, y) + 2 D[2](v)(x, y) D[2, 2](v)(x, y))/

You might prefer to have the denominator cancel with one power in the numerator, but that takes a little more work. You should be able to see the structure of these derivatives from these expressions. Higher partial derivatives can be obtained by changing the contents in the square brackets. Note, in particular, that Maple assumes that D[1,2](eta)=D[2,1](eta).

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

The correct definition of eta is:

eta:= (x,y) -> ( (D[1](u)(x,y))^2 + (D[2](v)(x,y))^2 )^n:

The two first partial derivatives of this function are:

D[1](eta);
                                          /                                 n   
                         n                |/             2                2\    
(x, y) -> ------------------------------- \\D[1](u)(x, y)  + D[2](v)(x, y) /   
                       2                2                                       
          D[1](u)(x, y)  + D[2](v)(x, y)                                        

                                                                       \
                                                                       |
  (2 D[1](u)(x, y) D[1, 1](u)(x, y) + 2 D[2](v)(x, y) D[1, 2](v)(x, y))/
D[2](eta);
                                          /                                 n   
                         n                |/             2                2\    
(x, y) -> ------------------------------- \\D[1](u)(x, y)  + D[2](v)(x, y) /   
                       2                2                                       
          D[1](u)(x, y)  + D[2](v)(x, y)                                        

                                                                       \
                                                                       |
  (2 D[1](u)(x, y) D[1, 2](u)(x, y) + 2 D[2](v)(x, y) D[2, 2](v)(x, y))/

You might prefer to have the denominator cancel with one power in the numerator, but that takes a little more work. You should be able to see the structure of these derivatives from these expressions. Higher partial derivatives can be obtained by changing the contents in the square brackets. Note, in particular, that Maple assumes that D[1,2](eta)=D[2,1](eta).

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

No.

Is it the same: sin(0):=sin(0)   and sin(0)='sin'(0)

The first, because of the :=, is an assignment for sin(0). In this case it doesn't really have an obvious affect because the right-hand side evaluates to 0 which is the value already assigned to sin(0). I think this is easier to see if you do something ridiculous, like the following:

restart;
sin(0):=2:
sin(0);
                                      2
D(cos)(0);
                                     -2

In this example I have assigned (see ?:=) the value 2 to sin(0). For the rest of this session, anytime Maple needs a value for sin(0) it will use 2, as illustrated by the command where I asked Maple for the value of the derivative of cosine evaluated at 0. We, of course, know this should be -sin(0) but Maple responds with -2 because we've told it that sin(0) has the value 2.

The second expression is an equation (note the =, not :=). The single quotes (see ?') tell Maple to delay the evalution of the sin function. I think it's easiest to understand this if we continue with the above session:

sin(0)='sin'(0);
                                 2 = sin(0)

Note that the left-hand side has been evaluated to 2 (the defined value for sin(0)) while the right-hand side has not been evaluated.

To conclude, I will point out that the single quotes delay only a single evaluation. If you now follow evaluate the previous result you will see that the sin on the right-hand side is evaluated:

%;
                                    2 = 2

I hope this answers your questions without raising too many more.

Don't forget to restart your Maple session before this crazy assignment affects other work that you might be doing!

restart;

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

No.

Is it the same: sin(0):=sin(0)   and sin(0)='sin'(0)

The first, because of the :=, is an assignment for sin(0). In this case it doesn't really have an obvious affect because the right-hand side evaluates to 0 which is the value already assigned to sin(0). I think this is easier to see if you do something ridiculous, like the following:

restart;
sin(0):=2:
sin(0);
                                      2
D(cos)(0);
                                     -2

In this example I have assigned (see ?:=) the value 2 to sin(0). For the rest of this session, anytime Maple needs a value for sin(0) it will use 2, as illustrated by the command where I asked Maple for the value of the derivative of cosine evaluated at 0. We, of course, know this should be -sin(0) but Maple responds with -2 because we've told it that sin(0) has the value 2.

The second expression is an equation (note the =, not :=). The single quotes (see ?') tell Maple to delay the evalution of the sin function. I think it's easiest to understand this if we continue with the above session:

sin(0)='sin'(0);
                                 2 = sin(0)

Note that the left-hand side has been evaluated to 2 (the defined value for sin(0)) while the right-hand side has not been evaluated.

To conclude, I will point out that the single quotes delay only a single evaluation. If you now follow evaluate the previous result you will see that the sin on the right-hand side is evaluated:

%;
                                    2 = 2

I hope this answers your questions without raising too many more.

Don't forget to restart your Maple session before this crazy assignment affects other work that you might be doing!

restart;

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

There is nothing wrong with Maple's response.  You have given 3 parameterizations of the same surface. Just using different names does not make the surface different. To see that you are really seeing all three surfaces, change the styles and colors used to prepare the three separate plots:

p1 := plot3d([x, y, sqrt(1-y^2)], x = -1 .. 1, y = -sqrt(1-x^2) .. sqrt(1-x^2), style=point, symbol=cross, color=red);
p2 := plot3d([z, x, sqrt(1-x^2)], z = -1 .. 1, x = -sqrt(1-z^2) .. sqrt(1-z^2), style=point, symbol=sphere, symbolsize=16, color=blue, transparency=0.5);
p3 := plot3d([y, z, sqrt(1-z^2)], y = -1 .. 1, z = -sqrt(1-y^2) .. sqrt(1-y^2), color=green, transparency=0.5);
plots:-display([p1, p2, p3], axes = boxed);

To obtain three sides of the complete Steinmetz surface, try:

p1 := plot3d([x, y, sqrt(1-y^2)], x = -1 .. 1, y = -sqrt(1-x^2) .. sqrt(1-x^2));
p2 := plot3d([x, sqrt(1-x^2), z], z = -1 .. 1, x = -sqrt(1-z^2) .. sqrt(1-z^2));
p3 := plot3d([sqrt(1-z^2), y, z], y = -1 .. 1, z = -sqrt(1-y^2) .. sqrt(1-y^2));
plots:-display([p1, p2, p3], axes = boxed);

I hope this explains what you were seeing.

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 14 15 16 17 18 19 20 Last Page 16 of 76