Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hello

I am revising the unstable period orbits of the Logistic map, y[n]=4*y[n-1]*(1-y[n]), in Maple.  Although I have implemented the equation and use a loop for the iterations, I wonder whether there is a faster and concise way to code the equation in Maple. 

Here it is what I did:

y[0] := (-sqrt(5)+5)*(1/8);

for n to 10 do y[n] := 4*y[n-1]*(1-y[n-1]) end do;
soly := [seq(simplify(expand(y[n]), radical), n = 0 .. 10)];
dat := [seq([n, Re(evalf(soly[n]))], n = 1 .. 10)]; plot(dat, labels = ["k", "x(k)"], style = pointline,title="Period 2");

Since only few iterations are needed, the solution is symbolic (and then convert to float).  

Many thanks.

Ed

 

 

Hi guys,

This is the first time of solving partial differential equation, can some please help me point out some errows in my code. 
 

restart

ODEs := `<,>`(diff(v(y), y, y)+(diff(v(y), y))/y-(Ha^2/(1-eta)^2+1/y^2)*v(y)-Re*v(y)*(diff(v(y), y)) = 0, diff(theta(y), y, y)+Ec*Pr*(diff(v(y), y)-v(y)/y)^2-Pr*Re*v(y)*(diff(theta(y), y))+Nb*(diff(theta(y), y))*(diff(phi(y), y))+Nt*(diff(theta(y), y))^2 = 0, diff(phi(y), y, y)-Re*Sc*v(y)*(diff(phi(y), y))+Nt*(diff(theta(y), y, y)+(diff(theta(y), y))/y)/Nb = 0)

ODEs := Matrix(3, 1, {(1, 1) = diff(diff(v(y), y), y)+(diff(v(y), y))/y-(Ha^2/(1-eta)^2+1/y^2)*v(y)-Re*v(y)*(diff(v(y), y)) = 0, (2, 1) = diff(diff(theta(y), y), y)+Ec*Pr*(diff(v(y), y)-v(y)/y)^2-Pr*Re*v(y)*(diff(theta(y), y))+Nb*(diff(theta(y), y))*(diff(phi(y), y))+Nt*(diff(theta(y), y))^2 = 0, (3, 1) = diff(diff(phi(y), y), y)-Re*Sc*v(y)*(diff(phi(y), y))+Nt*(diff(diff(theta(y), y), y)+(diff(theta(y), y))/y)/Nb = 0})

(1)

BCs := `<,>`(phi(eta) = 1, v(eta) = 1, theta(eta) = 1, phi(1) = 0, theta(1) = 0, v(1) = 0)

BCs := Matrix(6, 1, {(1, 1) = phi(eta) = 1, (2, 1) = v(eta) = 1, (3, 1) = theta(eta) = 1, (4, 1) = phi(1) = 0, (5, 1) = theta(1) = 0, (6, 1) = v(1) = 0})

(2)

param_names := [eta, Ha, Ec, Nt, Nb, Re, Sc, Pr];

[eta, Ha, Ec, Nt, Nb, Re, Sc, Pr]

(3)

pdSolve := subs(_P = param_names, proc ({ eta::realcons := .5, Ha::realcons := 1, Sc::realcons := .8, Nt::realcons := .1, Nb::realcons := .1, Re::realcons := 2, Ec::realcons := 0.1e-1, Pr::realcons := 10 }) userinfo(1, Solve, `~`[`=`](param_names, _P)); dsolve(eval(`union`(convert(ODEs, set), convert(BCs, set)), `~`[`=`](param_names, _P)), numeric) end proc);

proc ({ Ec::realcons := 0.1e-1, Ha::realcons := 1, Nb::realcons := .1, Nt::realcons := .1, Pr::realcons := 10, Re::realcons := 2, Sc::realcons := .8, eta::realcons := .5 }) userinfo(1, Solve, `~`[`=`](param_names, [eta, Ha, Ec, Nt, Nb, Re, Sc, Pr])); dsolve(eval(`union`(convert(ODEs, set), convert(BCs, set)), `~`[`=`](param_names, [eta, Ha, Ec, Nt, Nb, Re, Sc, Pr])), numeric) end proc

(4)

infolevel[Solve] := 1:

Fig. 3 (changing values of Ha):

P:= Ha:
vals:= [1, 5, 10, 20]:
sols:= [seq(Solve(P= v), v= vals)]:
colors:= [red, green, blue]:
for F in [v,theta,phi](y) do
   print(plots:-display(
      [seq(
         plots:-odeplot(sols[k], [y,F], color= colors[k], legend= [P= vals[k]]),
         k= 1..nops(vals)
      )],
      labeldirections= [horizontal,vertical]
   ))
