Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

When I try to calculate the derivative of a covariant metric with respect to the corresponding contravariant metric, or vice versa, the result is correct up to the sign, which is wrong:

diff(g_[nu, tau], g_[~mu, ~eta]);

Maple's result: g_[eta, nu] g_[mu, tau]

Correct result: -g_[eta, nu] g_[mu, tau]

diff(g_[~nu, ~tau], g_[mu, eta]);

Maple's result: g_[~eta, ~nu] g_[~mu, ~tau]

Correct result: -g_[~eta, ~nu] g_[~mu, ~tau]

I've loaded DifferentialGeometry, Tensor, Physics. Is this my fault, or Maple's?

Dear friends,

I have attached a document with two commands  in slider0 for plotting the same graph in two plot components.
use DocumentTools in 
a := Do(%Slider0/100);
b := Do(%Slider1/100);

Do(%Plot0 = plot(sin(a*x)+cos(b*x^2),x=0..10,y=-3..3));
SetProperty("Plot1",value,plot(sin(a*x)+cos(b*x^2),x=0..10,y=-3..3));
end use; 

I am just curious to know which one is better and when?

 

``

``

 

``


 

Download DoubtOnLatestCodesinEmbeddedPlot.mw

Thanks for answers.

Ramakrishnan V

restart;
A[0] := 0;
                               0
A[1] := sqrt(2*(k[1]^2-w[1]^2))/n;
                                       (1/2)
                    /      2         2\     
                    \2 k[1]  - 2 w[1] /     
                    ------------------------
                               n            
A[2] := sqrt(2*(k[2]^2-w[2]^2))/n;
                                       (1/2)
                    /      2         2\     
                    \2 k[2]  - 2 w[2] /     
                    ------------------------
                               n            
c[1] := 1;
                               1
c[2] := 1;
                               1
c[3] := 1;
                               1
c[4] := 1;
                               1
c[5] := 1;
                               1
c[6] := 1;
                               1
k[1] := 10.5;
                              10.5
k[2] := 3.5;
                              3.5
w[1] := 5.05;
                              5.05
w[2] := .5;
                              0.5
m := 1.9;
                              1.9
n := 1.75;
                              1.75
xi[1] := -t*w[1]+x*k[1];
                        -5.05 t + 10.5 x
xi[2] := -t*w[2]+x*k[2];
                         -0.5 t + 3.5 x
a := m/sqrt(2*(k[1]^2-w[1]^2));
                          0.1459402733
b := m/sqrt(k[2]^2-w[2]^2);
                          0.5484827558
g := a*(c[2]*exp(a*xi[1])+c[3]*exp(-a*xi[1]));
     0.1459402733 exp(-0.7369983802 t + 1.532372870 x)

        + 0.1459402733 exp(0.7369983802 t - 1.532372870 x)
h := c[1]+c[2]*exp(a*xi[1])+c[3]*exp(-a*xi[1]);
            1 + exp(-0.7369983802 t + 1.532372870 x)

               + exp(0.7369983802 t - 1.532372870 x)
G := b*(c[5]*exp(b*xi[2])+c[6]*exp(-b*xi[2]));
     0.5484827558 exp(-0.2742413779 t + 1.919689645 x)

        + 0.5484827558 exp(0.2742413779 t - 1.919689645 x)
H := c[4]+c[5]*exp(b*xi[2])+c[6]*exp(-b*xi[2]);
            1 + exp(-0.2742413779 t + 1.919689645 x)

               + exp(0.2742413779 t - 1.919689645 x)
u := A[0]+A[1]*[g/h]+A[2]*[G/H];
[(2.799416849 (0.5484827558 exp(-0.2742413779 t + 1.919689645 x)

   + 0.5484827558 exp(0.2742413779 t - 1.919689645 x)))/(1

   + exp(-0.2742413779 t + 1.919689645 x)

   + exp(0.2742413779 t - 1.919689645 x)) + (7.439442594 

  (0.1459402733 exp(-0.7369983802 t + 1.532372870 x)

   + 0.1459402733 exp(0.7369983802 t - 1.532372870 x)))/(1

   + exp(-0.7369983802 t + 1.532372870 x)

   + exp(0.7369983802 t - 1.532372870 x))]
plot3d(u, x = -20 .. .20, t = -20 .. .20);

t := 0;
                               0
plot(u, x = -15 .. 15);


Error, (in plot) found points with fewer or more than 2 components
 

fgure set 1;
Error, missing operation
 Typesetting:-mambiguous(fgure Typesetting:-mambiguous(set 1, 

   Typesetting:-merror("missing operation")))
restart;
l := 4;
                               4
m := 1;
                               1
n := 2;
                               2
k := 1/sqrt(-6*beta*l^2+24*beta*m*n);
                               1        
                        ----------------
                                   (1/2)
                        4 (-3 beta)     
