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

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/
Becky, What inputs are you going to supply to the procedure? What outputs do you expect? Numeric? Graphical? Animation? The answers to these questions will influence how you write the procedure. The procedure in Maple will be pretty robust, with lots of bells and whistles. It's pretty easy to see the exact code used in this procedure. Is this allowed? (If so, it could give you some ideas about how to write your simpler routine.) I just checked, the code for ApproximateInt in Student[Calculus1] is pretty complex. I would not look at it. But, the code for trapezoid in the student package is only 17 lines of Maple code. (This only does numerics, no graphics.) If you want to see this implementation, you can use:
showstat( student[trapezoid] );
Lines 1-9 check the arguments and prepare for the computations. Lines 12-16 make sure the integrand is a function of one variable and that the index is a name that is not already being used. The real computations are in lines 10, 11, and 17. That's it. These formulas are almost the same as what you will find in a textbook. My final suggestion for this reply is to use Maple to work a few specific problems. Then, as you see a general pattern to your work, use this as the basis for a procedure. Let us know if you are successful, or if you have more questions. 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/
Becky, What inputs are you going to supply to the procedure? What outputs do you expect? Numeric? Graphical? Animation? The answers to these questions will influence how you write the procedure. The procedure in Maple will be pretty robust, with lots of bells and whistles. It's pretty easy to see the exact code used in this procedure. Is this allowed? (If so, it could give you some ideas about how to write your simpler routine.) I just checked, the code for ApproximateInt in Student[Calculus1] is pretty complex. I would not look at it. But, the code for trapezoid in the student package is only 17 lines of Maple code. (This only does numerics, no graphics.) If you want to see this implementation, you can use:
showstat( student[trapezoid] );
Lines 1-9 check the arguments and prepare for the computations. Lines 12-16 make sure the integrand is a function of one variable and that the index is a name that is not already being used. The real computations are in lines 10, 11, and 17. That's it. These formulas are almost the same as what you will find in a textbook. My final suggestion for this reply is to use Maple to work a few specific problems. Then, as you see a general pattern to your work, use this as the basis for a procedure. Let us know if you are successful, or if you have more questions. 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 composing my previous response, you posted your new question. The answer to your question depends on exactly how you asked Maple to find a solution. I am going to assume you are using functions.
solve( f=0, x );
This returns no solution. Nothing. Nada. Just a new prompt. Include the (x) and you get the exact solutions.
solve( f(x)=0, x );
                         (1/3)                                 
  1  /             (1/2)\                    5              1  
- -- \2025 + 75 654     /      - -------------------------, -- 
  15                                                 (1/3)  30 
                                 /             (1/2)\          
                                 \2025 + 75 654     /          

                      (1/3)                              
  /             (1/2)\                     5             
  \2025 + 75 654     /      + ---------------------------
                                                    (1/3)
                                /             (1/2)\     
                              2 \2025 + 75 654     /     

                /                         (1/3)                            \  
     1    (1/2) |  1  /             (1/2)\                    5            |  
   + - I 3      |- -- \2025 + 75 654     /      + -------------------------|, 
     2          |  15                                                 (1/3)|  
                |                                 /             (1/2)\     |  
                \                                 \2025 + 75 654     /     /  

                         (1/3)                              
  1  /             (1/2)\                     5             
  -- \2025 + 75 654     /      + ---------------------------
  30                                                   (1/3)
                                   /             (1/2)\     
                                 2 \2025 + 75 654     /     

                /                         (1/3)                            \
     1    (1/2) |  1  /             (1/2)\                    5            |
   - - I 3      |- -- \2025 + 75 654     /      + -------------------------|
     2          |  15                                                 (1/3)|
                |                                 /             (1/2)\     |
                \                                 \2025 + 75 654     /     /
And, if you then make 0 into 0.0, you will see numerical solutions.
solve( f(x)=0.0, x );
 0.6848538719 + 0.6380238847 I, -1.369707744, 0.6848538719 - 0.6380238847 I
