Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

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+`Φ__∓` = h

(1/2)*m*(diff(phi, xi))^2+`Φ__∓` = h

(2)

NULL

`Φ__∓` = `&-+`(1-cos(phi))

`Φ__∓` = `&-+`(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
 

I solved the differential equation using 'dsolve' and Maple returns it with fiver possible solutions. How can we get the single possible solution for w(x) if we assume c, g (constants) are positive? Also, can we convert JacobiSN() to a simple trigonometric or algebraic function?

restart

with(DEtools)

``

q := (1/2)*(diff(w(x), x))^2+(1/8)*w(x)^4-(1/2)*c*w(x)^2-g = 0

(1/2)*(diff(w(x), x))^2+(1/8)*w(x)^4-(1/2)*c*w(x)^2-g = 0

(1)

dsolve((1/2)*(diff(w(x), x))^2+(1/8)*w(x)^4-(1/2)*c*w(x)^2-g = 0, {w(x)})

w(x) = (2*c+2*(c^2+2*g)^(1/2))^(1/2), w(x) = (-2*(c^2+2*g)^(1/2)+2*c)^(1/2), w(x) = -(2*c+2*(c^2+2*g)^(1/2))^(1/2), w(x) = -(-2*(c^2+2*g)^(1/2)+2*c)^(1/2), w(x) = 2*JacobiSN((1/2)*(-2*c+2*(c^2+2*g)^(1/2))^(1/2)*x+_C1, ((c*(c^2+2*g)^(1/2)-c^2-g)*g)^(1/2)/(c*(c^2+2*g)^(1/2)-c^2-g))*g/(g*(-c+(c^2+2*g)^(1/2)))^(1/2)

(2)

``

``

Download solve.mw

Hello,

I have a problem to export datas in an excel file.

I have no problem to read some datas in this file, but when i want to write a matrix 1x1 in a cell, there is no error message but nothing happen in the file.

Here is my program :

with(ExcelTools);

kernelopts(datadir);

File1 := FileTools:-JoinPath(["Excel", "test.xlsx"], base = datadir);
Mat1 := Import(File1, "Somme", "G2:G8"); # it runs very well
R := array(1 .. 1, 1 .. 1, [[564]]);
Export(R, "test.xlsx", "Somme", "G1"); # nothing happens in the file

Thank you very much for help

Hello everyone, 

I have a function C that depends on Omega and mu_s values. I am trying to get a 3d plot of C for certain Omega and mu_s values. First, I got the graph for Omega=0.1..10, mu_s=0.1..0.6 (red plot). Then, for Omega=0.1..50, mu_s=0.1..0.6 (green plot). In the second case, I expected the first part of the graph to be the same as before, but with values of C for Omega till 50. However, the first part of the plot changes as well. I do not understand why. Can someone help me with it, please?

I would really appreciate it! 

Thank you!!

First 151 152 153 154 155 156 157 Last Page 153 of 2097