w := alpha/(5*beta*sqrt(l^2-4*m*n));
                                 (1/2)
                          alpha 2     
                          ------------
                            20 beta   

B[0] := -(1/25)*alpha*(5*l^3/(5*sqrt(l^2-4*m*n))-20*l*m*n/(5*sqrt(l^2-4*m*n))-l^2+2*m*n)*sqrt(-6*beta*l^2+24*beta*m*n)*(5*sqrt(l^2-4*m*n))/((l^2-4*m*n)^2*beta);
                 /   (1/2)     \          (1/2)  (1/2)
           alpha \8 2      - 12/ (-3 beta)      2     
         - -------------------------------------------
                             40 beta                  
B[1] := -(12/5)*m*alpha*(5*l/(5*sqrt(l^2-4*m*n))-1)/sqrt(-6*beta*l^2+24*beta*m*n);
                               / (1/2)    \
                       3 alpha \2      - 1/
                     - --------------------
                                    (1/2)  
                         5 (-3 beta)       
B[2] := -12*m^2*alpha/(sqrt(-6*beta*l^2+24*beta*m*n)*(5*sqrt(l^2-4*m*n)));
                                  (1/2)  
                         3 alpha 2       
                      - -----------------
                                    (1/2)
                        20 (-3 beta)     
theta := sqrt(l^2-4*m*n);
                               (1/2)
                            2 2     
xi[0] := 1;
                               1
F := -l/(2*m)-theta*tanh((1/2)*theta*(xi+xi[0]))/(2*m);
                     (1/2)     / (1/2)         \
               -2 - 2      tanh\2      (xi + 1)/
beta := -2;
                               -2
alpha := -3;
                               -3

                               1


xi := k*x-t*w;
                   1   (1/2)     3     (1/2)
                   -- 6      x - -- t 2     
                   24            40         
u := B[0]+B[1]*F+B[2]*F*F;
  3  /   (1/2)     \  (1/2)  (1/2)   3  / (1/2)    \  (1/2) /  
- -- \8 2      - 12/ 6      2      + -- \2      - 1/ 6      |-2
  80                                 10                     \  

      (1/2)     / (1/2) /1   (1/2)     3     (1/2)    \\\   3  
   - 2      tanh|2      |-- 6      x - -- t 2      + 1||| + -- 
                \       \24            40             ///   40 

   (1/2)  (1/2) 
  6      2      

                                                            2
  /      (1/2)     / (1/2) /1   (1/2)     3     (1/2)    \\\ 
  |-2 - 2      tanh|2      |-- 6      x - -- t 2      + 1||| 
  \                \       \24            40             /// 
plot3d(u, x = -30 .. .30, t = -30 .. .30);

t := 0;
                               0
plot([u], x = -30 .. 30);

case2222;
                            case2222
restart;
l := 2;
                               2
m := 1;
                               1
n := 2;
                               2
k := 1/sqrt(-6*beta*l^2+24*beta*m*n);
                              (1/2)   
                             6        
                          ------------
                                 (1/2)
                          12 beta     
w := alpha/(5*beta*sqrt(l^2-4*m*n));
                            1         
                            -- I alpha
                            10        
                          - ----------
                               beta   

B[0] := -(1/25)*alpha*(5*l^3/(5*sqrt(l^2-4*m*n))-20*l*m*n/(5*sqrt(l^2-4*m*n))-l^2+2*m*n)*sqrt(-6*beta*l^2+24*beta*m*n)*(5*sqrt(l^2-4*m*n))/((l^2-4*m*n)^2*beta);
                                 (1/2)
                          alpha 6     
                          ------------
                                (1/2) 
                          5 beta      
B[1] := -(12/5)*m*alpha*(5*l/(5*sqrt(l^2-4*m*n))-1)/sqrt(-6*beta*l^2+24*beta*m*n);
                     /1   1  \        (1/2)
                     |- + - I| alpha 6     
                     \5   5  /             
                     ----------------------
                               (1/2)       
                           beta            
B[2] := -12*m^2*alpha/(sqrt(-6*beta*l^2+24*beta*m*n)*(5*sqrt(l^2-4*m*n)));
                       1           (1/2)
                       -- I alpha 6     
                       10               
                       -----------------
                               (1/2)    
                           beta         
theta := sqrt(l^2-4*m*n);
                              2 I
xi[0] := 1;
                               1
C := -2;
                               -2
F := -l/(2*m)-theta*tanh((1/2)*theta*xi)/(2*m)+sech((1/2)*theta*xi)/(C*cosh((1/2)*theta*xi)-2*m*sinh((1/2)*theta*xi)/theta);
                                   sec(xi)       
              -1 + tan(xi) + --------------------
                             -2 cos(xi) - sin(xi)

