MaplePrimes Questions

I have a matrix and generate difference tables from it's diagonals. Works fine. Then I make a polynomial from the first row of the difference table. I have three polynomials. They are all acting inert, just will not evaluate.

I cannot see what the problem is.
 

restart

interface(rtablesize = 12)

[10, 10]

i) Recurrence relation

 

"Recurrence Relation for next column. . The matrix starts at 1,1 not 0,0 A(i,j)=A(i-1,j-1)*(j-2)+A(i,j-1)"
``

NULL``

Msize := 12

A := Matrix(Msize)

A[1, 1] := 1

1

for i from 2 to Msize do for j from i to Msize do A[i, j] := A[i, j-1]*(j-2)+A[i-1, j-1] end do end do

A

Matrix(%id = 36893489695842121836)

``

``

viia)  General formula for diagonals:-

Select diagonal  & Difference Table procedures

 

diag := proc (M::Matrix, dg::posint) local i, rd, c, dt; rd := LinearAlgebra:-RowDimension(M); dt := Matrix(rd, rd); for i from dg to rd do dt[1+i-dg, 1] := M[1+i-dg, i] end do; return dt end proc

proc (M::Matrix, dg::posint) local i, rd, c, dt; rd := LinearAlgebra:-RowDimension(M); dt := Matrix(rd, rd); for i from dg to rd do dt[1+i-dg, 1] := M[1+i-dg, i] end do; return dt end proc

diag(A, 5)

Matrix(%id = 36893489695866397388)

diftab := proc (M::Matrix) local i, j, cl, rd; rd := LinearAlgebra:-RowDimension(M); for i from rd by -1 to 1 do if M[i, 1] = 0 then rd := rd-1 else break end if end do; cl := rd; for i from 2 to cl do for j to rd-i do M[j, i] := M[j+1, i-1]-M[j, i-1] end do end do; print(M); return M end proc

proc (M::Matrix) local i, j, cl, rd; rd := LinearAlgebra:-RowDimension(M); for i from rd by -1 to 1 do if M[i, 1] = 0 then rd := rd-1 else break end if end do; cl := rd; for i from 2 to cl do for j to rd-i do M[j, i] := M[j+1, i-1]-M[j, i-1] end do end do; print(M); return M end proc

diftab(diag(A, 4))

Matrix(%id = 36893489695866348116)

gnrpoly := proc (M::Matrix) local i, p, rd, n; rd := LinearAlgebra:-RowDimension(M); for i from rd by -1 to 1 do if M[1, i] = 0 then rd := rd-1 else break end if end do; p := 0; for i from 0 to rd-1 do p := p+M[1, i+1]*binomial(n, i) end do; return p end proc

proc (M::Matrix) local i, p, rd, n; rd := LinearAlgebra:-RowDimension(M); for i from rd by -1 to 1 do if M[1, i] = 0 then rd := rd-1 else break end if end do; p := 0; for i from 0 to rd-1 do p := p+M[1, i+1]*binomial(n, i) end do; return p end proc

"for i from 0 to 3 do print("Diagonal  ",i);   eqn:=gnrpoly(diftab(diag(A,i+1)));    cat(poly,i):=unapply(factor(expand(eqn)),n);    print("--------------------------------------------------------------");  end do"

"--------------------------------------------------------------"

NULL

``

``

The equations do not evaluate. They are acting inert

poly1(n)

(1/2)*n*(1+n)

poly1(2)

(1/2)*n*(1+n)

poly2(n)

(1/24)*n*(3*n+5)*(n+2)*(n+1)

poly2(3)

(1/24)*n*(3*n+5)*(n+2)*(n+1)

poly3(n)

(1/48)*n*(n+1)*(n+3)^2*(n+2)^2

poly3(-1)

(1/48)*n*(n+1)*(n+3)^2*(n+2)^2

eqn

6*n+38*binomial(n, 2)+93*binomial(n, 3)+111*binomial(n, 4)+65*binomial(n, 5)+15*binomial(n, 6)

value(eval(eqn, n = 4))

6*n+38*binomial(n, 2)+93*binomial(n, 3)+111*binomial(n, 4)+65*binomial(n, 5)+15*binomial(n, 6)

eqn1 := expand(eqn)

(3/4)*n+2*n^2+(97/48)*n^3+(47/48)*n^4+(11/48)*n^5+(1/48)*n^6