This was working with the original function. You would need to do something similar for the stationary (critical) points. I'll let you determine exactly what you should be doing. Awaiting your next question, 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 composing my previous response, you posted your new question. The answer to your question depends on exactly how you asked Maple to find a solution. I am going to assume you are using functions.
solve( f=0, x );
This returns no solution. Nothing. Nada. Just a new prompt. Include the (x) and you get the exact solutions.
solve( f(x)=0, x );
                         (1/3)                                 
  1  /             (1/2)\                    5              1  
- -- \2025 + 75 654     /      - -------------------------, -- 
  15                                                 (1/3)  30 
                                 /             (1/2)\          
                                 \2025 + 75 654     /          

                      (1/3)                              
  /             (1/2)\                     5             
  \2025 + 75 654     /      + ---------------------------
                                                    (1/3)
                                /             (1/2)\     
                              2 \2025 + 75 654     /     

                /                         (1/3)                            \  
     1    (1/2) |  1  /             (1/2)\                    5            |  
   + - I 3      |- -- \2025 + 75 654     /      + -------------------------|, 
     2          |  15                                                 (1/3)|  
                |                                 /             (1/2)\     |  
                \                                 \2025 + 75 654     /     /  

                         (1/3)                              
  1  /             (1/2)\                     5             
  -- \2025 + 75 654     /      + ---------------------------
  30                                                   (1/3)
                                   /             (1/2)\     
                                 2 \2025 + 75 654     /     

                /                         (1/3)                            \
     1    (1/2) |  1  /             (1/2)\                    5            |
   - - I 3      |- -- \2025 + 75 654     /      + -------------------------|
     2          |  15                                                 (1/3)|
                |                                 /             (1/2)\     |
                \                                 \2025 + 75 654     /     /
And, if you then make 0 into 0.0, you will see numerical solutions.
solve( f(x)=0.0, x );
 0.6848538719 + 0.6380238847 I, -1.369707744, 0.6848538719 - 0.6380238847 I
This was working with the original function. You would need to do something similar for the stationary (critical) points. I'll let you determine exactly what you should be doing. Awaiting your next question, 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/
Acer's response addresses the main problem. Let me add a little more that should help down the road. Maple gives you the choice to work with functions or expressions. It even allows you to mix the two. But, this is NOT advisable. In the original post, f is defined as a function, but the derivatives are defined as expressions. This is very likely to lead to dificulties later. For example, to find the roots and stationary (critical) points of your function you would need to use something like
solve( f(x)=0, x );   # must include (x)
solve( df=0, x );     # would be wrong to include (x)
Instead, I suggest choosing to work only one type: expressions or functions. Here is how you would find the derivatives in both cases.
# Functions
f:= x->((x^3-x+1+(6/30))/(x^2-1));
df := D(f);
d2f := (D@@2)(f);
d3f := (D@@3)(f);

# Expressions
f:= ((x^3-x+1+(6/30))/(x^2-1));
df := diff(f,x);
d2f := diff(f,x$2);
d3f := diff(f,x$3);
I hope this will be 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/
Acer's response addresses the main problem. Let me add a little more that should help down the road. Maple gives you the choice to work with functions or expressions. It even allows you to mix the two. But, this is NOT advisable. In the original post, f is defined as a function, but the derivatives are defined as expressions. This is very likely to lead to dificulties later. For example, to find the roots and stationary (critical) points of your function you would need to use something like
solve( f(x)=0, x );   # must include (x)
solve( df=0, x );     # would be wrong to include (x)
Instead, I suggest choosing to work only one type: expressions or functions. Here is how you would find the derivatives in both cases.
# Functions
f:= x->((x^3-x+1+(6/30))/(x^2-1));
df := D(f);
d2f := (D@@2)(f);
d3f := (D@@3)(f);