beta := -2;
                               -2
alpha := 3;
                               3

xi := k*x-t*w;
                  1   (1/2)     (1/2)     3     
                - -- 6      (-2)      x - -- I t
                  24                      20    
u := B[0]+B[1]*F+B[2]*F*F;
  3   (1/2)     (1/2)   /  3    3   \  (1/2)     (1/2) /  
- -- 6      (-2)      + |- -- - -- I| 6      (-2)      |-1
  10                    \  10   10  /                  \  

        /1   (1/2)     (1/2)     3     \   /   /1   (1/2) 
   - tan|-- 6      (-2)      x + -- I t| + |sec|-- 6      
        \24                      20    /   \   \24        

      (1/2)     3     \\//      /1   (1/2)     (1/2)     3     \
  (-2)      x + -- I t|| |-2 cos|-- 6      (-2)      x + -- I t|
                20    // \      \24                      20    /

        /1   (1/2)     (1/2)     3     \\\   3     (1/2) 
   + sin|-- 6      (-2)      x + -- I t||| - -- I 6      
        \24                      20    ///   20          

      (1/2) /        /1   (1/2)     (1/2)     3     \   /   /1  
  (-2)      |-1 - tan|-- 6      (-2)      x + -- I t| + |sec|-- 
            \        \24                      20    /   \   \24 

   (1/2)     (1/2)     3     \\//
  6      (-2)      x + -- I t|| |
                       20    // \
      /1   (1/2)     (1/2)     3     \
-2 cos|-- 6      (-2)      x + -- I t|
      \24                      20    /

        /1   (1/2)     (1/2)     3     \\\  
   + sin|-- 6      (-2)      x + -- I t|||^2
        \24                      20    ///  
plot3d(Re(u), x = -30 .. .30, t = -30 .. .30);

t := 0;
                               0
plot([Re(u)], x = -30 .. 30);

plot3d(Im(u), x = -10 .. .10, t = -10 .. .10);
Error, (in plot3d) bad range arguments: x = -10 .. .10, 0 = -10 .. .10
t := 0;
                               0
plot([Im(u)], x = -30 .. 30);

fgure set 2;
Error, missing operation
 Typesetting:-mambiguous(fgure Typesetting:-mambiguous(set 2, 

   Typesetting:-merror("missing operation")))
restart;
l := 4;
                               4
m := 1;
                               1
n := 2;
                               2
k := 1/sqrt(6*beta*l^2-24*beta*m*n);
                              (1/2)   
                             3        
                          ------------
                                 (1/2)
                          12 beta     
w := alpha/((5*sqrt(l^2-4*m*n))*beta);
                                 (1/2)
                          alpha 2     
                          ------------
                            20 beta   

B[0] := (1/25)*alpha*(5*l^3/(5*sqrt(l^2-4*m*n))-20*l*m*n/(5*sqrt(l^2-4*m*n))+l^2-6*m*n)*sqrt(6*beta*l^2-24*beta*m*n)*(5*sqrt(l^2-4*m*n))/((l^2-4*m*n)^2*beta);
                     /   (1/2)    \  (1/2)  (1/2)
               alpha \8 2      + 4/ 3      2     
               ----------------------------------
                                 (1/2)           
                          40 beta                
B[1] := -(12/5)*m*alpha*(5*l/(5*sqrt(l^2-4*m*n))-1)/sqrt(6*beta*l^2-24*beta*m*n);
                          / (1/2)    \  (1/2)
                    alpha \2      - 1/ 3     
                  - -------------------------
                                 (1/2)       
                           5 beta            
B[2] := -12*m^2*alpha/(sqrt(6*beta*l^2-24*beta*m*n)*(5*sqrt(l^2-4*m*n)));
                              (1/2)  (1/2)
                       alpha 3      2     
                     - -------------------
                                 (1/2)    
                          20 beta         

                       1           (1/2)
                       -- I alpha 6     
                       10               
                       -----------------
                               (1/2)    
                           beta         
theta := sqrt(l^2-4*m*n);
                               (1/2)
                            2 2     
xi[0] := 1;
                               1
F := -l/(2*m)-theta*tanh((1/2)*theta*(xi+xi[0]))/(2*m);
                     (1/2)     / (1/2)         \
               -2 - 2      tanh\2      (xi + 1)/
beta := -2;
                               -2
alpha := -3;
                               -3

                               1


xi := k*x-t*w;
               1   (1/2)     (1/2)     3     (1/2)
             - -- 3      (-2)      x - -- t 2     
               24                      40         