eval(eqn1, [n = 4])

(3/4)*n+2*n^2+(97/48)*n^3+(47/48)*n^4+(11/48)*n^5+(1/48)*n^6

NULL


 

Download Q_10-10-22_gentrate_eqn.mw

convert(series(f(x),x,10),list) will produce a list with exponents rather than 0's. Is there a natural way to simply get a list with 0 padding? Also, can one make their own type converter?  (obviously I can make a procedure but talking about something in accordance with convert)

This forum complains when I paste an image of my Maple Flow work, asking that I copy and paste the content, instead of the image. How do I accomplish content copy and paste with Maple Flow?

I have never use Maple before and have the following equation

ca, cb, Ka, Kb, Kw and Va are either constants or pre-determined (Va).  I know it should be easy to tabulate/calculate values of Vb for given values of [H+] (hydrogen ion concentration) but how easy would it be to determine values of [H+] for selected values of Vb?  Would it be easy to set up bearing in mind my lack of experience?

Not all of the units I work with are available directly in Maple Flow (torque, especially). Can I create new units in some manner? How does Maple Flow handle conversions? The following is an attempt to coerce desired units that does not work:

Hi everyone 

I would like to plot something in 3d. I have to functions both depending on the time. (x(t), z(t))

I can plot in 2d: (t, x(t)) or (t,z(t)) or (x(t), z(t)) 

Now I want to show the flight path (x(t), z(t)) over time t. So I thought a 3d plot would be suitable for this. 

The problem is that I dont know how to plot this. With plot3d I am only able to plot some planes. What I want to plot is the flight path in the 3d room with the axis x(t),z(t) and t.

Does anybody know how to do this?

thanks in advance!

L’éventail de la Geisha
restart:with(plots):with(geometry):
NULL;
_EnvHorizontalName := 'x':
_EnvVerticalName := 'y':

NULL;
EqBIS := proc(P, U, V) 
local a, eq1, M1, t, PU, PV, bissec1; 
description "P est le sommet de l'angle dont on chercche la bissectrice" ;
a := (P - U)/LinearAlgebra:-Norm(P - U, 2) + (P - V)/LinearAlgebra:-Norm(P - V, 2); 
M1 := P + a*t; eq1 := op(eliminate({x = M1[1], y = M1[2]}, t)); 
RETURN(op(eq1[2])); end proc:

with(plottools);
with(plots);


r1 := 1/2;
r2 := r1/2;
R := r1*(21 - 12*sqrt(3));
                            21      (1/2)
                       R := -- - 6 3     
                            2            

a := arc([0, 0], 2*r1, Pi/6 .. (5*Pi)/6);
b := arc([0, 0], r1, Pi/6 .. (5*Pi)/6);


with(geometry);
eq := EqBIS(<sqrt(3)/2, 1/2>, <0, 0>, <0, 1/2>);
line(bis, eq);
                         (1/2)                  
                eq := 2 3      y - 2 x + 4 y - 2

                              bis

OpT := 2*sqrt(r1*R);
line(lv, x = OpT);
intersection(Omega, bis, lv);
coordinates(Omega);
evalf(%);
                                (1/2)    
                      OpT := 2 3      - 3

                               lv

                             Omega

                 [                / (1/2)    \]
                 [   (1/2)      2 \3      - 1/]
                 [2 3      - 3, --------------]
                 [                     (1/2)  ]
                 [                2 + 3       ]

                  [0.464101616, 0.3923048456]

retarrt;
with(plots);
with(plottools);
[cos((5*Pi)/6), sin((5*Pi)/6)];
                        [  1  (1/2)  1]
                        [- - 3     , -]
                        [  2         2]

a := arc([0, 0], 2*r1, Pi/6 .. (5*Pi)/6);
b := arc([0, 0], r1, Pi/6 .. (5*Pi)/6);
NULL;
A:=[cos(Pi/6), sin(Pi/6)];
B:=[cos(5*Pi/6), sin(5*Pi/6)];
Oo:=[0,0];
Op:=[0,1/2];
poly:=[A,B,Oo];
R := r1*(21 - 12*sqrt(3))
                            [1  (1/2)  1]
                       A := [- 3     , -]
                            [2         2]

                           [  1  (1/2)  1]
                      B := [- - 3     , -]
                           [  2         2]

                          Oo := [0, 0]

                                [   1]
                          Op := [0, -]
                                [   2]

                [[1  (1/2)  1]  [  1  (1/2)  1]        ]
        poly := [[- 3     , -], [- - 3     , -], [0, 0]]
                [[2         2]  [  2         2]        ]

                            21      (1/2)
                       R := -- - 6 3     
                            2            


