## 3068 Reputation

19 years, 326 days

Doug

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

## more questions, and a few ideas...

What mathematical tools do you have at your disposal? Are you in calculus? If so, for each fixed value of h this is a straightforward area problem. The only complication is that you have to complete the task for a general value of h (and D). It might help you to try some special cases first?

For what values of h do you need an answer? All h < D? or h < D/2? or do you also need an answer for h>D? Do you see why these questions matter? Depending upon what you actually need to find, you might need to find different formulas for each of the different cases.

It appears that this is part of a homework assignment. As such, the process of determining how to answer this question is probably as important as the actual answer.  You need to go through this process for yourself.

Doug

```---------------------------------------------------------------------
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu
```

## adjust screen resolution or use Maplet,E...

Are you trying to enlarge the fonts in an existing (possibly built-in) maplet or are you trying to write your own maplet with different sized fonts?

If it's the former, then I am afraid your only option is to reduce the resolution on your monitor.

If it's the latter, then you will need to include explicit size information in each text element that you want to appear in a larger font. For this I encourage you to read the help page for ?Maplets,Elements,Font

If I had to guess, I'd say you are hoping to find a way to enlarge the fonts on a built-in Maplet. This is a feature that I've requested for many years. I'd be happy with a set of magnifying buttons on a toolbar (as in the regular Maple interface). Absent this feature it is very difficult to display a Maplet on a screen for a room of students. My only real solution for this is to reduce the resolution.

Good luck!

Doug

```---------------------------------------------------------------------
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu
```

## Parametric Surfaces...

If you really want the value of the function plotted along the first axis with V and E along the others,  you'll need to specify the surfaces parametrically:

`restart;K:=(V,E)->E*log(V):P:=(V,E)->E+V*log(V):plot3d( [[K(V,E),V,E],[P(V,E),V,E]], V=0..20, E=0..190, color=[red,blue], axes=boxed );`

` `

You can, in principle, obtain the same picture from the plot command in DJJerome1976's response if you specify the correct orientation. I'll let someone else determine the optimal angles to specify in the orientation= argument.

Maple's support for plotting parametric curves or surfaces is pretty good. I find it quite easy to create parametric curves or surfaces. See the online help for ?plot,parametric and ?plots,spacecurve

Doug

```---------------------------------------------------------------------
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu```

## How's this?...

This is simply a collection of linear and parabolic cuves with one sine curve for the level of the liquid in the cup.

Here are the specific commands I used to put this together:

`restart;with( plots ):P1a := plot( -4, x=-1..1 ):P1b := plot( -3.5-abs(x)/2, x=-1..-0.2 ):P1c := plot( -3.5-abs(x)/2, x=0.2..1 ):P2a := plot( [[-0.2,-3.6],[-0.2,-0.21]] ):P2b := plot( [[0.2,-3.6],[0.2,-0.21]] ):P4a := plot( x^2/4-0.2, x=-4..-0.2 ):P4b := plot( x^2/4-0.2, x=0.2..4 ):P5 := plot( x^2/4, x=-sqrt(15.2)..sqrt(15.2) ):P6a := plot( 3.8, x=-4..-sqrt(15.2) ):P6b := plot( 3.8, x=sqrt(15.2)..4 ):pts := sort( remove( has, [solve( x^2/4=sin(4*x)/8+3.5, x )], I ) );                  [-3.686429329, 3.778799790]P7 := plot( sin(4*x)/8+3.5, x=pts[1]..pts[2], color=blue ):display( [P1a,P1b,P1c,P2a,P2b,P4a,P4b,P5,P6a,P6b,P7], scaling=constrained, axes=none );`

Look at each piece individually, add insequence=true as an optional argument to the display command.

I hope this has been helpful.

Doug

```---------------------------------------------------------------------
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu```

## Reformatted equation and generic plot...

`eq2;                                              2                         exp(-k t) (v0 k + g)   g t   h k  + v0 k + g     z(t) = - -------------------- - --- + ---------------                        2             k           2                              k                         k        `

Here's my suggestion for putting the solution in the book's form:

`eval( collect(  simplify(   eval(    eq2, exp(-k*t)=1+A )   ),   {k,A}  ),  A=1-exp(-k*t));                /  v0   g \                        g t         z(t) = |- -- - --| (-exp(-k t) + 1) + h - ---                |  k     2|                         k                 \       k /                           `

Except for the fact that the first term appears last in the book, and the book puts the first factor of the first tem over a common denominator, this does the trick.

And, for the plot, here is what I suggest:

`V := unapply( eval( rhs(diff(eq2,t)), [g=1,k=1,h=0] ), v0 ):plot( [V(-2), V(-1), V(-1/2), V(0)], t=0..4,      tickmarks=[0,[-2="|v0|>|vt|",-1="-g/k",-1/2="|v0|<|vt|",0="v0=0"]] );`

The key is to give generic values for the parameters, I chose g=k=1 (h does not appear in the velocity). The specific curves that are plotted do correspond to specific values of v0, but those do not have to appear in the labels. You can see how I used the specific knowledge of g and k to determine where to put the labels for each curve. If you spend some time reading the online help for plot,options (and related topics) you could do even better.

Doug

```---------------------------------------------------------------------
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu```

## plotting a piecewise-defined function...

What you have is a piecewise-defined function. B is defined by one rule for 0<alpha<0.8*alpha0 and by a second rule for 0.8*alpha0<alpha<alphad. Here is how I would do this in Maple:

`beta := 0.25;alpha0 := 0.2580;alphad := 0.545;Bmax := 0.7;B1 := (1-beta-beta*cos(Pi*alpha/(0.8*alpha0)))*Bmax;B2 := Bmax;B := piecewise( alpha<0.8*alpha0, B1, B2 );plot( B, alpha=0..alphad );`

