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 answers submitted by Doug Meade

Like this?

maplet2 := Maplet(
BoxLayout(
BoxColumn(
BoxRow(
Button( "Title ", width=150, Shutdown() )
),
BoxRow(
BoxColumn( Button( "Top East ", width=150, Shutdown() ),
Button( "Mid East ", width=150, Shutdown() ),
Button( "Bot East ", width=150, Shutdown() ) ),
BoxColumn( Button( "Top Center", width=150, Shutdown() ),
Button( "Mid Center", width=150, Shutdown() ),
Button( "Bot Center", width=150, Shutdown() ) ),
BoxColumn( Button( "Top West ", width=150, Shutdown() ),
Button( "Mid West ", width=150, Shutdown() ),
Button( "Bot West ", width=150, Shutdown() ) )
),
BoxRow(
Button( "Quit ", width=150, Shutdown() )
)
)
)
):
Maplets:-Display( maplet2 );

Notice that the BorderLayout is intended for laying out the border region of a maplet. I prefer to think of the maplet window as a table filled with cells - that do not have to be the same size (think merged cells in a spreadsheet). This then has to be broken down into columns and rows.

In your example I think of the maplet as a column of three elements: i) the title button, ii) the 3x3 grid of buttons and iii) the one button at the bottom. This is why the BoxLayout begins with a BoxColumn. The first and last are pretty simple, just a single button. The second one requires more thought. Keeping with the approach outlined above, I think of this entry as 3 columns of three buttons.

Maplet layout implementation is not the easiest thing to master. But, with practice - and trial and error - you should be able to make something attractive and appropriate for your needs.

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

No problem in Maple 15.01 under Windows.

I see that you do have a restart, but have you tried a complete reboot of Maple and/or your system?

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

Let me show you some other ways to sue the ideas introduced by Kitonum to solve this problem:

L1:=[seq(2*Pi*i/20,i=0..20)]:   # create L as a list (exact values)
L:=evalf(L1):                          # floating point approximations

K:=op(evalf([seq(-5*sin(L1[i]),i=1..21)])):
K1 := map( x->-5*sin(x), L1 ): # map a function onto the elements of the list L1
K2 := -5*sin~(L1): # the ~ tells Maple to apply the sin function to each element of the argument L1

Notice that I prefer to work with a list (with square brackets) not an expression sequence (no square brackets). If I ever want to remove the square brackets from a list I prefer to use, for example,

L[];

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

While Joe is correct about the parenthesis mismatch, I wonder if the solution is not to insert a right parenthesis after T[0]. Note that the numerator of this terms should probably be TS(t), not Ts(t).

Deleting the left parenthesis leaves you with a linear ODE, which Maple is quite happy to solve explicitly.

Inserting the right parenthesis where I suggest makes this a Bernoulli equation which is solvable - but not explicitly unless a specific value of s is known.

My real question is why you think you can't enter this equation in Maple 15. Is your Maple configured to use 2d input while your professor is using Maple notation? This has nothing to do with the different versions. Your default configuration settings can be edited by looking at the Options item under the Tools menu. You will probably want to pay particular attention to the Display tab.

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

Depending upon the exact way that the function f is defined, you could probably use something like:

solve( f(X)=Y, X )

If f is the solution to a differential equation, you might want to use the event handler that is provided within dsolve to help with your case. My suggestion is to take a look at the online help for solve and dsolve to see if you can find something similar to what you are trying to do.

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

Your question is not well-posed. Robert can tell you exactly how he found his ODE.

To illustrate what I am saying, consider the function y(x)=x. This function is a solution of each of the following ODEs:

y'=1

y' = y/x

y'' + xy' - y = 0

There is, of course, a second linearly independent solution to the second order ODE.

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 problem is an extra semi-colon in your code. You have:

The semi-colon at the end of the EqualEntries and before then is the problem. Remove it and the code gets further. Now it complains about the argument to member. I'll let you work on this before I suggest anything more.

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 am not going to provide all of the code for MapleTA, but here's some basic Maple code that should be helpful.

TEST := proc( ans::list )
  local ANS, CHECK;
  CHECK := X -> evalb( eval( eq, x=X ) );
  ANS := convert(ans,set);
  if nops(ANS)<>nops(ans) then
    return "incorrect, all of your answers must be different"
  end if;
  if nops(ANS)<>2 then
    return "incorrect, wrong number of solutions in response"
  end if;
  if `and`(map( CHECK, ANS )[]) then
    return "correct, both solutions are correct"
  else
    return "incorrect, at least one of your solutions is not correct"
  end if;
end proc;

Then, to show how this might be used:

eq := a*x^2=c*x;
                              2      
                           a x  = c x
ANS := [1,a,0,c/a];
                          [         c]
                          [1, a, 0, -]
                          [         a]
TEST( ANS );
       "incorrect, wrong number of solutions in response"
TEST( ANS[1] );
Error, invalid input: TEST expects its 1st argument, ans, to be of type list, but received 1
TEST( [ANS[1]] );
       "incorrect, wrong number of solutions in response"