Omega := [2*sqrt(3) - 3, 2*(sqrt(3) - 1)/(2 + sqrt(3))];
Omega1 := [3 - 2*sqrt(3), 2*(sqrt(3) - 1)/(2 + sqrt(3))];

                     [                / (1/2)    \]
                     [   (1/2)      2 \3      - 1/]
            Omega := [2 3      - 3, --------------]
                     [                     (1/2)  ]
                     [                2 + 3       ]

                     [                 / (1/2)    \]
                     [    (1/2)      2 \3      - 1/]
           Omega1 := [-2 3      + 3, --------------]
                     [                      (1/2)  ]
                     [                 2 + 3       ]


r3 := 3/16;
EF := sqrt(r3);

                                  3 
                            r3 := --
                                  16

                               1  (1/2)
                         EF := - 3     
                               4       

r := (150 - 72*sqrt(3))/193*1/2;
alpha := -5/3*r + 1/2*1/2;
p := sqrt(3)/3*1/2 - sqrt(3)/18*r;
                          75    36   (1/2)
                     r := --- - --- 3     
                          193   193       

                             307   60   (1/2)
                  alpha := - --- + --- 3     
                             772   193       

               1  (1/2)   1   (1/2) /75    36   (1/2)\
          p := - 3      - -- 3      |--- - --- 3     |
               6          18        \193   193       /

p2 := textplot([[A[], "A"], [B[], "B"], [Oo[], "O"]], align = ["above", "right"]);
display(a, b, p2, polygonplot(poly, thickness = 3, color = blue, transparency = 0.3), circle(Omega, R, color = blue, filled = true), circle(Omega1, R, color = blue, filled = true), circle([0, 3/4], 1/4, color = yellow, filled = true), circle([EF, 1/2 + r3], r3, color = green, filled = true), circle([-EF, 1/2 + r3], r3, color = green, thickness = 5), circle([p, 3/4 + alpha], r, color = red, thickness = 5), circle([-p, 3/4 + alpha], r, color = red, thickness = 5), axes = none, scaling = constrained, size = [500, 500]);
how to put color inside circles ? Thabk you.

There are a couple of warnings in the Maple Code Editor that are unneccessary. Those are valid parameters of in Maple functions.

Would it be possible to have those removed in future editions?

Info: Line 794: These names were used as global names but were not declared: enabled
Info: Line 837: These names were used as global names but were not declared: itemList
Info: Line 847: These names were used as global names but were not declared: nolist
Info: Line 854: These names were used as global names but were not declared: selectedindex
Info: Line 905: These names were used as global names but were not declared: nolist
Info: Line 910: These names were used as global names but were not declared: itemList
Info: Line 911: These names were used as global names but were not declared: selectedindex
Info: Line 961: These names were used as global names but were not declared: enabled
Info: Line 992: These names were used as global names but were not declared: unit_free

The "new puzzle" button is not working on the "Challege of the Cahllenger Puzzle" page. Can this be reactivated?

I want to set the EQ equations equal to zero and get the answers for a[0], a[1], b[1], c . How might I achieve this?

I am trying to produce a two-dimensionanl grid spanned by 2 non-standard vectors as shown below.  How might I achieve this?

How to draw a phase portrait of (2) same as in the attached figure? I tried it by using dsolve, but couldn't redraw it.  

restart

with(DEtools); with(plots)

alias(phi = phi(xi))

phi

(1)

eq := (1/2)*m*(diff(phi, xi))^2+`&Phi;__&mnplus;` = h

(1/2)*m*(diff(phi, xi))^2+`&Phi;__&mnplus;` = h

(2)

NULL

`&Phi;__&mnplus;` = `&-+`(1-cos(phi))

`&Phi;__&mnplus;` = `&-+`(1-cos(phi))

(3)

``

Download PP.mw

I want to solve for y in   exp(sqrt(y))= tanh(x) and get y=ln( tanh(x)^2).  But unable to figure what options or assumptions Maple needs.