u := B[0]+B[1]*F+B[2]*F*F;
 3  /   (1/2)    \     (1/2)  (1/2)  (1/2)   3  / (1/2)    \ 
 -- \8 2      + 4/ (-2)      3      2      - -- \2      - 1/ 
 80                                          10              

    (1/2)     (1/2) /  
   3      (-2)      |-2
                    \  

       (1/2)     / (1/2) /  1   (1/2)     (1/2)     3     (1/2)
    - 2      tanh|2      |- -- 3      (-2)      x - -- t 2     
                 \       \  24                      40         

       \\\   3   (1/2)     (1/2)  (1/2) /  
    + 1||| - -- 3      (-2)      2      |-2
       ///   40                         \  

       (1/2)     / (1/2) /  1   (1/2)     (1/2)     3     (1/2)
    - 2      tanh|2      |- -- 3      (-2)      x - -- t 2     
                 \       \  24                      40         

       \\\  
    + 1|||^2
       ///  
plot3d(Re(u), x = -30 .. .30, t = -30 .. .30);
Error, (in plot3d) bad range arguments: x = -30 .. .30, 0 = -30 .. .30
t := 0;
                               0
plot([Re(u)], x = -30 .. 30);

plot3d(Im(u), x = -1 .. 1, t = -1 .. 1);
Error, (in plot3d) bad range arguments: x = -1 .. 1, 0 = -1 .. 1
t := 0;
                               0
plot([Im(u)], x = -30 .. 30);

case2222;
                            case2222
restart;
l := 2;
                               2
m := 1;
                               1
n := 2;
                               2
k := 1/sqrt(-6*beta*l^2+24*beta*m*n);
                              (1/2)   
                             6        
                          ------------
                                 (1/2)
                          12 beta     
w := alpha/(5*beta*sqrt(l^2-4*m*n));
                            1         
                            -- I alpha
                            10        
                          - ----------
                               beta   

B[0] := -(1/25)*alpha*(5*l^3/(5*sqrt(l^2-4*m*n))-20*l*m*n/(5*sqrt(l^2-4*m*n))-l^2+2*m*n)*sqrt(-6*beta*l^2+24*beta*m*n)*(5*sqrt(l^2-4*m*n))/((l^2-4*m*n)^2*beta);
                                 (1/2)
                          alpha 6     
                          ------------
                                (1/2) 
                          5 beta      
B[1] := -(12/5)*m*alpha*(5*l/(5*sqrt(l^2-4*m*n))-1)/sqrt(-6*beta*l^2+24*beta*m*n);
                     /1   1  \        (1/2)
                     |- + - I| alpha 6     
                     \5   5  /             
                     ----------------------
                               (1/2)       
                           beta            
B[2] := -12*m^2*alpha/(sqrt(-6*beta*l^2+24*beta*m*n)*(5*sqrt(l^2-4*m*n)));
                       1           (1/2)
                       -- I alpha 6     
                       10               
                       -----------------
                               (1/2)    
                           beta         
theta := sqrt(l^2-4*m*n);
                              2 I
xi[0] := 1;
                               1
C := -2;
                               -2
F := -l/(2*m)-theta*tanh((1/2)*theta*xi)/(2*m)+sech((1/2)*theta*xi)/(C*cosh((1/2)*theta*xi)-2*m*sinh((1/2)*theta*xi)/theta);
                                   sec(xi)       
              -1 + tan(xi) + --------------------
                             -2 cos(xi) - sin(xi)

beta := -2;
                               -2
alpha := 3;
                               3

xi := k*x-t*w;
                  1   (1/2)     (1/2)     3     
                - -- 6      (-2)      x - -- I t
                  24                      20    
u := B[0]+B[1]*F+B[2]*F*F;
  3   (1/2)     (1/2)   /  3    3   \  (1/2)     (1/2) /  
- -- 6      (-2)      + |- -- - -- I| 6      (-2)      |-1
  10                    \  10   10  /                  \  

        /1   (1/2)     (1/2)     3     \   /   /1   (1/2) 
   - tan|-- 6      (-2)      x + -- I t| + |sec|-- 6      
        \24                      20    /   \   \24        

      (1/2)     3     \\//      /1   (1/2)     (1/2)     3     \
  (-2)      x + -- I t|| |-2 cos|-- 6      (-2)      x + -- I t|
                20    // \      \24                      20    /

        /1   (1/2)     (1/2)     3     \\\   3     (1/2) 
   + sin|-- 6      (-2)      x + -- I t||| - -- I 6      
        \24                      20    ///   20          

      (1/2) /        /1   (1/2)     (1/2)     3     \   /   /1  
  (-2)      |-1 - tan|-- 6      (-2)      x + -- I t| + |sec|-- 
            \        \24                      20    /   \   \24 

   (1/2)     (1/2)     3     \\//
  6      (-2)      x + -- I t|| |
                       20    // \
      /1   (1/2)     (1/2)     3     \
-2 cos|-- 6      (-2)      x + -- I t|
      \24                      20    /

        /1   (1/2)     (1/2)     3     \\\  
   + sin|-- 6      (-2)      x + -- I t|||^2
        \24                      20    ///  