TEST( ANS[1..2] );
   "incorrect, at least one of your solutions is not correct"
TEST( ANS[3..4] );
             "correct, both solutions are correct"
TEST( [0,a-a] );
       "incorrect, all of your answers must be different"

I hope this will be 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

What is the sum you are evaluating? From what you are describing, I wonder if Maple evaluates our infinite sum to 0 (integer) and then the evalf is, in effect, computing evalf(0).

To know if this is, in fact, happening, could you provide the specific sum you are using?

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

Checking if two expressions are equal is a difficult problem for Maple to solve. The "is" command is a good choice, but I'd still prefer to make a comparison to zero. Instead of checking if LHS=RHS I would check if simplify(LHS-RHS)=0.

Sometimes it might be advantageous to check if simplify(LHS/RHS-1)=0. You have to know a little about what your solution will look like before you decide exactly how you will proceed.

Giving us an idea about exactly what your terms look like will help us to suggest the most appropriate implementation for 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

You are trying to use xi[j+1] in the definition of theta[j]. But, xi[j+1] is not yet defined. Based on a quick glance at your code, I don't see any reason why you could not move the definition of xi[j] into the previous loop.

I doubt this the entire problem, but this would certainly prevent you from getting results that you expect.

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 problem is that xy is treated as a new variable and NOT as x*y.

If you are really committed to using 2-d input, the easiest way to fix this is to put a space between x and y in the denominator. (If one of your terms in the numerator had an exponent of 1, you'd need a space there as well.

Seeing the space, or its absence, in this short expression is not too hard. As your expressions become longer and more complicated, this can become quite a challenge. I would encourage you to get in the habit of using * to indicate multiplication.

I also feel compelled to comment that while the parentheses in the numerator are completely superflorous, you really should have used them in the denominator. If you typed the expression you entered into 1-d input (with a * for the multiplication)  you would get:

12*x^2*y^2/4*x*y;
                               3  3
                            3 x  y

You need either parentheses in the denominator, or to use division for each factor in the denominator:

12*x^2*y^2/4/x/y;
                             3 x y

12*x^2*y^2/(4*x*y);
                             3 x y

Note that the last form is what you will get from Maple if you convert the 2-d input to 1-d input.

While the implicit multiplication looks nice, it can really cause more problems than it's worth. Inserting the explicit operator (* or /) between each factor is just good communication.

I hope this has been 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

All you need to do is provide a value for CM. I also made another definition just to simplify the code a little. Here is what works for me:

CM := 4:
f := (100-p)*(1-exp((-1)*.11*t))/(10.00000000*exp((-1)*.11*t)+1):
Z := proc (t)
 if subs(p = 25, f) < CM and 0 < t then
  subs(p = 25, f)
 else
  subs(gamma = .1, p = 50, (-100+p)*(1-exp((-1)*.11*t))/((-1+gamma)*(10.00000000*exp((-1)*.11*t)+1)))
 end if
end proc:
plot( Z, -10..10 );

Note that I avoide writing Z(t) as this would not evaluate - because Maple does not know how to resolve the conditional unless t has a numeric value.

Does this help you overcome the problems you encountered?

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183 begin_of_the_skype_highlighting            (803) 777-6183      end_of_the_skype_highlighting         URL:    http://www.math.sc.edu

@Christopher2222 The oscillations and overshoots become more likely as the degree of the interpolating polynomial increases. One possibility to combat this effect is to use interpolating piecewise polynomials (often b-splines). Maple supports this.

Another option is to relax your search and not insist that the approximation interpolate the data. If you look for a best fitting curve it won't pass through most points, but overall it will reflect various general trends within the data set. You do appear to want quite a bit of turning throughout the interval, so this might not be so appropriate.

If you really know where your curve will have critical points and inflection points, these become additional constraints. While, in principle, these require higher-order polynomials, they often have other oscillations in addition to the ones prescribed and so might not be any better than what you are seing at present. I think I might be tempted to utilize piecewise cubic (or quartic) with additional constraints at the transition points between cubics to ensure that the overall curve is continuous and that an appropriate number of derivatives agree at the transition points.

I hope at least one of these ideas makes some sense to you, and that you are able to put these ideas to good use. Post again if you have more questions or encounter any problems.

Doug

The basic problem is that when you use friccion( x1q1(t), x2q1(t), 1 ) in your definition of dsys1, Maple cannot decide which branch in the body of friccion it needs to take. You want Maple to respond without evaluating this procedure.

What you need to do is add code that checks if the arguments are numeric. If not, then return the procedure unevaluated. If they are all numeric, proceed with your code.

I note that you should insert a local statement (local fs1, b1, fc1;) at the top of your procedure definition.

As I look at your definition, I see that you do not make any use of fs1, b1, or fc1. Are these supposed to enter into the final value returned?

As I was looking at your code, before I saw that there was no use of fs1, b1, and fc1, I thought you might be implementing a piecewise-defined function. If this is what you are doing, it might be easier to define friccion with the piecewise command. (See ?piecewise for help with this, if needed.)

I hope this has been 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
5 6 7 8 9 10 11 Last Page 7 of 44