od:

Error, pdeplot is not a command in the plots package

 

``


 

Download chapter5.mw

 

How can I use Maple to solve a difference quotient problem? How do I enter the basic difference quotient formula and the quadratic equation to be used in the problem?

1.47449729919434*10^10*c[0, 1]*c[0, 2]*c[2, 2]*c[3, 0]+3.38624318440755*10^8*c[0, 1]*c[0, 3]*c[1, 0]*c[2, 1]+1.54309415817260*10^10*c[0, 1]*c[0, 3]*c[1, 3]*c[2, 0]+1.69527735464914*10^14*c[0, 2]*c[0, 3]*c[1, 3]*c[3, 3]+5.64571777979530*10^11*c[0, 1]*c[1, 3]*c[3, 0]*c[3, 1]+5.64571777979530*10^11*c[0, 1]*c[1, 1]*c[3, 0]*c[3, 3]+3.44365358352662*10^11*c[0, 1]*c[1, 1]*c[3, 1]*c[3, 2]+4.56141047477722*10^11*c[0, 1]*c[0, 2]*c[2, 1]*c[3, 3]+1.47449729919434*10^10*c[0, 1]*c[0, 2]*c[2, 0]*c[3, 2]+1.00292015075684*10^10*c[0, 1]*c[0, 2]*c[2, 1]*c[3, 1]+4.96419365552208*10^14*c[1, 1]*c[2, 3]*c[3, 1]*c[3, 2]+2.41547661753786*10^16*c[1, 1]*c[2, 3]*c[3, 2]*c[3, 3]+3.09237360954284*10^11*c[0, 2]*c[1, 1]*c[1, 3]*c[3, 1]+2.07077209298372*10^13*c[0, 2]*c[2, 2]*c[2, 3]*c[3, 0]+2.77395036220550*10^11*c[0, 2]*c[1, 1]*c[1, 2]*c[3, 2]+3.25883571082134*10^15*c[1, 2]*c[2, 3]*c[3, 1]*c[3, 2]+2.77442234357198*10^11*c[0, 2]*c[1, 1]*c[2, 1]*c[2, 3]+7.80736282336175*10^14*c[2, 0]*c[2, 1]*c[3, 2]*c[3, 3]+3.25883571082134*10^15*c[1, 2]*c[2, 2]*c[3, 1]*c[3, 3]+5.35593751087840*10^15*c[1, 2]*c[2, 3]*c[3, 0]*c[3, 3]+3.63255405301248*10^15*c[1, 1]*c[2, 3]*c[3, 1]*c[3, 3]+3.25883571082134*10^15*c[1, 2]*c[2, 1]*c[3, 2]*c[3, 3]+1.48022406855142*10^13*c[1, 0]*c[2, 1]*c[2, 2]*c[3, 3]+5.19766484559825*10^15*c[0, 1]*c[2, 3]*c[3, 2]*c[3, 3]+3.63255405301248*10^15*c[1, 3]*c[2, 1]*c[3, 1]*c[3, 3]+1.03156027712140*10^14*c[0, 3]*c[1, 2]*c[1, 3]*c[2, 3]+6.84418565576730*10^13*c[1, 1]*c[1, 2]*c[1, 3]*c[3, 3]+1.36253689407226*10^13*c[0, 1]*c[1, 2]*c[2, 3]*c[3, 2]+4.50722523384354*10^11*c[0, 1]*c[0, 2]*c[1, 2]*c[3, 3]+4.63272867590191*10^14*c[1, 1]*c[1, 3]*c[2, 3]*c[3, 2]+9.56722337372450*10^9*c[0, 1]*c[0, 2]*c[1, 2]*c[1, 3]+7.56283392524430*10^14*c[0, 3]*c[1, 1]*c[2, 3]*c[3, 3]+1.51879056084535*10^13*c[0, 3]*c[1, 1]*c[2, 3]*c[3, 1]+8.15436050904650*10^14*c[1, 1]*c[2, 3]*c[3, 0]*c[3, 3]+1.51879056084535*10^13*c[0, 1]*c[1, 1]*c[2, 3]*c[3, 3]+3.05712170936082*10^11*c[0, 1]*c[1, 1]*c[1, 3]*c[2, 3]+2.21942429315476*10^9*c[0, 1]*c[0, 2]*c[1, 0]*c[3, 2]+1.50960286458333*10^9*c[0, 1]*c[0, 2]*c[1, 1]*c[3, 1]+6.37602806091310*10^9*c[0, 1]*c[1, 1]*c[1, 2]*c[1, 3]+2.22015380859375*10^7*c[0, 0]*c[1, 0]*c[1, 1]*c[3, 0]+2.24812825520834*10^6*c[0, 0]*c[0, 1]*c[1, 0]*c[2, 1]+2.24812825520834*10^6*c[0, 0]*c[0, 1]*c[1, 1]*c[2, 0]+4.45556640625000*10^5*c[0, 0]*c[0, 1]*c[0, 2]*c[1, 0]+1.80236816406250*10^7*c[0, 0]*c[0, 2]*c[0, 3]*c[1, 0]+9.99813988095240*10^6*c[0, 1]*c[1, 0]*c[1, 1]*c[2, 0]+1.64310515873016*10^7*c[0, 0]*c[0, 1]*c[1, 0]*c[3, 1]+1.09924316406250*10^7*c[0, 0]*c[0, 1]*c[0, 2]*c[1, 2]+1.22578938802084*10^7*c[0, 0]*c[0, 1]*c[0, 3]*c[1, 1]+6.74438476562500*10^5*c[0, 0]*c[0, 1]*c[1, 0]*c[2, 0]+3.27484130859375*10^7*c[0, 0]*c[0, 1]*c[2, 0]*c[3, 0]+4.96419365552208*10^14*c[1, 1]*c[2, 2]*c[3, 1]*c[3, 3]+1.48022406855142*10^13*c[1, 2]*c[2, 0]*c[2, 1]*c[3, 3]+1.48022406855142*10^13*c[1, 2]*c[2, 0]*c[2, 3]*c[3, 1]+7.00457388588595*10^14*c[1, 2]*c[2, 0]*c[2, 3]*c[3, 3]+9.01806926154510*10^12*c[1, 2]*c[2, 1]*c[2, 2]*c[3, 1]+4.26195329427362*10^14*c[1, 1]*c[2, 2]*c[2, 3]*c[3, 2]+8.70017911044035*10^14*c[1, 1]*c[3, 0]*c[3, 2]*c[3, 3]+1.64960358855012*10^13*c[1, 2]*c[1, 3]*c[3, 0]*c[3, 1]+8.70017911044035*10^14*c[1, 3]*c[3, 0]*c[3, 1]*c[3, 2]+4.11701503132284*10^16*c[1, 3]*c[3, 0]*c[3, 2]*c[3, 3]+1.32823657812862*10^13*c[2, 0]*c[2, 1]*c[2, 2]*c[2, 3]+2.49782355477406*10^13*c[0, 1]*c[0, 3]*c[3, 1]*c[3, 3]+1.86077008928572*10^7*c[0, 0]*c[0, 1]*c[0, 2]*c[0, 3]+4.50750425170068*10^11*c[0, 3]*c[1, 2]*c[1, 3]*c[2, 0]+2.41765159606934*10^10*c[0, 0]*c[0, 2]*c[2, 0]*c[3, 3]+1.28155946659681*10^15*c[2, 0]*c[2, 3]*c[3, 0]*c[3, 3]+7.80736282336175*10^14*c[2, 0]*c[2, 3]*c[3, 1]*c[3, 2]+2.95015059452266*10^13*c[2, 0]*c[2, 3]*c[3, 0]*c[3, 1]+1.64424324035644*10^10*c[0, 1]*c[0, 3]*c[2, 0]*c[3, 1]+7.80736282336175*10^14*c[2, 0]*c[2, 2]*c[3, 1]*c[3, 3]+3.38624318440755*10^8*c[0, 1]*c[0, 3]*c[1, 1]*c[2, 0]+6.83811849201320*10^14*c[0, 2]*c[2, 1]*c[2, 3]*c[3, 3]+4.96419365552208*10^14*c[1, 1]*c[2, 1]*c[3, 2]*c[3, 3]+4.50722523384354*10^11*c[0, 1]*c[0, 2]*c[1, 3]*c[3, 2]+2.74640085129511*10^12*c[0, 3]^2*c[1, 3]*c[3, 0]+4.53797990504672*10^10*c[0, 2]^2*c[2, 0]*c[2, 3]+2.76260943995885*10^10*c[0, 2]^2*c[2, 1]*c[2, 2]+5.63905988420760*10^10*c[0, 3]^2*c[1, 0]*c[3, 1]+2.74640085129511*10^12*c[0, 3]^2*c[1, 0]*c[3, 3]+5.63905988420760*10^10*c[0, 3]^2*c[1, 1]*c[3, 0]+1.67039675031390*10^12*c[0, 3]^2*c[1, 1]*c[3, 2]+1.67039675031390*10^12*c[0, 3]^2*c[1, 2]*c[3, 1]

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?

First 591 592 593 594 595 596 597 Last Page 593 of 2097