# Expressions
f:= ((x^3-x+1+(6/30))/(x^2-1));
df := diff(f,x);
d2f := diff(f,x$2);
d3f := diff(f,x$3);
I hope this will be 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/
JG, This works for me. The key is that the action is not applied until the cursor is moved outside the text area. To make matters even worse, it does not get applied if you move the cursor into the math container. But, if you click anywhere around this box, the action is applied. Here's the link to the worksheet I just uploaded. View 178_EmbeddedComponentExample.mw on MapleNet or Download 178_EmbeddedComponentExample.mw
View file 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/
Very interesting. This could really catch users by surprise. One way to get around the problem Maple has with the indices is to make the index variable a part of the definition of the function. So, define f to be a function of x and m (the index). Before I show you what I mean, you should be careful how you define functions in Maple. While Maple does recognize that many users will naturally try to define a function as you have, it is not optimal. (A popup message asking if this definition is meant as a function definition or remember table entry appears with each function definition in your worksheet.) The correct syntax defines a function as a mapping from its inputs to the output. Here is how I am suggesting that you can define the function f:
f := (x, m) -> Sum(A[m]*sin(m*Pi*x/L), m = 1 .. M);
Now, to integrate the square:
fsq  := f(x,r)*f(x,s);      # very unappealing, but it works
fsq1 := combine( fsq );     # combines the sums as desired
fsq2 := combine( fsq1 );    # combines products into single term
ifsq := int( fsq2, x );
Now, you probably want to work on the way each of these terms is reported. You can try all of the usual suspects:
simplify( ifsq );
expand( ifsq );
combine( ifsq );
None of these is really satisfying. Another approach is to grab the summand, to work on it separately, and to reinsert this into the sum.
t := op([1,1], ifsq );
t1 := factor( t );            # better, but
t2 := factor( expand( t ) );  # even better (to me)
ifsq2 := subsop( [1,1]=t2, ifsq );
Does this come close to fulfilling your request for a workaround? 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/
Very interesting. This could really catch users by surprise. One way to get around the problem Maple has with the indices is to make the index variable a part of the definition of the function. So, define f to be a function of x and m (the index). Before I show you what I mean, you should be careful how you define functions in Maple. While Maple does recognize that many users will naturally try to define a function as you have, it is not optimal. (A popup message asking if this definition is meant as a function definition or remember table entry appears with each function definition in your worksheet.) The correct syntax defines a function as a mapping from its inputs to the output. Here is how I am suggesting that you can define the function f:
f := (x, m) -> Sum(A[m]*sin(m*Pi*x/L), m = 1 .. M);
Now, to integrate the square:
fsq  := f(x,r)*f(x,s);      # very unappealing, but it works
fsq1 := combine( fsq );     # combines the sums as desired
fsq2 := combine( fsq1 );    # combines products into single term
ifsq := int( fsq2, x );
Now, you probably want to work on the way each of these terms is reported. You can try all of the usual suspects:
simplify( ifsq );
expand( ifsq );
combine( ifsq );
None of these is really satisfying. Another approach is to grab the summand, to work on it separately, and to reinsert this into the sum.
t := op([1,1], ifsq );
t1 := factor( t );            # better, but
t2 := factor( expand( t ) );  # even better (to me)
ifsq2 := subsop( [1,1]=t2, ifsq );
Does this come close to fulfilling your request for a workaround? 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/
Inserting hyperlinks is only half of the battle. To link to another place within a worksheet, you need to insert a bookmark. (There is a hyperlink to this help topic at the bottom of the hyperlink,insert help page, but very little is said about bookmarks.) To learn about bookmarks, see ?worksheet,documenting,bookmarks. Bookmarks and hyperlinks are inserted from the Format menu (not the Insert menu, as I would have expected). To `see' the bookmarks in a worksheet, you need to be sure to turn on viewing of markers (in the View menu). Bookmarks show up as yellow squares. Once you have the bookmarks created, it's pretty easy to setup the hyperlinks. 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 must admit that this surprised me as well. To see what is happening, consider the following:
select(has,NOTHING(y(t),t),y);
                                NOTHING(y(t))
select(has,NOTHING(y(t),t),y(t));
                                NOTHING(y(t))
has is being mapped to the arguments of NOTHING (or diff). The final result is the original function with the arguments that pass the boolean test. This is clearly not what you want. I'm pretty sure I've done something similar in the past, but I don't recall what I did to get around this. I would expect others who have dealt with this to chime in soon with additional ideas. 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/
Steve, Very interesting. I have confirmed your report (in Maple 11.01). I turned on infolevel[int] to see how the evaluations differed. The details have been uploaded and can be accessed at View 178_ExpectedHittingTime-details.mw on MapleNet or Download 178_ExpectedHittingTime-details.mw To summarize, both calls to int recognized the problem as fitting the same pattern:
int/cook/nogo1:
Given Integral
Int(1/t^(1/2)*exp(-1/2*a^2/t),t = 0 .. infinity)
Fits into this pattern:
Int(exp(-Ucplex*t^S1-U2*t^S2)*t^N*ln(B*t^DL)^M*cos(C1*t^R)/((A0+A1*t^D)^P),t = t1 .. t2)
Without any assumption, the next information reported is:
Definite integration: Can't determine if the integral is convergent.
Need to know the sign of --> 1/2*a^2
Will now try indefinite integration and then take limits.
After the assumption is made, the next information reported is:
int/cook/IIntd1:
--> But convergence criteria not met(?)
--> will try a limit
So, it looks as though convergence issues are being addressed, but something is not working correctly. Maybe someone with some more time can examine the 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/
Steve, Very interesting. I have confirmed your report (in Maple 11.01). I turned on infolevel[int] to see how the evaluations differed. The details have been uploaded and can be accessed at View 178_ExpectedHittingTime-details.mw on MapleNet or Download 178_ExpectedHittingTime-details.mw To summarize, both calls to int recognized the problem as fitting the same pattern:
int/cook/nogo1:
Given Integral
Int(1/t^(1/2)*exp(-1/2*a^2/t),t = 0 .. infinity)
Fits into this pattern:
Int(exp(-Ucplex*t^S1-U2*t^S2)*t^N*ln(B*t^DL)^M*cos(C1*t^R)/((A0+A1*t^D)^P),t = t1 .. t2)
Without any assumption, the next information reported is:
Definite integration: Can't determine if the integral is convergent.
Need to know the sign of --> 1/2*a^2
Will now try indefinite integration and then take limits.
After the assumption is made, the next information reported is:
int/cook/IIntd1:
--> But convergence criteria not met(?)
--> will try a limit
So, it looks as though convergence issues are being addressed, but something is not working correctly. Maybe someone with some more time can examine the 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/
If you are taking a Laplace transform, that's what you should letting Maple do for you. For example:
with( inttrans ):
ode := (1/R1+1/R2)*(diff(V2(t), t))
       -(diff(V1(t),t))/R1
       +(V2(t)-V1(t))/L
       +C*(diff(V2(t), t$2)) = 0:
eq := laplace( ode, t, s );

     s*laplace(V2(t), t, s)/R1-V2(0)/R1
     +s*laplace(V2(t), t, s)/R2-V2(0)/R2
     -s*laplace(V1(t), t, s)/R1+V1(0)/R1
     +laplace(V2(t), t, s)/L
     -laplace(V1(t), t, s)/L
     +C*s^2*laplace(V2(t), t, s)
     -C*(D(V2))(0)-C*s*V2(0) = 0

alias( v1=laplace(V1(t),t,s), v2=laplace(V2(t),t,s) ):
eq;

     s*v2/R1-V2(0)/R1+s*v2/R2-V2(0)/R2-s*v1/R1
     +V1(0)/R1+v2/L-v1/L+C*s^2*v2-C*(D(V2))(0)-C*s*V2(0) = 0

ic := [ V1(0)=A, V2(0)=B, D(V2)(0)=E ]:
eval( eq, ic );

     s*v2/R1-B/R1+s*v2/R2-B/R2-s*v1/R1
     +A/R1+v2/L-v1/L+C*s^2*v2-C*E-C*s*B = 0
Now, if you have another ODE (and IC) to complete the system, you should be able to solve for v1 and v2 in terms of the parameters and s. If you have numerical values for all of the parameters, the solution will depend only on s. It's possible this could be transformed back to the time domain (see ?invlaplace). Or, you could plot the transformed solutions in terms of s.
soln := solve( {eq,eq2}, {v1,v2} );
solnV1 := eval( soln, v1 );   # extract v1 from the solution
solnV2 := eval( soln, v2 );   # extract v2 from the solution
plot( [solnV1,solnV2], s=0..10 );
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/
First 57 58 59 60 61 62 63 Last Page 59 of 76