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

Your alpha is really 32 values. I don't know which one (or ones) you care most about.  Here are some ideas that might be helpful.

alpha:=RootOf(x^32+x^26+x^19+x^15+x^13+x^11+x^9+x^8+x^4+x+1);
       /  32     26     19     15     13     11     9     8     4         \
 RootOf\_Z   + _Z   + _Z   + _Z   + _Z   + _Z   + _Z  + _Z  + _Z  + _Z + 1/
alphaALL := [  allvalues(alpha) ]:
alphaALL[1], alphaALL[19];
       /  32     26     19     15     13     11     9     8     4           
 RootOf\_Z   + _Z   + _Z   + _Z   + _Z   + _Z   + _Z  + _Z  + _Z  + _Z + 1, 

            \        /
   index = 1/, RootOf\

     32     26     19     15     13     11     9     8     4           
   _Z   + _Z   + _Z   + _Z   + _Z   + _Z   + _Z  + _Z  + _Z  + _Z + 1, 

             \
   index = 19/

The floating-point approximations to these roots are:

alphaALLfloat := evalf~( alphaALL );
     [1.042177169 + 0.1816872722 I, 0.9203323319 + 0.3173616663 I, 

       0.9216694259 + 0.5043383993 I, 0.8168370352 + 0.6561671550 I, 

       0.6270108600 + 0.7675085996 I, 0.4121026803 + 0.8393388702 I, 

       0.3079682823 + 0.9904945564 I, 0.07402693576 + 1.027752284 I, 

       -0.1042446071 + 1.093552928 I, -0.3224677539 + 0.9252188645 I, 

       -0.5146193829 + 0.8445762806 I, -0.6528536264 + 0.7318967222 I, 

       -0.8881719119 + 0.5777608875 I, -0.6904711437 + 0.3730162080 I, 

       -0.9816123084 + 0.4074226858 I, -0.8987596402, -1.036608331, 

       -0.9816123084 - 0.4074226858 I, -0.6904711437 - 0.3730162080 I, 

       -0.8881719119 - 0.5777608875 I, -0.6528536264 - 0.7318967222 I, 

       -0.5146193829 - 0.8445762806 I, -0.3224677539 - 0.9252188645 I, 

       -0.1042446071 - 1.093552928 I, 0.07402693576 - 1.027752284 I, 

       0.3079682823 - 0.9904945564 I, 0.4121026803 - 0.8393388702 I, 

       0.6270108600 - 0.7675085996 I, 0.8168370352 - 0.6561671550 I, 

       0.9216694259 - 0.5043383993 I, 0.9203323319 - 0.3173616663 I, 

       1.042177169 - 0.1816872722 I]

Raising these to your huge power gives overflow:
alphaALLfloat^~12345678987654321;
[Float(infinity) + Float(infinity) I, 0. + 0. I, 

  Float(infinity) + Float(infinity) I, Float(infinity) + Float(infinity) I, 

  0. + 0. I, 0. + 0. I, Float(infinity) + Float(infinity) I, 

  Float(infinity) + Float(infinity) I, Float(infinity) + Float(infinity) I, 

  0. + 0. I, 0. + 0. I, 0. + 0. I, Float(infinity) + Float(infinity) I, 

  0. + 0. I, Float(infinity) + Float(infinity) I, 0., Float(infinity), 

  Float(infinity) + Float(infinity) I, 0., 

  Float(infinity) - Float(infinity) I, 0., 0., 0., 

  Float(infinity) + Float(infinity) I, -Float(infinity) + Float(infinity) I, 

  Float(infinity) - Float(infinity) I, 0., 0., 

  -Float(infinity) + Float(infinity) I, Float(infinity) - Float(infinity) I, 

  0., -Float(infinity) + Float(infinity) I]

If I leave off the last few digits from your exponent:

