gulliet

281 Reputation

7 Badges

19 years, 305 days

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by gulliet

Higher level functions such as map should do what you are looking for. For instance,
> eqn := [seq(i, i = 1 .. 5)];

                               [1, 2, 3, 4, 5]

> map(proc (x) options operator, arrow; x^2-2 end proc, eqn);

                             [-1, 2, 7, 14, 23]
Regards, -- Jean-Marc
You could convert the Vector into a Matrix, then use DeleteRow, and convert the result into a Vector again. Here is an example (though I am sure that there exists a clever way but cannot find it at the moment)
    |\^/|     Maple 13 (APPLE UNIVERSAL OSX)
._|\|   |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2009
 \  MAPLE  /  All rights reserved. Maple is a trademark of
 <____ ____>  Waterloo Maple Inc.
      |       Type ? for help.
> A := Vector([2, 10, 5, 7]);
                                        [ 2]
                                        [  ]
                                        [10]
                                   A := [  ]
                                        [ 5]
                                        [  ]
                                        [ 7]

> deleteElement := proc (vec, n) convert\                                      
> (LinearAlgebra:-DeleteRow(convert(vec, Matrix), n), Vector) end proc:
> deleteElement(A, 2);
                                      [2]
                                      [ ]
                                      [5]
                                      [ ]
                                      [7]

> 

Regards, -- Jean-Marc
Hum, no error message on my system: what version do you use? restart; kernelopts(version); Digits := 10; t := .335; r1 := .47066796; r2 := .791898; r3 := 1.12193314; r4 := 1.45162704; b1 := r1/r2; b2 := r2/r3; b3 := r3/r4; sys := diff(f1(x), x, x)-f1(x)+f2(x) = 0, diff(f2(x), x, x)-f2(x)+f3(x)+b1*(f1(x)-f2(x)) = 0, diff(f4(x), x, x)+b3*(f3(x)-f4(x)) = 0, diff(f3(x), x, x)-f3(x)+f4(x)+b2*(f2(x)-f3(x)) = 0; ics := f1(0) = 0, f2(0) = 0, f3(0) = 0, f4(0) = (r1+r2+r3+r4)/r4; sol := dsolve([sys, ics]); dsolve([sys]);
       Maple 13.00, APPLE UNIVERSAL OSX, Apr 13 2009, Build ID 397624

                                     10
                                    0.335
                                 0.47066796
                                  0.791898
                                 1.12193314
                                 1.45162704
                                0.5943542729
                                0.7058335045
                                0.7728797474

 / d  / d       \\                      
 |--- |--- f1(x)|| - f1(x) + f2(x) = 0, 
 \ dx \ dx      //                      

   / d  / d       \\                                                       
   |--- |--- f2(x)|| - 1.594354273 f2(x) + f3(x) + 0.5943542729 f1(x) = 0, 
   \ dx \ dx      //                                                       

   / d  / d       \\                                                
   |--- |--- f4(x)|| + 0.7728797474 f3(x) - 0.7728797474 f4(x) = 0, 
   \ dx \ dx      //                                                

   / d  / d       \\                                                     
   |--- |--- f3(x)|| - 1.705833504 f3(x) + f4(x) + 0.7058335045 f2(x) = 0
   \ dx \ dx      //                                                     

            f1(0) = 0, f2(0) = 0, f3(0) = 0, f4(0) = 2.642638938
f1(x) = _C1*exp(-(1/10)*sqrt(10)*sqrt(RootOf(-518574111987816111-412912333946479961432657697*_Z+113599237987332658153125000*_Z^2-7926668006875000000000000*_Z^3+156250000000000000000000*_Z^4, index = 4))*x)+_C2*exp((1/10)*sqrt(10)*sqrt(RootOf(-518574111987816111-412912333946479961432657697*_Z+113599237987332658153125000*_Z^2-7926668006875000000000000*_Z^3+156250000000000000000000*_Z^4, index = 4))*x)+_C3*exp(-(1/10)*sqrt(10)*sqrt(RootOf(-518574111987816111-412912333946479961432657697*_Z+113599237987332658153125000*_Z^2-7926668006875000000000000*_Z^3+156250000000000000000000*_Z^4, index = 3))*x) [... rest of the output deleted ...] Regards, -- Jean-Marc
One can pass initial / boundary conditions to dsolve by writing its first argument as a list of odes and conditions, as illustrated below: sys := diff(f1(x), x, x)-f1(x)+f2(x) = 0, diff(f2(x), x, x)-f2(x)+f3(x)+b1*(f1(x)-f2(x)) = 0, diff(f4(x), x, x)+b3*(f3(x)-f4(x)) = 0, diff(f3(x), x, x)-f3(x)+f4(x)+b2*(f2(x)-f3(x)) = 0; ics := f1(0) = 0, f2(0) = 0, f3(0) = 0, f4(0) = (r1+r2+r3+r4)/r4; sol := dsolve([sys, ics]); dsolve([sys]) Hope this helps, -- Jean-Marc
I believe that what you are looking for is something along the line:
> restart; eqn := [];    # create an empty list

