MaplePrimes Questions

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.

Hi,

everyone! I want to get a system of equations (Fig. 1). But my result is a table (Fig. 2), so I wonder how to convert a table into a sequence or a system. And I am very sorry that my code is not concise, since I am a beginner. Thank you very much!

Download Equations.mw

Hello,

I'm in the process of making a resonant LLC calculator to define Lr,Lm and Cr. In short, to do this I need to define the fonction of the Gain for different Qualifty factor at a given m value m. My issue is that the below code returns different results everytime. I'm trying to get the value at the top of the Q curve using the maximise fonction and trying to solve wx for that maximum value. Anybody can see what am I doing wrong. Sometime it outpiuts an imaginary number where sometime it doesn't. The expression seems correct as its producing the correct plot/curve.

Thank you for the help.

> restart:with(plots):
> m:=6.3:
> Q1:=1:
> GainQ1:=(8/(Pi^2))*((wx^2)*(m-1))/(sqrt((((m*wx^2)-1)^2)+(Q1^2*wx^2)*((wx^2-1)^2)*((m-1)^2))):
> semilogplot({GainQ1},wx=0.2...2,Gain,axes=boxed,thickness=5,title=`Gain (w, Q, m)`):
> Top_of_Q1:=eval(maximize(GainQ1),wx=0.1..2);wx:=solve(GainQ1=Top_of_Q1);
 

Hello Iam following this tutorial to solve pde with laplace transforms  but have a problem with eval which is not evaluating the following expression
restart;
with(PDEtools);
with(inttrans);

# Equations for c in physical space
PDE1 := diff(c(r, t), t) = K_1*diff(r*diff(c(r, t), r), r)/r;

#initial condition
ic1 := c(r, 0) = V

# Equation in Laplace space
PDEL1 := laplace((lhs - rhs)(PDE1), t, p);

# Apply initial condition to simplify
simplified_PDEL1 := eval(PDEL1*{ic1})

which is displayed (an treated) as

with c(r,0) not being replaced by V. When I try to solve the problem with dsolve I get the following error

Error, (in dsolve) invalid input: `PDEtools/NumerDenom` expects its 1st argument, ee, to be of type algebraic, but received {c(r, 0) = V}

If I replace manually C(r,0) by V then the error dissapears. Is this how eval is supposed to behave ?

Cheers,

Hello,

I need to work with the shapiro-wilks statistical test for the normaility of the population.

I remark that the precision of this test with Maple is not very good.

I try the same test with STATISTICA, STHDA and  XLSTAT. 

For p-value, I obtained 0.3478, 0.3439 and 0.348 with the 3 others softs and 0.4146 with Maple.

For the W, I obtained 0.986, 0.9825 and 0.983 with the 3 others and 0.9761 with Maple.

My sample has 80 elements, risk 0,05.

Is there anybody to explain this difference between the results and perhaps to confirm if it does exist a best method with Maple.

The test : 

pvalue2 := Statistics:-ShapiroWilkWTest(Mat2, level = 0.05, output = 'pvalue')
statvalue2 := Statistics:-ShapiroWilkWTest(Mat2, level = 0.05, output = 'statistic')

Thank you very much for help.

Hello,

I am trying to recover with maple the analytical solution of the problem of conduction within two composite cylinders given in Carslaw and Jeager's book: "Conduction of heat in solids" (link here). Here is my take on the problem

restart;
with(PDEtools);
C := diff_table(c(rho, t));
E := diff_table(e(rho, t));
PDE1 := diff(C[], t) - K_1*(diff(diff(C[], rho), rho) - diff(C[], rho)/rho) = 0;     
PDE2 := diff(E[], t) - K_2*(diff(diff(E[], rho), rho) - diff(E[], rho)/rho) = 0;       

ic1 := eval(C[], t = 0) = V;
ic2 := eval(E[], t = 0) = 0;

bc_1 := eval(C[], rho = a) = eval(E[], rho = a);
bc_2 := K_1*eval(diff(C[], rho), rho = a) = K_2*eval(diff(E[], rho), rho = a);
bc_3 := eval(E[], rho = infinity) = 0;
bc_4 := (diff(C[]/rho, rho), rho = 0) = 0;
pdsolve([PDE1, PDE2],[ic1,ic2, bc_1,bc_2,bc_3,bc_4]); 

Unfortunately I end up with the following errors:

Error, (in pdsolve/sys) too many arguments; some or all of the following are wrong: [{c(rho, t), e(rho, t)}, [c(rho, 0) = V, e(rho, 0) = 0, c(a, t) = e(a, t), K_1*(diff(c(a, t), a)) = K_2*(diff(e(a, t), a)), e(infinity, t) = 0, ((diff(c(rho, t), rho))/rho-c(rho, t)/rho^2, rho = 0) = 0]]

If I call pdsolve without any initial and boundary conditions, I have the general form of the equation which is correct (product of exponential function in time with Bessel functions for space) but I don't know how to determine the coeficients with maple from there.

 

Note also that the boundary condition "bc_2" does not seem to be correcty evaluated (it is supposed to specify the continuity of the flux ar r=a). Instead it just evaluate the expression with r swapped with a. If one write the same line of code with r=0 instead of r=a then the evaluation seems correct.

Any help would be very appreciated,

Cheers

Hello,

I have a problem with the type of the pvalue in the Shapiro-Wilks test.

My program :

pv := ShapiroWilkWTest(Mat1, level = 0.05);
whattype(pv);  list  
eval(pv[2]);  "pvalue = 0.25..."  This result is an element of a list but not a real number

I would like to obtain the real value of pvalue in order to make a calulous with it.

I have tried as an example in Maple :

pv := ShapiroWilkWTest(Mat1, level = 0.05,output=pvalue); but it doesn't run.

May someone help me? Thank you very much
 

First 15 16 17 18 19 20 21 Last Page 17 of 2172