alphaALLfloat^~12345678987;
        [               301764090                 301764092    
        [-3.542804980 10          - 2.388594532 10          I, 

                        -143921968                 -143921968    
          1.474261556 10           - 4.989990393 10           I, 

                         264832606                 264832606    
          -3.864444295 10          + 2.955820065 10          I, 

                        250089837                 250089835    
          1.074840023 10          - 9.886034188 10          I, 

                         -48115641                 -48115642    
          -5.217392888 10          - 4.021729530 10          I, 

                        -360064213                 -360064214    
          1.193289089 10           - 3.242174975 10           I, 

                        196182509                 196182509    
          1.564766236 10          - 1.859043263 10          I, 

                        160643273                 160643273    
          1.808365073 10          - 1.103334567 10          I, 

                        503754876                 503754876    
          7.530154926 10          - 4.306488346 10          I, 

                        -109393832                 -109393830    
          6.742382891 10           - 2.756368054 10           I, 

                         -59246930                 -59246930    
          -3.347858245 10          - 1.953319699 10          I, 

                         -104162272                 -104162272    
          -2.229430293 10           - 4.034964034 10           I, 

                        310167184                 310167184    
          6.185982460 10          + 7.789551230 10          I, 

                         -1299356760                 -1299356761    
          -1.586172687 10            - 2.834912555 10            I, 

                         326591078                 326591078    
          -2.958401247 10          + 4.825840818 10          I, 

                        -572301707                192774010  
          5.464608726 10          , 1.381618936 10         , 

                         326591078                 326591078    
          -2.958401247 10          - 4.825840818 10          I, 

                         -1299356760                 -1299356761    
          -1.586172687 10            + 2.834912555 10            I, 

                        310167184                 310167184    
          6.185982460 10          - 7.789551230 10          I, 

                         -104162272                 -104162272    
          -2.229430293 10           + 4.034964034 10           I, 

                         -59246930                 -59246930    
          -3.347858245 10          + 1.953319699 10          I, 

                        -109393832                 -109393830    
          6.742382891 10           + 2.756368054 10           I, 

                        503754876                 503754876    
          7.530154926 10          + 4.306488346 10          I, 

                        160643273                 160643273    
          1.808365073 10          + 1.103334567 10          I, 

                        196182509                 196182509    
          1.564766236 10          + 1.859043263 10          I, 

                        -360064213                 -360064214    
          1.193289089 10           + 3.242174975 10           I, 

                         -48115641                 -48115642    
          -5.217392888 10          + 4.021729530 10          I, 

                        250089837                 250089835    
          1.074840023 10          + 9.886034188 10          I, 

                         264832606                 264832606    
          -3.864444295 10          - 2.955820065 10          I, 

                        -143921968                 -143921968    
          1.474261556 10           + 4.989990393 10           I, 

                         301764090                 301764092  ]
          -3.542804980 10          + 2.388594532 10          I]

I note that the same results can be obtained in a single command:

evalf~( [ allvalues(alpha) ]^~12345678987 );

I hope this is 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

 

Here's the output I got from Maple 13:

restart;
HARA := t->(alpha+delta*t)^(1-(beta)/(delta)):
0 < (beta)/(delta), (beta)/(delta) < 1:
0 < (alpha+delta*t);
                             0 < alpha + delta t

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

Axel's comments are right on target. If you want Maple to "do the trick" for  you, then you have to set the table properly for Maple. This includes avoiding floats (by using rationals) and, when floats are necessary, using a larger value of Digits.

One common misunderstanding is that the value of Digits is not the accuracy of the result. Rather, it's the number of digits used in floating point calculations. If you want to have 10 correct digits in an answer, it might be necessary to use a larger - sometimes much larger! - value for Digits.

Another suggestion is to use evalc to force Maple to write the expression in the form a+I*b.

The following might give you a little insight into what we're talking about.

evalc((exp(-(1-1/10^9)*I*Pi))^(1/2-8/100*I));  evalf(%);
evalc((exp(-I*Pi))^(1/2-8/100*I)); evalf(%);
evalc((exp(I*Pi))^(1/2-8/100*I)); evalf(%);
   /    /                  2                     2\                 \    /
   |1   |   /    1        \       /    1        \ |    999999999    |    |
exp|- ln|cos|---------- Pi|  + sin|---------- Pi| | - ----------- Pi| sin|
   \4   \   \1000000000   /       \1000000000   / /   12500000000   /    \
       /                  2                     2\                \        /  
  1    |   /    1        \       /    1        \ |       1        |        |1 
- -- ln|cos|---------- Pi|  + sin|---------- Pi| | + ---------- Pi| - I exp|- 
  25   \   \1000000000   /       \1000000000   / /   2000000000   /        \4 

    /                  2                     2\                 \    /     /
    |   /    1        \       /    1        \ |    999999999    |    |1    |
  ln|cos|---------- Pi|  + sin|---------- Pi| | - ----------- Pi| sin|-- ln|
    \   \1000000000   /       \1000000000   / /   12500000000   /    \25   \

                    2                     2\                \
     /    1        \       /    1        \ |   999999999    |
  cos|---------- Pi|  + sin|---------- Pi| | + ---------- Pi|
     \1000000000   /       \1000000000   / /   2000000000   /
                                    -9                 
                      1.221714614 10   - 0.7777676793 I
                                     /2    \
                                I exp|-- Pi|
                                     \25   /
                                1.285730980 I
                                     /2    \
                                I exp|-- Pi|
                                     \25   /
                                1.285730980 I