> for i to 5 do eqn := [op(eqn), i] end do;

                                     [1]
                                   [1, 2]
                                  [1, 2, 3]
                                [1, 2, 3, 4]
                               [1, 2, 3, 4, 5]

> eqn;

                               [1, 2, 3, 4, 5]

> eqn[3];

                                      3

The [] operator creates a list. The op() command extracts the content of the list. The assignment operator is := in Maple syntax (a single equal sign = just test for equality). Therefore eqn := [op(eqn), i] assigns a new value to eqn thant is a list made of the previous value(s) of eqn to which we concatenate the value of i. Hope this helps, -- Jean-Marc

A good thing to do might be to visualize the function to determine suitable ranges of integration. For instance, > plots:-implicitplot3d(Vd(eta, xi) = 0.162e-1, eta = -10 .. 10, xi = -10 .. 10, kp = -10 .. 10, axes = boxed, grid = [25, 25, 25]);

 

 

Hope this helps, -- Jean-Marc

First, note that it would be easier to answer properly your question if you could provide to the readers of this forum either the incriminated function or an example of a similar, possibly simpler, function. Having said that, it is not clear, at least to me, wether the issues are about Maple syntax or commands, or mathematics technics. For the former, you should show Maple expressions you used and the output returned by Maple. For the latter, the following article Arclength, Surface Area and Volume might help you started. Hopes this help (and that I have not been to far off of what you were looking for). Cheers, -- Jean-Marc
> pr := combinat:-cartprod([[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6]]);

> while `not`(pr[finished]) do pr[nextvalue]() end do;

                                   [1, 1]
                                   [1, 2]
                                   [1, 3]
                                   [1, 4]
                                   [1, 5]
                                   [1, 6]
                                   [2, 1]
                                   [2, 2]
                                   [2, 3]
                                   [2, 4]
                                   [2, 5]
                                   [2, 6]
                                   [3, 1]
                                   [3, 2]
                                   [3, 3]
                                   [3, 4]
                                   [3, 5]
                                   [3, 6]
                                   [4, 1]
                                   [4, 2]
                                   [4, 3]
                                   [4, 4]
                                   [4, 5]
                                   [4, 6]
                                   [5, 1]
                                   [5, 2]
                                   [5, 3]
                                   [5, 4]
                                   [5, 5]
                                   [5, 6]
                                   [6, 1]
                                   [6, 2]
                                   [6, 3]
                                   [6, 4]
                                   [6, 5]
                                   [6, 6]
> help("cartprod");

> help("Cartesianproduct,Definition");
Hope this helps, -- Jean-Marc
i.e. in your case
6! / (6 - 2)! = 1 x 2 x 3 x 4 x 5 x 6 / (1 x 2 x 3 x 4) 
                  = 5 x 6 
                  = 30
See help("permutation,Definition") for more info. Cheers, -- Jean-Marc
Just to be sure we are talking about the same thing, here is the solution to the system I get w/ Maple 13:
> restart;
> eq1 := diff(w(t), `$`(t, 4))-A*(diff(v(t), `$`(t, 3)))+B*w(t) = 0;
    / d  / d  / d  / d      \\\\     / d  / d  / d      \\\             
    |--- |--- |--- |--- w(t)|||| - A |--- |--- |--- v(t)||| + B w(t) = 0
    \ dt \ dt \ dt \ dt     ////     \ dt \ dt \ dt     ///             

> eq2 := -(diff(v(t), `$`(t, 4)))-A*(diff(w(t), `$`(t, 3)))+B*v(t) = 0;
     / d  / d  / d  / d      \\\\     / d  / d  / d      \\\             
    -|--- |--- |--- |--- v(t)|||| - A |--- |--- |--- w(t)||| + B v(t) = 0
     \ dt \ dt \ dt \ dt     ////     \ dt \ dt \ dt     ///             