plot3d(Re(u), x = -30 .. .30, t = -30 .. .30);

t := 0;
                               0
plot([Re(u)], x = -30 .. 30);

plot3d(Im(u), x = -10 .. .10, t = -10 .. .10);
Error, (in plot3d) bad range arguments: x = -10 .. .10, 0 = -10 .. .10
t := 0;
                               0
plot([Im(u)], x = -30 .. 30);

Hi,
I face a problem using Tolerances:-NominalValue and Tolerances:-ToleranceValue on a quantity constructed from add.

Example

restart:
with(Tolerances):
x := 10 &+-1:
y := 20 &+- 2:
z := 3*x+2*y;
NominalValue(z);     
# returns 70 as expected
ToleranceValue(z);   # returns 7 as expected


Now I define another quantity Z this way:

Z := add([3, 2] *~ [x, y]);
(or equivalently add(ListOfCoeffs[k]*ListOfVars[k], k=1..K) where ListOfCoeffs and ListOfVars are previously defined adhoc lists)

Both NominalValue(Z) and ToleranceValue(Z) return an error.
PS: already (and this probably explains that) Z does not appear as 70 +/- 7 but as 3*Interval(...)+2*Interval(...) (lprint confirmed)

How can I obtain NominalValue(Z) and ToleranceValue(Z) when Z comes from 'add' constructor?

There have been several posts, over the years, related to visual cues about the values associated with particular 2D contours in a plot.

Some people ask or post about color-bars [1]. Some people ask or post about inlined labelling of the curves [1, 2, 3, 4, 5, 6, 7]. And some post about mouse popup/hover-over functionality [1]., which got added as general new 2D plot annotation functionality in Maple 2017 and is available for the plots:-contourplot command via its contourlabels option.

Another possibility consists of a legend for 2D contour plots, with distinct entries for each contour value. That is not currently available from the plots:-contourplot command as documented. This post is about obtaining such a legend.

Aside from the method used below, a similar effect may be possible (possibly with a little effort) using contour-plotting approaches based on individual plots:-implicitplot calls for each contour level. Eg. using Kitonum's procedure, or an undocumented, alternate internal driver for plots:-contourplot.

Since I like the functionality provided by the contourlabels option I thought that I'd highjack that (and the _HOVERCONTENT plotting substructure that plot-annotations now generate) and get a relatively convenient way to get a color-key via the 2D plotting legend.  This is not supposed to be super-efficient.

Here below are some examples. I hope that it illustrates some useful functionality that could be added to the contourplot command. It can also be used to get a color-key for use with densityplot.

restart;

contplot:=proc(ee, rng1, rng2)
  local clabels, clegend, i, ncrvs, newP, otherdat, others, tcrvs, tempP;
  (clegend,others):=selectremove(type,[_rest],identical(:-legend)=anything);
  (clabels,others):= selectremove(type,others,identical(:-contourlabels)=anything);
  if nops(clegend)>0 then
    tempP:=:-plots:-contourplot(ee,rng1,rng2,others[],
                                ':-contourlabels'=rhs(clegend[-1]));
    tempP:=subsindets(tempP,'specfunc(:-_HOVERCONTENT)',
                      u->`if`(has(u,"null"),NULL,':-LEGEND'(op(u))));
    if nops(clabels)>0 then
      newP:=plots:-contourplot(ee,rng1,rng2,others[],
                              ':-contourlabels'=rhs(clabels[-1]));
      tcrvs:=select(type,[op(tempP)],'specfunc(CURVES)');
      (ncrvs,otherdat):=selectremove(type,[op(newP)],'specfunc(CURVES)');
      return ':-PLOT'(seq(':-CURVES'(op(ncrvs[i]),op(indets(tcrvs[i],'specfunc(:-LEGEND)'))),
                          i=1..nops(ncrvs)),
                      op(otherdat));
    else
      return tempP;
    end if;
  elif nops(clabels)>0 then
    return plots:-contourplot(ee,rng1,rng2,others[],
                              ':-contourlabels'=rhs(clabels[-1]));
  else
    return plots:-contourplot(ee,rng1,rng2,others[]);
  end if;
end proc:
 

contplot(x^2+y^2, x=-2..2, y=-2..2,
      coloring=["Yellow","Blue"],
      contours = 9,
      size=[500,400],
      legendstyle = [location = right],
      legend=true,
      contourlabels=true,
      view=[-2.1..2.1,-2.1..2.1]
);

contplot(x^2+y^2, x=-2..2, y=-2..2,
      coloring=["Yellow","Blue"],
      contours = 17,
      size=[500,400],
      legendstyle = [location = right],
      legend=['contourvalue',$("null",7),'contourvalue',$("null",7),'contourvalue'],
      contourlabels=true,
      view=[-2.1..2.1,-2.1..2.1]
);