evalc((-5-2*I)*(exp(-(1-1/10^9)*I*Pi))^(1/2-8/100*I));  evalf(%);
evalc((-5-2*I)*(exp(-I*Pi))^(1/2-8/100*I)); evalf(%);
evalc((-5-2*I)*(exp(I*Pi))^(1/2-8/100*I)); evalf(%);
      /    /                  2                     2\                 \    /
      |1   |   /    1        \       /    1        \ |    999999999    |    |
-5 exp|- ln|cos|---------- Pi|  + sin|---------- Pi| | - ----------- Pi| sin|
      \4   \   \1000000000   /       \1000000000   / /   12500000000   /    \
       /                  2                     2\                \        /  
  1    |   /    1        \       /    1        \ |       1        |        |1 
- -- ln|cos|---------- Pi|  + sin|---------- Pi| | + ---------- Pi| - 2 exp|- 
  25   \   \1000000000   /       \1000000000   / /   2000000000   /        \4 

    /                  2                     2\                 \    /     /
    |   /    1        \       /    1        \ |    999999999    |    |1    |
  ln|cos|---------- Pi|  + sin|---------- Pi| | - ----------- Pi| sin|-- ln|
    \   \1000000000   /       \1000000000   / /   12500000000   /    \25   \

                    2                     2\                \     /
     /    1        \       /    1        \ |   999999999    |     |
  cos|---------- Pi|  + sin|---------- Pi| | + ---------- Pi| + I |
     \1000000000   /       \1000000000   / /   2000000000   /     \
      /    /                  2                     2\                 \    /
      |1   |   /    1        \       /    1        \ |    999999999    |    |
-2 exp|- ln|cos|---------- Pi|  + sin|---------- Pi| | - ----------- Pi| sin|
      \4   \   \1000000000   /       \1000000000   / /   12500000000   /    \
       /                  2                     2\                \        /  
  1    |   /    1        \       /    1        \ |       1        |        |1 
- -- ln|cos|---------- Pi|  + sin|---------- Pi| | + ---------- Pi| + 5 exp|- 
  25   \   \1000000000   /       \1000000000   / /   2000000000   /        \4 

    /                  2                     2\                 \    /     /
    |   /    1        \       /    1        \ |    999999999    |    |1    |
  ln|cos|---------- Pi|  + sin|---------- Pi| | - ----------- Pi| sin|-- ln|
    \   \1000000000   /       \1000000000   / /   12500000000   /    \25   \

                    2                     2\                \\
     /    1        \       /    1        \ |   999999999    ||
  cos|---------- Pi|  + sin|---------- Pi| | + ---------- Pi||
     \1000000000   /       \1000000000   / /   2000000000   //
                        -1.555535365 + 3.888838394 I
                             /2    \          /2    \
                        2 exp|-- Pi| - 5 I exp|-- Pi|
                             \25   /          \25   /
                         2.571461960 - 6.428654900 I
                             /2    \          /2    \
                        2 exp|-- Pi| - 5 I exp|-- Pi|
                             \25   /          \25   /
                         2.571461960 - 6.428654900 I

interface( rtablesize=30, prettyprint=1 ):
< seq( <k|evalf[k]((-5-2*I)*(exp(-(1-1/10^9)*I*Pi))^(1/2-8/100*I))>, k=1..20 ) >;
           [1                      -2. + 4. I                   ]
           [                                                    ]
           [2                     -1.6 + 3.9 I                  ]
           [                                                    ]
           [3                    -1.56 + 3.89 I                 ]
           [                                                    ]
           [4                   -1.556 + 3.889 I                ]
           [                                                    ]
           [5                  -1.5555 + 3.8888 I               ]
           [                                                    ]
           [6                 -1.55554 + 3.88884 I              ]
           [                                                    ]
           [7                -1.555535 + 3.888838 I             ]
           [                                                    ]
           [8               -1.5555354 + 3.8888384 I            ]
           [                                                    ]
           [9              -1.55553536 + 3.88883839 I           ]
           [                                                    ]
           [10            -1.555535365 + 3.888838395 I          ]
           [                                                    ]
           [11           -1.5555353648 + 3.8888383944 I         ]
           [                                                    ]
           [12          -1.55553536484 + 3.88883839439 I        ]
           [                                                    ]
           [13         -1.555535364843 + 3.888838394393 I       ]
           [                                                    ]
           [14        -1.5555353648431 + 3.8888383943929 I      ]
           [                                                    ]
           [15       -1.55553536484310 + 3.88883839439289 I     ]
           [                                                    ]
           [16      -1.555535364843100 + 3.888838394392888 I    ]
           [                                                    ]
           [17     -1.5555353648430998 + 3.8888383943928876 I   ]
           [                                                    ]
           [18    -1.55553536484309980 + 3.88883839439288759 I  ]
           [                                                    ]
           [19   -1.555535364843099798 + 3.888838394392887594 I ]
           [                                                    ]
           [20  -1.5555353648430997977 + 3.8888383943928875935 I]

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