Doug

```---------------------------------------------------------------------
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu```

## use the LinearAlgebra package...

Did you look at the value of aFront?

The RandomMatrix command is defined in the LinearAlgebra, which you never load. Once you do load the LinearAlgebra package, the rest of your code works fine. Of course, other than the visual output (which you have suppressed) your for loop can be replaced with one command: Quad2 := swaprow(aFront,3,5);

Maybe you meant this?

`with( LinearAlgebra ):aFront := RandomMatrix( 9 );for m from 1 to 3 do  aFront := RowOperation( aFront, [m, m+2] );end do;`

Note that, in general, you should use the LinearAlgebra package; the linalg package has become obsolete.

Doug

```---------------------------------------------------------------------
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu```

## solve, then remove I...

There are a variety of ways to achieve this. Usually, I'll let Maple give me all of the solutions it can find and then I'll massage the result to remove all complex-valued solutions.

For example:

`S := [solve( x^3+x+1=0, x )]:remove( has, S, I );    [                      (1/3)                          ]    [  1 /           (1/2)\                   2           ]    [- - \108 + 12 93     /      + -----------------------]    [  6                                             (1/3)]    [                              /           (1/2)\     ]    [                              \108 + 12 93     /     ]`

The same approach should work for a system of two equations.

If you need more help, it would help if we could know more about the equations you are trying to solve.

Doug

```---------------------------------------------------------------------
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu```

## Adri's solution is probably the most eff...

Adri's solution is probably the most efficient way to define your matrix.

You asked how to do this with for loops. Here is how that would look:

`A := Matrix(12,12):for i from 1 to 12 do  for j from 1 to 12 do    A[i,j] := (i-1)^(j-1)  end doend do;`

I hope this is helpful to show you how much better the one-line solution is. In general, with Maple you need to release some of the traditional programming ideas and replace them with more mathematical ideas.

Doug

```---------------------------------------------------------------------
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu
```

## Reformulate x=b/a as b=a*x...

Well, if you want to have x=b/a, then b=a*x. So, in principle you have F(x)=f(a,a*x) - after simplification (with the implicit assumption that a is positive). In Maple this would be done with

`f := (a,b) -> 16*b^2/(a+sqrt(a^2+8*b^2));                     2                        16 b        (a, b) -> -------------------                  / 2      2\          a + sqrt\a  + 8 b /`
`F := unapply( simplify( f(a,a*x) ), x ) assuming positive;                 2                 16 a x       x -> -------------------                   (1/2)         /       2\          1 + \1 + 8 x /     `

If you want to allow a to be zero or negative, then change positive to real.

Doug

```---------------------------------------------------------------------
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu```

Try this:

`for k from 2 to 21 do  Ct[k] := add( A[k-i]*P[i], i=1..k-1 );end do;`

Doug

```---------------------------------------------------------------------
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu```

## arrows=none...

Your post does not make any mention of the animations of the direction field. All I see is a request for a plot of the solution in phase space. If I read this correctly,  here is how I would do that:

`DEtools[DEplot] ([diff(x(t), t) = 2*x(t)*(1-0.1e-3*x(t))-0.1e-1*x(t)*y(t),                  diff(y(t), t) = -.5*y(t)+0.1e-3*x(t)*y(t)], [x(t), y(t)],                 t=0 .. 10, x = 0 .. 11500, y = 0 .. 200,                 [[x(0) = 1000, y(0) = 200]],                # [[1, .5, .5], [0, 1.2, 1.1]],                # animatecurves = true, animatefield = true,                # arrows = comet,                 arrows = none,                 axes = boxed, numpoints = 121);`

The key is replacing arrows=comet with arrows=none.

If you want the solution animated, include animatecurves=true.

I hope this is what you want.

Doug

```---------------------------------------------------------------------
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu```

## not reproduced...

I do not see this problem when I try your commands. I am using Maple 16 under Windows.

Doug

```---------------------------------------------------------------------
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu
```

## working with sum...

Why do you say the result is the same expression. I think it's pretty clear that V+V2 is different from both V and V2. If you want to do something with this sum you have to assign it to a name. For example,

`V3 := V+V2;`

If this is not what you are requesting, please ask again with more details.

Doug

```---------------------------------------------------------------------
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu
```

## Maplet presentation of results of a func...

`restart;with(Maplets[Elements]):inte2 := proc () local i, p, n, eo; n := Maplets:-Tools:-Get('n'::posint); p := n; for i from n-2 by -2 to 2 do  p := p*i end do; if n mod 2 = 0 then eo:="even" else eo:="odd" end if; return( nprintf("the doublefactorial of %d is %d, which is %s ", n, p, eo) );end proc:maplet1 := Maplet( [  # Main Column  [ # Row 1    "n = ", TextField['n']( 30 ),    Button( "Compute",      Action(        Evaluate( 'result' = 'inte2' )      )    )  ],  [ # Row 2    TextBox['result'](height=3)  ],  [ # Row 3    Button( "Clear",      Action(        SetOption( 'n' = "" ),        SetOption( 'result' = "" )       )    ),    Button( "OK", Shutdown( ['result'] ) ),    Button( "Cancel", Shutdown() )  ] ]):Maplets[Display]( maplet1 );`

I note that I did not start from scratch. I found the integration example maplet and modified it to suit this situation.

You can modify the layout, appearance, and functionality to suit your needs, but I believe this shows what is going on. The only comment I'll make is that the nested square brackets delimit rows and columns. This maplet consists of one column with 3 rows (each with a different number of elements).

```---------------------------------------------------------------------