# Apparently legend items must be unique, to persist on document re-open.

contplot(x^2+y^2, x=-2..2, y=-2..2,
      coloring=["Yellow","Blue"],
      contours = 11,
      size=[500,400],
      legendstyle = [location = right],
      legend=['contourvalue',seq(cat($(` `,i)),i=2..5),
              'contourvalue',seq(cat($(` `,i)),i=6..9),
              'contourvalue'],
      contourlabels=true,
      view=[-2.1..2.1,-2.1..2.1]
);

contplot(x^2+y^2, x=-2..2, y=-2..2,
      coloring=["Green","Red"],
      contours = 8,
      size=[400,450],
      legend=true,
      contourlabels=true
);

contplot(x^2+y^2, x=-2..2, y=-2..2,
      coloring=["Yellow","Blue"],
      contours = 13,
      legend=['contourvalue',$("null",5),'contourvalue',$("null",5),'contourvalue'],
      contourlabels=true
);

(low,high,N):=0.1,7.6,23:
conts:=[seq(low..high*1.01, (high-low)/(N-1))]:
contplot(x^2+y^2, x=-2..2, y=-2..2,
      coloring=["Yellow","Blue"],
      contours = conts,
      legend=['contourvalue',$("null",floor((N-3)/2)),'contourvalue',$("null",ceil((N-3)/2)),'contourvalue'],
      contourlabels=true
);

plots:-display(
  subsindets(contplot((x^2+y^2)^(1/2), x=-2..2, y=-2..2,
                      coloring=["Yellow","Blue"],
                      contours = 7,
                      filledregions),
             specfunc(CURVES),u->NULL),
  contplot((x^2+y^2)^(1/2), x=-2..2, y=-2..2,
      coloring=["Yellow","Blue"],
      contours = 7, #grid=[50,50],
      thickness=0,
      legendstyle = [location=right],
      legend=true),
  size=[600,500],
  view=[-2.1..2.1,-2.1..2.1]
);

 

plots:-display(
  contplot(x^2+y^2, x=-2..2, y=-2..2,
      coloring=["Yellow","Blue"],
      contours = 5,
      thickness=0, filledregions),
  contplot(x^2+y^2, x=-2..2, y=-2..2,
      coloring=["Yellow","Blue"],
      contours = 5,
      thickness=3,
      legendstyle = [location=right],
      legend=typeset("<=",contourvalue)),
  size=[700,600],
  view=[-2.1..2.1,-2.1..2.1]
);

N:=11:
plots:-display(
  contplot(sin(x)*y, x=-2*Pi..2*Pi, y=-1..1,
      coloring=["Yellow","Blue"],
      contours = [seq(-1+(i-1)*(1-(-1))/(N-1),i=1..N)],
      thickness=3,
      legendstyle = [location=right],
      legend=true),
   plots:-densityplot(sin(x)*y, x=-2*Pi..2*Pi, y=-1..1,
      colorscheme=["zgradient",["Yellow","Blue"],colorspace="RGB"],
      grid=[100,100],
      style=surface, restricttoranges),
   plottools:-line([-2*Pi,-1],[-2*Pi,1],thickness=3,color=white),
   plottools:-line([2*Pi,-1],[2*Pi,1],thickness=3,color=white),
   plottools:-line([-2*Pi,1],[2*Pi,1],thickness=3,color=white),
   plottools:-line([-2*Pi,-1],[2*Pi,-1],thickness=3,color=white),
   size=[600,500]
);

N:=13:
plots:-display(
  contplot(sin(x)*y, x=-2*Pi..2*Pi, y=-1..1,
      coloring=["Yellow","Blue"],
      contours = [seq(-1+(i-1)*(1-(-1))/(N-1),i=1..N)],
      thickness=6,
      legendstyle = [location=right],
      legend=['contourvalue',seq(cat($(` `,i)),i=2..3),
              'contourvalue',seq(cat($(` `,i)),i=5..6),
              'contourvalue',seq(cat($(` `,i)),i=8..9),
              'contourvalue',seq(cat($(` `,i)),i=11..12),
              'contourvalue']),
   plots:-densityplot(sin(x)*y, x=-2*Pi..2*Pi, y=-1..1,
      colorscheme=["zgradient",["Yellow","Blue"],colorspace="RGB"],
      grid=[100,100],
      style=surface, restricttoranges),
   plottools:-line([-2*Pi,-1],[-2*Pi,1],thickness=6,color=white),
   plottools:-line([2*Pi,-1],[2*Pi,1],thickness=6,color=white),
   plottools:-line([-2*Pi,1],[2*Pi,1],thickness=6,color=white),
   plottools:-line([-2*Pi,-1],[2*Pi,-1],thickness=6,color=white),
  size=[600,500]
);

 