Try

plot( 2*x^2-5*x-3, x=-2..5, style=points );

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

Try this:

plot( 2*x^2-5*x-3, x=-2..5 );

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 aren't asking one of us to do your homework are you?

As posted, I will not answer your question.

Do you know what "conservative"  means? If not, look at your book.

Do you know what it means for a function f to be a potential function of F?

Show us that you know the answers to these questions, and what you have done to answer the question. Then, it's much more likely that someone will feel compelled to help you move towards a complete answer to this 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

Try this variant of your syntax:

implicitplot(x=g(y), x=-10 .. 10, y=0 .. 10);

When you specify only the function name, how should Maple guess if you mean y=g(x), x=g(y), y=g(x^2), or something altogether different?

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 assume you are trying to show Euler's formula. If so, here's how I would work with what you have posted

s1 := series(sin(x), x, 6):
c1 := series(cos(x), x, 6):
e := exp(1):
e1 := series(e^x, x, 6):

Euler's formula says that exp(I*x)=cos(x)+I*sin(x). The LHS of this is

eval(e1,x=I*x);
                       1  2   1    3   1   4    1     5    /  6\
             1 + I x - - x  - - I x  + -- x  + --- I x  + O\-x /
                       2      6        24      120              

For the RHS you have to do something to convince Maple to combine the two series. Here are two approaches that I've used over the years.

series( c1+I*s1, x, 6 );
                       1  2   1    3   1   4    1     5    / 6\
             1 + I x - - x  - - I x  + -- x  + --- I x  + O\x /
                       2      6        24      120             
sort( expand(convert( c1 + I*s1, polynom )), x, ascending );
                           1  2   1    3   1   4    1     5
                 1 + I x - - x  - - I x  + -- x  + --- I x 
                           2      6        24      120     

