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

I'm not sure exactly what you are trying to do.

You asked to have the curve begin at (0,-R1) instead of (-1,0). There are lots of ways to do this. Here's one:

S1:=unapply(u*FresnelS(u)+((1/Pi)*cos((1/2)*Pi*u^2))-(1/Pi),u);
C1:=unapply(u*FresnelC(u)-((1/Pi)*sin((1/2)*Pi*u^2)),u);
R1:=1;
u1:=evalf(sqrt(0.4));
E1:=evalf(Pi*R1*S1(u1)+R1);
D1:=evalf(Pi*R1*C1(u1));
with(plottools);
with(plots);
c1 := circle([D1, E1], R1);
a:=evalf(Pi*R1*u1);
p1:=plot([a*FresnelC(u),a*FresnelS(u)-R1*(1-u/u1),u=0..u1], color=blue):
display(p1,c1,scaling=constrained, axes=boxed);

Note that I made a couple modifications to your plotting commands. The main change, however, is the shift in starting point on the curve I call p1 (now plotted in blue).

The curve does start at the requested point. However, I don't know if has all the properties it's supposed to have? tangency to the circle?

If you can more clearly define your problem, there's a good chance someone can help to point you in the right direction.

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 problem is as I guessed. You have the do's in one document block, the body of the loop in several document blocks, and the end do's in more document blocks. You need to get everything in a single document block to have Maple understand everything as a complete loop.

One way to put more commands in the same document block is to use CTRL-ENTER to move to another line within the same document block.

Personally, I find the "document" mode difficult to use for this type of work. I prefer to use Maple's "worksheet" mode, with the red input prompts. The version of your code that I have uploaded is a "worksheet". You should not have any trouble opening it. It won't execute correctly; but neither did the code you uploaded. I have included a few comments to help you focus your attention.

View 178_take7.mw on MapleNet or Download 178_take7.mw
View file details

Note that in several places I replaced a set of 4 or 5 similar statements with a single seq or map command. I hope these are fairly obvious; if not ask - or consul the online help for ?seq and ?map .

After you've had a chance to look at this, please feel free to ask any questions that you have. I think we will be able to help you get to something workable.

One general suggestion. If any steps of the process can be carried out in general, do so - outside of the loop. Also, why do you ask for numeric integration in every integral? It appears to me that your integrals should be simple enough for Maple to be able to provide an exact answer.

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

It sounds as though you need to join execution groups or document blocks. The best way for us to help you at this point is for you to upload a worksheet / document and let us see exactly what you are doing.

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 think you want to be using the Jacobian command from the VectorCalculus package ( ?VectorCalculus,Jacobian ).

Doug

P.S. I duplicated my post just so this thread would be more complete.

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 think you want to be using the Jacobian command from the VectorCalculus package ( ?VectorCalculus,Jacobian ).

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 should also take a look at the RandomMatrix command in the LinearAlgebra package (see ?RandomMatrix).

with( LinearAlgebra ):
RandomMatrix( 2, 2, generator=0.0..1.0 );

Note that if you specify the generator as 0..1 your matrix will have only 0's and 1's; you need to specify at least one of these endpoints as a floating-point number.

If you want to use a completely different random number generator, then you would pass the function that implements your desired random number generator through the generator option.

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

Maple 13 introduced enhanced functionality for elementwise computations. This is what you are looking for, I believe.

Let's start with your original definitions:

crossArea:= 3.2 * 19.1;
force := array ([0., 1380.0, 2780.0, 5630.0]);
                                    61.12
                 [ 0., 1380.0, 2780.0, 5630.0 ]
You then computed:

engineeringStress := force/crossArea;
{0., 1380.0, 2780.0, 5630.0}/crossArea;
                             0.01636125654 force
                 0.01636125654 {0., 1380.0, 2780.0, 5630.0}

But, the division does not automatically get mapped elementwise to the entries in the array. To force this, use:

engineeringStress := force/~crossArea;
{0., 1380.0, 2780.0, 5630.0}/~crossArea;
                 [0., 22.57853403, 45.48429319, 92.11387435]
                 {0., 22.57853403, 45.48429319, 92.11387435}

Does this solve 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

Maple makes approximations only when explicitly asked. The primary way to force Maple to make an approximation is to use the evalf command ( ?evalf ).

sqrt(30);
                                     (1/2)
                                   30     