For reference, here is Mathematica solution that I'd like to duplicate in Maple

Here is my Maple attempts, which uses same assumptions, but Maple solution converts the tanh(x) into exponentials which is much more complicated to look at. I tried to also simplify the answer to tanh(x) but no success so far.

Any ideas what else to try for solve? 

I know that PDEtools:-Solve does the job. Which is why I find this strange. I thought that both PDEtools:-Solve and solve end up using same core code at one point. May be I should switch all my code to use PDEtools:-Solve?  Should not solve here have given same answer as PDEtools:-Solve?

Maple 2022.1 on windows 10.

eq:=sqrt(exp(y))=tanh(x);

(exp(y))^(1/2) = tanh(x)

sol:=solve(eq,y) assuming y::real, x>0

ln((-1+(exp(x))^2)^2/((exp(x))^2+1)^2)

simplify(sol)  assuming real, x>0;
convert(%,trigh)

2*ln(exp(2*x)-1)-2*ln(exp(2*x)+1)

2*ln(cosh(2*x)+sinh(2*x)-1)-2*ln(cosh(2*x)+sinh(2*x)+1)

sol:=PDEtools:-Solve(eq,y) assuming y::real, x>0

y = 2*ln(tanh(x))

 

Download oct_9_2022_simplifcation.mw

Hi,

I have developed a series of two dimension PDE equations (x,t) and I am going to solve them numerically in Maple. 

However, after putting all equations, initial conditions and boundary conditions, I faced couple of errors. I would be grateful if you kindly look at the code and let me know how I can solve it.

Thank you

Here is the code:


restart: with(plots): with(LinearAlgebra):

L:=0.003:   # thickness
rho_w:=997.77:
rho_s:=1419:
lambda_s:=0.46:
lambda_w:=0.644:
lambda_g:=0.026:
cp_s:=3734:
cp_w:=4183:
cp_v:=1900:
cp_a:=1005.68:
M_v:=18.016:
M_a:=28.966:
R:=8.314:
epsilon:= t -> 0.9*(1-t/10):
Cw0:=6:
Sw0:= Cw0/rho_w/epsilon(0):
pi:=3.1415:
p0:=patm:
patm:=10^5:
T0:=256:
p_air:=0.2*19724:
h_m:=0.017904:
h_T:=16.746:
T_air:=380:

Xdb:= (x,t) -> S(x,t):
Cw:= (x,t) ->  rho_w*epsilon(t)*S(x,t):  
Cg:= (x,t) -> rho_g(x,t)*epsilon(t)*(1-S(x,t)):
Cv:= (x,t) -> rho_v(x,t)*epsilon(t)*(1-S(x,t)):
Ca:= (x,t) -> rho_a(x,t)*epsilon(t)*(1-S(x,t)):
nw:= (x,t) -> -rho_w* k_rw(x,t)*K(t)/(mu_w(x,t))*(diff(p(x,t),x)-D_c(x,t)*diff(Cw(x,t),x) ):
ng:= (x,t) -> -rho_g(x,t)* k_rg(x,t)*K(t)/(mu_g(x,t))*(diff(p(x,t),x)):
nv:= (x,t) -> -w_v(x,t)*rho_g(x,t)* k_rg(x,t)*K(t)/(mu_g(x,t))*(diff(p(x,t),x))-binary(x,t):
na:= (x,t) -> -(1-w_v(x,t))*rho_g(x,t)* k_rg(x,t)*K(t)/(mu_g(x,t))*(diff(p(x,t),x))+binary(x,t):
M_g:= (x,t) -> M_v*w_v(x,t)+M_a*(1-w_v(x,t)):
rho_g:= (x,t) -> p(x,t)*M_g(x,t)/R/T(x,t):
rho_v:= (x,t) -> rho_g(x,t)*w_v(x,t):
rho_a:= (x,t) -> rho_g(x,t)*(1-w_v(x,t)):
binary:= (x,t) -> rho_g(x,t)*epsilon(t)*(1-S(x,t))*Deff(x,t)*diff(w_v(x,t),x):
Deff:= (x,t) -> 2.3*10^(-5)*p0/p(x,t)*(T(x,t)/T0)^1.81*(epsilon(t)*(1-S(x,t)))^(4/3):
mu_w:= (x,t) -> rho_w*exp(-19.143+1540/T(x,t)):
mu_g:= (x,t) -> 0.017/1000*(T(x,t)/273)^0.65:
p_veq:= (x,t) -> p_vsat(x,t)*a_w(x,t):
p_vsat:= (x,t) -> exp(-5800.2206/T(x,t)+1.3915-0.0486*T(x,t)+0.4176*10^(-4)*T^2-0.01445*10^(-7)*T^3+6.656*ln(T(x,t))):
a_w:= (x,t) -> exp(-0.182*Xdb(x,t)^(-0.696)+0.232*exp(-43.949*Xdb(x,t))*Xdb(x,t)^0.0411*ln(p_vsat(x,t))):
h_fg:= (x,t) -> 3167.2-2.432*T(x,t):
I_vap:= (x,t) -> M_v*K_eff*(p_veq(x,t)-p(x,t))/R/T(x,t):
K_eff:=1000:
rhocp:= (x,t) -> w_v(x,t)*epsilon(t)*(1-S(x,t))*rho_g(x,t)*cp_v+(1-w_v(x,t))*epsilon(t)*(1-S(x,t))*rho_g(x,t)*cp_a+epsilon(t)*S(x,t)*rho_w*cp_w+(1-epsilon(t))*rho_s*cp_s:
lambda:= (x,t) -> epsilon(t)*(1-S(x,t))*lambda_g+epsilon(t)*S(x,t)*lambda_w+(1-epsilon(t))*lambda_s:
ncp:= (x,t) -> nv(x,t)*cp_v+na(x,t)*cp_a+nw(x,t)*cp_w:
k_rw:= (x,t) -> S(x,t)^3:
k_rg:= (x,t) -> 1.01*exp(-10.86*S(x,t) ):
K:= t -> 10^(-10)*(1-t/10):
D_c:= (x,t) -> 10^(-8)*exp(-2.8+2*Xdb(x,t)):

PDE_m1:=diff(Cw(x,t),t)+ diff(nw(x,t),x)=-I_vap(x,t) :
PDE_m2:=diff(Ca(x,t),t)+ diff(na(x,t),x)=0 :
PDE_m3:=diff(Cg(x,t),t)+ diff(ng(x,t),x)=I_vap(x,t) :
PDE_T:=diff(rhocp(x,t),t)+ diff(ncp(x,t)*T(x,t),x)=diff( lambda(x,t)*diff(T(x,t),x),x) -h_fg(x,t)*I_vap(x,t):

IBC_S:={S(x,0)=Sw0, D[1](Cw)(0,t)=0, subs(x=L,nw(x,t))=epsilon(t)*S(L,t)*h_m/R/T(L,t)*(p_veq(L,t)-p_air) }:
IBC_p:={D[1](p)(0,t)=0,p(L,t)=patm,p(x,0)=patm}:
IBC_T:={h_T*(T(L,t)-T_air)+epsilon(t)*S(L,t)*h_m/R/T(L,t)*(p_veq(L,t)-p_air)*h_fg(L,t)=0, T(x,0)=T_air, D[1](T)(0,t)=0}:
IBC_w:={w_v(x,0)=0.0262, subs(x=L,nv(x,t))=epsilon(t)*(1-S(L,t))*h_m/R/T(L,t)*(p_veq(L,t)-p_air), D[1](w_v)(0,t)=0 }:

pds:=pdsolve(PDE_m1,PDE_m2,PDE_m3,PDE_T,{IBC_S,IBC_p,IBC_T,IBC_w},numeric);
 

Hello,

I would like to automize some calculations which are variables changements.

ChgtVariables_VERS_INT:=
diff(theta[1](t),t$2)=ddq1,
diff(theta[1](t),t)=dq1,
theta[1](t)=q1,
diff(theta[2](t),t$2)=ddq2,
diff(theta[2](t),t)=dq2,
theta[2](t)=q2,
diff(theta[3](t),t$2)=theta3_dd,
diff(theta[3](t),t)=theta3_d,
theta[3](t)=q3;

 

how can i do to make variables qi, dqi, ddqi with i which can change?

I think that is just a question of string but i'm not very used to use this.

I thank you in advance for your help.

First 19 20 21 22 23 24 25 Last Page 21 of 2176