> sys := [eq1, eq2];
  [/ d  / d  / d  / d      \\\\     / d  / d  / d      \\\               
  [|--- |--- |--- |--- w(t)|||| - A |--- |--- |--- v(t)||| + B w(t) = 0, 
  [\ dt \ dt \ dt \ dt     ////     \ dt \ dt \ dt     ///               

     / d  / d  / d  / d      \\\\     / d  / d  / d      \\\             ]
    -|--- |--- |--- |--- v(t)|||| - A |--- |--- |--- w(t)||| + B v(t) = 0]
     \ dt \ dt \ dt \ dt     ////     \ dt \ dt \ dt     ///             ]
> sol := dsolve(sys);
 /         8                                                                
 |       -----                                                              
 |        \                                                                 
<          )      /      /  2    2   6     8            \  \                
 |v(t) =  /    exp\RootOf\-B  + A  _Z  + _Z , index = _a/ t/ _C[_a], w(t) = 
 |       -----                                                              
 \       _a = 1                                                             

      /   /  8                                                      
      |   |-----                                                    
      |   | \                                          3            
   1  | 2 |  )         /  2    2   6     8            \     /      /
  --- |A  | /    RootOf\-B  + A  _Z  + _Z , index = _a/  exp\RootOf\
  A B |   |-----                                                    
      \   \_a = 1                                                   

                                           \   /  8   
                                           |   |----- 
                                           |   | \    
    2    2   6     8            \  \       |   |  )   
  -B  + A  _Z  + _Z , index = _a/ t/ _C[_a]| + | /    
                                           |   |----- 
                                           /   \_a = 1

                                        5                                
        /  2    2   6     8            \     /      /  2    2   6     8  
  RootOf\-B  + A  _Z  + _Z , index = _a/  exp\RootOf\-B  + A  _Z  + _Z , 

                       \     /  8                                              
                       |     |-----                                            
                       |     | \                                               
            \  \       |     |  )         /  2    2   6     8            \    /
  index = _a/ t/ _C[_a]| - B | /    RootOf\-B  + A  _Z  + _Z , index = _a/ exp\
                       |     |-----                                            
                       /     \_a = 1                                           

                                                  \\\ 
                                                  ||| 
                                                  ||| 
        /  2    2   6     8            \  \       || >
  RootOf\-B  + A  _Z  + _Z , index = _a/ t/ _C[_a]||| 
                                                  ||| 
                                                  /// 
> odetest(value(sol), sys);
                                   [0, 0]

Did you get the same solution (sum of exponentials)? What form did you expect? Cheers, --JM
Use plot:-display to combine plots, as illustrated below:
> restart;
> L := [seq(i, i = 1 .. 20)];
   [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
> w := [seq(i, i = 23 .. 42)];
[23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42

  ]
> 
> f := CurveFitting:-LeastSquares(L, w, x);
                                   22 + x
> p1 := plot(f, x = L[1] .. L[-1]);
> p2 := Statistics:-ScatterPlot(L, w);
> plots:-display(p1, p2);

97_curvefittingplotwithdatapoints.jpg HTH, -- Jean-Marc
> restart; > RootFinding:-Analytic((1/20)*x^2-10*x-15*cos(x+15), x, re = -1000 .. 1000, im = -1 .. 1); 1.27409207502708, -1.80895918513793 - 0.959196521549030 I, -1.80895918513793 + 0.959196521549025 I, 200.119378915794 HTH, -- Jean-Marc
Following Robert Israel's hints and suggestion about the d1 expression, we can see that the plot contains d2 only.
> restart;
> d1 := sec(I*(x^2-2))*(exp(I*x)*sin(2*x)+cos(I*(2*x-3)));

                  / 2    \                                    
              sech\x  - 2/ (exp(I x) sin(2 x) + cosh(2 x - 3))

> d2 := 1/2;
                                      1
                                      -
                                      2
> plot([d1, d2], x = -5 .. 5); Warning, unable to evaluate 1 of the 2 functions to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct Note that you can look for the zeroes of d1-d2 thanks to the function RootFinding:-Analytic and you can also get plot of the complex expression with plots:-complexplot.
> RootFinding:-Analytic(d1-d2, x, re = -4 .. 4, im = -10 .. 10);

                 0.692769566066800 + 0.716998844038150 I, 

                   0.233941585379303 - 0.856174437455665 I, 

                   2.02176105726006 + 1.30134684099697 I

> plots:-complexplot(d1, x = -10 .. 10);
HTH, -- Jean-Marc
According to the online documentation for ?fsolve, "For a general equation or system of equations, the fsolve command computes a single real root." Regards, --Jean-Marc

For instance, the function Analytic can search over a complex interval to find roots. > RootFinding:-Analytic(cos(z), z, re = 0 .. 3*Pi, im = -1 .. 1); 4.71238898038469, 1.57079632679490, 7.85398163397450 > RootFinding:-Analytic(cos(z), z, re = 0 .. 3*Pi, im = -1 .. 1, plot)

HTH, -- Jean-Marc

1 2 3 4 5 6 7 Last Page 1 of 10