The conversion to "polynom" effectively removes the order term from the series. (I've been known to do this right when I create the series.) The sort is needed to order the terms by degree (the default ordering for sort puts the terms in the opposite order). The first approach preserves the series nature of the expression, note that the order term is O(-x^6), not O(x^6). We know there is no difference, but Maple won't make this simplification for us.

I hope this brings you closer to what you are trying to do.

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'll guess that you got the "too many levels of recursion" because you didn't initialize "list" (to NULL, as in my example).

In most cases I now prefer to use the Generate command from the RandomTools package. Here's an example showing one way to do what you are trying to do.

face := [A,1,2,3,4,5,6,7,8,9,10,J,Q,K]:
suit := [Heart,Diamond,Club,Spade]:
deck := {seq(seq( [f,s], s=suit ), f=face )}:
Sim2 := proc( NumHands::posint, deck )
  local i, card1, card2, hands;
  uses RandomTools;

  hands := Array( 1..NumHands );
  for i from 1 to NumHands do
    card1 := Generate( choose( deck ) );
    card2 := Generate( choose( deck minus {card1} ) );
    hands[i] := [card1,card2]
  end do;
  return hands
end proc:
Sim2(10, deck);
[[[10, Spade], [2, Diamond]], [[5, Club], [1, Heart]], 

  [[1, Club], [K, Heart]], [[K, Diamond], [3, Club]], [[1, Spade], [Q, Club]], 

  [[Q, Club], [10, Heart]], [[Q, Club], [2, Club]], [[J, Heart], [2, Spade]], 

  [[J, Club], [Q, Club]], [[J, Diamond], [8, Heart]]]

You could make deck a global variable, or put its definition inside the proc, but I chose to pass it as an argument to the procedure. Also, instead of building the list one element at a time as in my example, note that it is more efficient to declare the size of the list.

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

Well,  you can't divide two matrices. You can divide their determinants, but you need to be careful about what you are really trying to do.

Here's one way to enter the two matrices:

with( LinearAlgebra ):
M1 := < < 40, 0, -20> | <-8,20,-6> | <0,-6,10> >;
                                   [ 40  -8   0]
                                   [           ]
                             M1 := [  0  20  -6]
                                   [           ]
                                   [-20  -6  10]
M2 := < <10,-8,0> | M1[1..-1,2..3] >;
                                   [10  -8   0]
                                   [          ]
                             M2 := [-8  20  -6]
                                   [          ]
                                   [ 0  -6  10]

Notice how I avoided the need to re-enter columns 2 and 3 of the second matrix.
Then, the ratio of their determinants is

Determinant(M1) / Determinant(M2);
                                     28
                                     --
                                     5 

This even agrees with the answer you expect.

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 piece of advice: let us see exactly what you have already done.

Maple's defaults prevent it from showing output from within many loops. That does not mean the object does not exist and cannot be used for other purposes. I'll illustrate with an example that creates an animation (sequence of plots).

Plist := NULL:
for k from 1 to 5 do
  Pnew := plot( x^k, x=-1..1 );
  Plist := Plist, Pnew;
end do:
plots:-display( Plist );

I must add that this is not an efficient way to create this list. But, I think it can be illustrative when getting started. I'm sure others will show you more efficient ways once we see exactly what you are trying to do, and how you are approaching the problem.

I hope this is of some use to you. If not, show us your code and I think we'll be able to point you in a reasonable 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 system of equations leaves a few questions. First, as  you've written them, they depend on a, A, alfa, P, and C2. I assume that a and A are the same variable. (You also mention a2, but I don't see where that appears in your equations. Is this a? If so, then my specific solutions will be meaningless, but the general approach is still correct.) Second, you've given only expressions, not equations; I assume you make these into equations by equating each expression to zero.

 

If these assumptions are correct, then you have:

EQ1:=0.9868421053+74479.54250*a^4-1.*alfa-33391.41112*P*a^3-.5000000000*C2*a^2=0;
EQ2:=2.9791817*10^5*a^3-0.4044127197e-1-1.001742334*10^5*P*a^2-1.*C2*a+0.4098048893e-1*a=0;
EQ3:=-2.003484667*10^5*P*a-0.3358800946e-2*a-1.*C2+8.937545100*10^5*a^2=0;
EQ4:=-2.003484667*10^5*P+0.1376453050e-3*a+0.1113310242e-4*a+0.1358341826e-3=0;
                                     4                            3
         0.9868421053 + 74479.54250 a  - 1. alfa - 33391.41112 P a 

                               2    
            - 0.5000000000 C2 a  = 0
                   5  3                                 5    2          
     2.979181700 10  a  - 0.04044127197 - 1.001742334 10  P a  - 1. C2 a

        + 0.04098048893 a = 0
                 5                                                5  2    
  -2.003484667 10  P a - 0.003358800946 a - 1. C2 + 8.937545100 10  a  = 0
                       5                                            
        -2.003484667 10  P + 0.0001487784074 a + 0.0001358341826 = 0

From here, Maple does not have to think too hard to find solutions:

solve( {EQ1,EQ2,EQ3,EQ4}, {a,alfa,P,C2} );
    /                                   
   { C2 = -7.394704137 + 12.87893418 I, 
    \                                   

                       -10                 -12    
     P = 6.795062889 10    + 2.619700571 10    I, 

     a = 0.002042369542 + 0.003527749771 I, 

                                             \    /                  
     alfa = 0.9868939398 + 0.00008879760094 I }, { C2 = 14.91234974, 
                                             /    \                  

                       -10                                          \    /
     P = 6.749563134 10   , a = -0.004084733333, alfa = 0.9867384331 }, { 
                                                                    /    \

     C2 = -7.394704137 - 12.87893418 I, 

                       -10                 -12    
     P = 6.795062889 10    - 2.619700571 10    I, 

     a = 0.002042369542 - 0.003527749771 I, 

                                             \ 
     alfa = 0.9868939398 - 0.00008879760094 I }
                                             / 

There are three solutions. The first and last are complex conjugates. The second has only P with a (very small) imaginary part.

Normally, I would say that the imaginary parts of order 10^(-12) are neglible and could be discarded. But, the real parts are only two orders of magnitude larger, so some more work will be necessary before I assume the imaginary parts can be ignored in this problem.

If you use fsolve instead of solve, then you find:

fsolve( {EQ1,EQ2,EQ3,EQ4}, {a,alfa,P,C2} );
       /                                    -10                       
      { C2 = 14.91234974, P = 6.749563134 10   , a = -0.004084733333, 
       \                                                              

                           \ 
        alfa = 0.9867384331 }
                           / 

This gives us more confidence that the imaginary parts returned by solve can, in fact, be ignored.

You'll have to decide if all three solutions are appropriate for your problem, or whether you want only the real-valued solution.

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

This is similar to some of the earlier suggestions, but I hope the presentation is a little cleaner:

X:=Vector(3,[sin(s)*cos(t),sin(s)*sin(t),cos(s)]);
                                 [sin(s) cos(t)]
                                 [             ]
                            X := [sin(s) sin(t)]
                                 [             ]
                                 [   cos(s)    ]
Xs:=diff~(X,s);
                                  [cos(s) cos(t)]
                                  [             ]
                            Xs := [cos(s) sin(t)]
                                  [             ]
                                  [   -sin(s)   ]
Xs.Xs;
  _____________                 _____________                    /_\       
  cos(s) cos(t) cos(s) cos(t) + cos(s) sin(t) cos(s) sin(t) + sin\s/ sin(s)
Xs.Xs assuming real;
                       2       2         2       2         2
                 cos(s)  cos(t)  + cos(s)  sin(t)  + sin(s) 
simplify( % );
                                      1

The key is that Maple assumes, by default, that s and t are complex-valued. There are several ways to override Maple's assumption; one is shown above.

Also take note of how I obtained the partial derivative of X with respect to s. The ~ tells Maple to apply the diff command elementwise to the vector X.

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 to do is plot the solution (or functions of the solution), then I recommend using the odeplot in the plots package.

In your example, you need to specify a value for R0 before Maple can find any numerical solution. I'll assume (for convenience) that R0=1 in my example.

with( plots ):
ode:=R(t)*diff(R(t),t,t)+(diff(R(t),t))^2-1/R(t)=0;
                                                 2           
                    / d  / d      \\   / d      \     1      
               R(t) |--- |--- R(t)|| + |--- R(t)|  - ---- = 0
                    \ dt \ dt     //   \ dt     /    R(t)    

ic := R(0)=R0, D(R)(0)=0;
                           R(0) = R0, D(R)(0) = 0

Sol:=dsolve( {ode,eval(ic,R0=1/10)}, numeric);
proc(x_rkf45)  ...  end proc;

odeplot( Sol, [t,1/R(t)], t=0..10 );

If you want to have a function that returns a value based on the solution of the initial value problem, then you could use either of the following ideas I'm about to demonstrate.

The numeric solution to the IVP is a function. Here's what it returns.

Sol(2);
    [                                     d                             ]
    [t = 2., R(t) = 2.52465414010761879, --- R(t) = 0.872244130850159616]
    [                                     dt                            ]

Here's one way to define your function S as the reciprocal of R(t)

S := t -> 1/rhs(Sol(t)[2]);
           1       
t -> --------------
     rhs(Sol(t)[2])
S(2);
                                0.3960938586

And here's another way to get the equivalent function. Note that I could not use t as the name of the independent variable as the solution to the IVP is reported in terms of t.

S2 := tt -> 1/eval( R(t), Sol(tt) );
               1         
tt -> -------------------
      eval(R(t), Sol(tt))
S2(2);
                                0.3960938586

I hope some of 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

Within Maple 13, the new elementwise operator (~, see ?elementwise ) can be very effective in these situations:

v:=<2,4,5,8,9> ;
                                       [2]
                                       [ ]
                                       [4]
                                       [ ]
                                  v := [5]
                                       [ ]
                                       [8]
                                       [ ]
                                       [9]
f := x -> Pi*x^2/4;
                                        1     2
                              f := x -> - Pi x 
                                        4      
f~(v);
                                   [ Pi  ]
                                   [     ]
                                   [4 Pi ]
                                   [     ]
                                   [25   ]
                                   [-- Pi]
                                   [4    ]
                                   [     ]
                                   [16 Pi]
                                   [     ]
                                   [81   ]
                                   [-- Pi]
                                   [4    ]
evalf(%);

                                [3.141592654]
                                [           ]
                                [12.56637062]
                                [           ]
                                [19.63495409]
                                [           ]
                                [50.26548246]
                                [           ]
                                [63.61725124]

Giorgios' approach works fine, too, but I wanted you to see that you have some options.

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 11 12 13 14 15 16 17 Last Page 13 of 44