evalf(%);
                                 5.477225575

I whould also add that if you give Maple a floating-point number as input, then Maple will (in general) return a floating-point number as ouput. In your example:

sqrt(30.);
                                 5.477225575

Note the decimal point in the input.

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

The solution I am going to present might use some commands that you have not seen, viz. has ( ?has ). If this is the case, there are other parts of my solution that suggest ways the uses of has can be replaced with explicit references to the eigenvalues.

restart;
with( LinearAlgebra ):
to 10 do
  A := RandomMatrix( 2, 2, generator=-1..1 );
  E := Eigenvalues( A );
  if   has(E,I)              then print("spirals")
  elif has(E,0)              then print("isolated fixed point")
  elif simplify(E[1]*E[2])<0 then print("saddle point")
  elif simplify(E[1]*E[2])>0 then print("node")
                             else print("uh-oh, something's wrong")
  end if;
end do:
                           "isolated fixed point"
                                  "spirals"
                               "saddle point"
                               "saddle point"
                               "saddle point"
                           "isolated fixed point"
                           "isolated fixed point"
                                  "spirals"
                               "saddle point"
                               "saddle point"

You can also improve the output, possibly to include the eigenvalues. For this I would suggest using printf (on sprintf or nprintf); see ?printf .

For working with the complex eigenvalues, you could also find Re and Im (and evalc) of use; see ?evalc .

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

Maple has the do ... end do construct for creating loops, like this:

restart;
with( LinearAlgebra ):
to 10 do
  A := RandomMatrix( 2, 2, generator=-1..1 );
  Eigenvalues( A );
end do

It's more common to have the for and from clauses in the do statement, but they are not necessary in this case.

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

If your result is x[1] + x[2] + ... + x[n], I don't know what you can do to convert this into summation notation.

But, if you can work with the summation from the start, then Maple can probably report the result as a sum. I can't be certain about your situation until you give us more details. What, exactly, are you doing and what are you trying to obtain?

One thing  you should probably be aware of is the existence of both sum, Sum, and add. When you have a finite list of explicit numbers to add up, you use add. When you have a finite or infinite sequence of terms that you want to simplify, when possible, to a simpler object, you use sum. This might pertain to your situation. The Sum command is the "intert" version of sum; it does not attempt to do any simplifications on the terms in the sum. This is how you can be assured that your final result will be a sum.

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

Maple should be able to extract parts of an object or expression. However, as written, you do not have a valid Maple object.

While Maple is perfectly happy to work with equations, it does not like implicitly multiple equalities (more than 1 equal sign). If you have an equation, say,

eq:= A = B;
                                    A = B

Then you can do manipulations such as:

lhs(eq);
                                      A
rhs(eq);
                                      B
(lhs-rhs)(eq);
                                    A - B

If this does not, directly, answer your question, please give us some more details and let us see if we can help.

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 never asked a question, but are you looking for something like this? Note that it works for much more than identifying fractions.

identify( 0.11111 );
                                      1
                                      -
                                      9
identify( 1.414 );
                                    (1/2)
                                   2     
identify( 2.718 );
                                   exp(1)

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 all you want is to sort the inputs by their values from a function, here's another way to complete this task:

X := [3,4,-1,2,4]:
f := x -> x^2:
sort( X, (a,b)->f(a)<f(b) );
                              [-1, 2, 3, 4, 4]

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 not use a do loop to create the vector or matrix. I would use Maple's angle-bracket construction of vectors and matrices. Like this:

For a vertical vector, use commas to separate the rows:

V := < 1, 5, 10, 15, 20 >;

For a horizontal vector, use | to separate the columns:

H := < 1 | 5 | 10 | 15 | 20 >;

You could construct your matrix by entering all 16 entries (using commas and | to separate rows and columns).

M := < <1,2,3,4> | <3,6,9,12> | <9,18,27,36> | <27,54,81,108> >;

But, because of the nice structure of the matrix, there are other options that might be easier for you to use:

V2 := < ($1..4) >;              # note the shorthand for creating the sequence 1,2,3,4
< V2 | 3*V2 | 9*V2 | 27*V2 >;

or

H2 := Vector( 4, i->3^(i-1) );  # this creates the vector with entries 1, 3, 9, 27
V2 . H2;                        # note that the period (.) is used for matrix multiplication

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