Download contour_legend_post.mw

 

 

 

Hellow

 

I want to create a function that sort an array with a parametric variable alpha[k]. But Maple ignores the sort command, so the array never gets sorted. Please see attached url to creen capture of the problem:

 

https://www.dropbox.com/s/gjy5zbm4gjwmwdv/sort.png?dl=0

Thnaks

 

Hi everyone, my question is how do I get maple to process these commands. It is currently not evaluating them, and output is also similar to the image above. This occurs when I open a workbook from my Professor, all the math commands that are already inserted into the worksheet output this when I try to execute them.

I have found a workaround, I simply copy and paste the code in a new command line but this is tedious and I was wondering if anyone knew how to fix this.

Thanks!

         Fract := proc(P::posint, Q::posint)  
         local p,q:
         for p from 1 to P-1 do
            for q from 1 to Q-1 do
              if (P-p)*q-P*(Q-q)=1 the return (p/q,(P-p)/(Q-q): fi:
          od:od:  
       end;
        debug(Fract);
        Fract(5, 13);
        Fract(77, 200);

 

How can type 

[
 

"seq('op'('S['i'])',i=1..5)"

op(S[1]), op(S[2]), op(S[3]), op(S[4]), op(S[5])

(1)

into

into

(2)

op(S[1]), op(S[2]), op(S[3]), op(S[4]), op(S[5])

``

(3)

``


 

Download op_seq.mw

seq('op'('S['i'])',i=1..5)]

export

[op(S[1]), op(S[2],op(S[3],op(S[4])]

Please help me

I need to plot 2 surfaces (f, g) and a plane (Op) (two surfaces and the osculating plane to their complete intersection curve). When I use

f := x*w - z
g := -z^2-w+x+2*z-1
Op := 5*x-4-4*z+3*w
implicitplot3d({f, g, Op}, x = 0 .. 2, z = 0 .. 2, w = 0 .. 2, grid = [50, 50, 50])

it is very difficult to differentiate between them, so I would like to plot f, g and Op using different color schemes or something. Any ideas on how to do this?

Hello everyone!

I am confronted with a problem that seems to result from different definition of spherical coordinates in Maple and in Student[VectorCalculus] package.

I want to visualize a vector field defined in spherical coordinates (r,theta,phi).

A simple exampe is < 0, theta, 0 >. If I want to see just one slice of the field in OXY plane, I type:

fieldplot3d(<0, theta, 0>, r = 0 .. 1, theta = 0 .. 2*Pi, phi = 0 .. Pi, coords = spherical, grid = [10, 20, 3], color = black, fieldstrength = fixed(1), arrows = THICK)

And get:

which looks OK more or less but I don't like the nonuniform distribution of arrows. But since the field is defined in spherical coordinates there seems to be no way to produce a uniform distribution with fieldplot3d command.

However VectorField command in Student[VectorCalculus] package seems to do just what I want. But a similar call to it:

SetCoordinates('spherical'[r, theta, phi])

VectorField(<0, theta, 0>, output = plot, view = [-5 .. 5, -5 .. 5, -10 .. 10], fieldoptions = [arrows = THICK, color = black, grid = [10, 10, 3], view = [-5 .. 5, -5 .. 5, -1 .. 1]])  produces quite a different result:

which means that the second argument 'theta' is not the azimuthal angle but the angle from the Z axis, and amounts to Pi/2 since we look at the OXY plane.

The result of: VectorField(<0, 0, theta>, output = plot, view = [-5 .. 5, -5 .. 5, -10 .. 10], fieldoptions = [arrows = THICK, color = black, grid = [10, 10, 3], view = [-5 .. 5, -5 .. 5, -1 .. 1]])  looks better:

but is not correct since the magnitude of the field does not change with the azimutal angle. Finally, 

VectorField(<0, 0, phi>, output = plot, view = [-5 .. 5, -5 .. 5, -10 .. 10], fieldoptions = [arrows = THICK, color = black, grid = [10, 10, 3], view = [-5 .. 5, -5 .. 5, -1 .. 1]]) produces almost what I want:

but it's quite different from what you get with fieldplot3d command. Apparently, not only azimuthal angle is now the third argument but it varies from -Pi to Pi, not from 0 to 2Pi as it does in fieldplot3d. I hoped to use both fieldplot3d and VectorField  with my vector fields but I cannot since they are not consistent in the definition of spherical coordinates.

My questions therefore are:

1) Is there a way to redifine spherical coordinates in VectorField command to make them consistent with the rest of Maple?

2) Can I produce a uniform 3D distribution of arrows for a field in spherical coordinates without VectorField command?

Many thanks for your help in advance!

Figure;
                             Figure
restart;
A[0] := 0;
                               0
A[1] := sqrt(2*(k[1]^2-w[1]^2))/sqrt(lambda);
                                       (1/2)
                    /      2         2\     
                    \2 k[1]  - 2 w[1] /     
                    ------------------------
                                (1/2)       
                          lambda            
A[2] := sqrt(2*(k[2]^2-w[2]^2))/sqrt(lambda);
                                       (1/2)
                    /      2         2\     
                    \2 k[2]  - 2 w[2] /     
                    ------------------------
                                (1/2)       
                          lambda            
c[1] := 1;
                               1
c[2] := 1;
                               1
c[3] := 1;
                               1
c[4] := 1;
                               1
c[5] := 1;
                               1
c[6] := 1;
                               1
k[1] := 10.5;
                              10.5
k[2] := 3.5;
                              3.5
w[1] := 5.05;
                              5.05
w[2] := .5;
                              0.5
m := 1.9;
                              1.9
lambda := 1.75;
                              1.75
xi[1] := -t*w[1]+x*k[1];
                        -5.05 t + 10.5 x
xi[2] := -t*w[2]+x*k[2];
                         -0.5 t + 3.5 x
a := m/sqrt(k[1]^2-w[1]^2);
                          0.2063907138
b := m/sqrt(k[2]^2-w[2]^2);
                          0.5484827558
g := a*(c[2]*cos(a*xi[1])-c[3]*sin(a*xi[1]));
0.2063907138 cos(2.167102495 x) - 0.2063907138 sin(2.167102495 x)
h := c[1]+c[2]*sin(a*xi[1])+c[3]*cos(a*xi[1]);
          1 + sin(2.167102495 x) + cos(2.167102495 x)
G := b*(c[5]*cos(b*xi[2])-c[6]*sin(b*xi[2]));
0.5484827558 cos(1.919689645 x) - 0.5484827558 sin(1.919689645 x)
H := c[4]+c[5]*sin(b*xi[2])+c[6]*cos(b*xi[2]);
          1 + sin(1.919689645 x) + cos(1.919689645 x)
u := A[0]+A[1]*[g/h]+A[2]*[G/H];
  [                     1                                   
  [------------------------------------------- (3.703280398 
  [1 + sin(1.919689645 x) + cos(1.919689645 x)              

    (0.5484827558 cos(1.919689645 x)

     - 0.5484827558 sin(1.919689645 x))) + 

                         1                                   
    ------------------------------------------- (9.841457496 
    1 + sin(2.167102495 x) + cos(2.167102495 x)              

    (0.2063907138 cos(2.167102495 x)

                                        ]
     - 0.2063907138 sin(2.167102495 x)))]
                                        ]
plot3d(Re(u), x = -20 .. .20, t = -20 .. .20);
Error, invalid input: `simpl/Re` expects its 1st argument, x, to be of type {boolean, algebraic}, but received [3.703280398*(.5484827558*cos(1.919689645*x)-.5484827558*sin(1.919689645*x))/(1+sin(1.919689645*x)+cos(1.919689645*x))+9.841457496*(.2063907138*cos(2.167102495*x)-.2063907138*sin(2.167102495*x))/(1+sin(2.167102495*x)+cos(2.167102495*x))]
t := 0;
                               0
plot(u, x = -15 .. 15);

I don't know how to simplify the expression A/B in the worksheet below.  I know that it should simplify to exp(I*Pi/3).  How do I lead Maple to discover that result without telling it the solution ahead of the time?  All variables other than A and B are real.

restart;

local gamma:

A := I*sqrt(3) + 2*c*exp(I*(gamma+(1/3)*Pi)) + 2*a*exp(I*alpha) - 2*a*exp(I*(alpha+(1/3)*Pi)) - 2*b*exp(I*beta) - 1;

I*3^(1/2)+2*c*exp(I*(gamma+(1/3)*Pi))+2*a*exp(I*alpha)-2*a*exp(I*(alpha+(1/3)*Pi))-2*b*exp(I*beta)-1

B := I*sqrt(3) - 2*a*exp(I*(alpha+(1/3)*Pi)) - 2*b*exp(I*beta) + 2*b*exp(I*(beta+(1/3)*Pi)) + 2*c*exp(I*gamma) + 1;

I*3^(1/2)-2*a*exp(I*(alpha+(1/3)*Pi))-2*b*exp(I*beta)+2*b*exp(I*(beta+(1/3)*Pi))+2*c*exp(I*gamma)+1

How to show that A/B = e^((1/3)*i*Pi)?

 

Download mw.mw

How to find the closed formula for the sum of this sequence:

sum = n + n/2 + n/4 + n/8 + ... + 1

If n is 2 in some power, then the sum should be 2*n - 1. How to get this answer using Maple?

First 718 719 720 721 722 723 724 Last Page 720 of 2224