Maple 2021 Questions and Posts

These are Posts and Questions associated with the product, Maple 2021

Could you help me to solve this problem for the parameter beta?

restart;

e1:= 0.5; e2:=0.2;theta:=5;yeq:=e2;

.5

 

.2

 

5

 

.2

(1)

f:=(theta*x-1)*(1-x)*(1+beta*x^2)-y;
g:=x/(1+beta*x^2); gs:=unapply(g,x);

(5*x-1)*(1-x)*(beta*x^2+1)-y

 

x/(beta*x^2+1)

 

proc (x) options operator, arrow; x/(beta*x^2+1) end proc

(2)

fs:=subs(y=yeq,f);

(5*x-1)*(1-x)*(beta*x^2+1)-.2

(3)

assumptions:=x>1/theta, x<1,beta>0,beta<1,gs(x)>e1;
solve(fs=0,x,useassumptions) assuming assumptions;

1/5 < x, x < 1, 0 < beta, beta < 1, .5 < x/(beta*x^2+1)

 

Warning, solve may not respect assumed property 'real' on 'x/(beta*x^2+1)'.

 

Error, (in type/realcons) too many levels of recursion

 

gs2:=subs(beta=0.6,gs(x));

x/(.6*x^2+1)

(4)

sol:= solve(subs(beta=0.6,fs=0),x,useassumptions) assuming x>1/theta, x<1;

.2514854589, .9665623271

(5)

subs(x=sol[1],gs2);

.2422912423

(6)

 

Download Rootsfind.mw

S1 := 441;
S2 := 1109;
S3 := 511;
S4 := 900;
S5 := 2904;
S6 := 285;

S2 + S3 + S4 + S5 + S6;                             
for i to 5 do
    S*[i] + S[i + 1];
end do;
Thank you.

I am trying to create a loop in the Physics package where I am interested in looking at the components of a tensor with one index up and one down. However, when I run the loop it returns the expression with both indices down in my attempts to solve the issue.

I have been fighting with it for an hour now and cant seem to find a fix. Any help will be appreciated, I have attached the file I am working with. 

Thanks in advance. 

LoopQuestion.mw

Why did the last line is(ysol2[1]>0) give false?

Maple does not recognize the assumption?

Thanks in advance.
 

restart;

 

 

interface(showassumed=0);

0

(1)

assume(theta>1,alpha>0,sigma1>0,beta>0,sigma2>0,delta>0,x>0,y>0,z>0);

 

f:=((theta*x-1)*(1-x)-y);
g:=y/(1+beta*y^2);
h:=(alpha*x-sigma1)*(1+beta*y^2);
j:=(delta*g-sigma2);
dxdt:=x*f;
dydt:=g*(h-z);
dzdt:=z*j;

(theta*x-1)*(1-x)-y

 

y/(beta*y^2+1)

 

(alpha*x-sigma1)*(beta*y^2+1)

 

delta*y/(beta*y^2+1)-sigma2

 

x*((theta*x-1)*(1-x)-y)

 

y*((alpha*x-sigma1)*(beta*y^2+1)-z)/(beta*y^2+1)

 

z*(delta*y/(beta*y^2+1)-sigma2)

(2)

case0; x = 0, y = 0, z = 0

E0:=<0,0,0>;

Vector[column](%id = 36893490685786064044)

(3)

"case1: z=0 ,  h(x,y)=0,  f(x,y)=0 :   From y=(theta*x-1)*(1-x)=y -> 1/(theta)<x and x<1"

xsol1:=solve(h=0,x) assuming x>1/theta and x<1;
ysol1:=solve(subs(x=xsol1,f)=0,y)assuming xsol1>1/theta and xsol1<1;
E1:=<xsol1,ysol1,0>;

xsol1 := sigma1/alpha

 

ysol1 := -(-sigma1*theta+alpha)*(alpha-sigma1)/alpha^2

 

Vector[column](%id = 36893490685786055012)

(4)

case2; g(y) = 0, h(x, y) = 0

ysol:=[solve(j=0,y)];
ysol2:=simplify(subs(sigma2=delta*eta,ysol)) assuming (1-4*beta*eta^2>0 and eta>0);

Warning, solve may be ignoring assumptions on the input variables.

 

[(1/2)*(delta+(-4*beta*sigma2^2+delta^2)^(1/2))/(beta*sigma2), -(1/2)*(-delta+(-4*beta*sigma2^2+delta^2)^(1/2))/(beta*sigma2)]

 

[(1/2)*(1+(-4*beta*eta^2+1)^(1/2))/(beta*eta), (1/2)*(1-(-4*beta*eta^2+1)^(1/2))/(beta*eta)]

(5)

is(ysol2[1]>0)

false

(6)

 

(1/2)*(1+(-4*beta*eta^2+1)^(1/2))/(beta*eta)

(7)

 

 


 

Download Project_v1.mw

The command for doing syntactical exact-match substitutions is subs, however, subs applies transformation rules throughout an expression only once. The documentation of eval claims that the (recursive) evaluation is repeated until either the result does not change, the documentation of applyrule claims that applyrule … applies the rules until no rule can be applied any more, and the documentation of MmaTranslator[Mma][ReplaceRepeated] claims that the single ReplaceRepeated command performs replacements until expression no longer changes.
So, if I comprehend correctly, 

restart;
x := [[[[]]]]: # Remove empty lists from x repeatedly.
(*⒈*) eval['recurse'](x, [[] = 'NULL']);
(*⒉*) applyrule([[] = 'NULL'], x);
(*⒊*) MmaTranslator:-Mma:-ReplaceRepeated(x, [[] = NULL])

should all return NULL, but in fact, 

eval['recurse'](x, [[] = 'NULL']);
 = 
                            [[[[]]]]

applyrule([[] = 'NULL'], x);
Error, (in PatternMatching:-AlgStruct:-TableLookup) invalid input: unknown uses a 1st argument, x, which is missing
MmaTranslator:-Mma:-ReplaceRepeated(x, [[] = NULL]);
 = 
                            () = ()

In other words, none of these replacements is feasible. 

Have I missed something? (It seems to me that an explicit procedural do...until loop can be actually avoidable here!) 

restart;

with(Physics):with(plots):with(DETools):

sys := {diff(r(t),t)=p(t)/m,
diff(p(t),t)=l^2/(m*r(t)^3)-n*k*r(t)^(n-1),
diff(phi(t),t)=l/(m*r(t)^2)};

{diff(p(t), t) = l^2/(m*r(t)^3)-n*k*r(t)^(n-1), diff(phi(t), t) = l/(m*r(t)^2), diff(r(t), t) = p(t)/m}

(1)

sys1:=subs({n=1,k=1},sys);

{diff(p(t), t) = l^2/(m*r(t)^3)-1, diff(phi(t), t) = l/(m*r(t)^2), diff(r(t), t) = p(t)/m}

(2)

conv:=plottools:-transform((a,b)->[a*cos(b),a*sin(b)]):

p1:=DEplot(sys1,[r(t),phi(t)],t=0..30,r=0..10,phi=0..2*Pi,stepsize=0.01);

Error, (in DEtools/DEplot) system must have same number of dependent variables as DE's.

 

plots:-display([conv(p1)],axiscoordinates=polar);

Error, (in conv) invalid argument

 

 


Could you help how to fix the code?

Download DEplot_v1.mw

I just downloaded maple 2021 (I get i free from my school). I used maple for the last 4 years but, now when i opdatede to maple 2021 from version 2020, its just keep freezing i have try to uninstall 3 times by now and it still keep freezing.

As2_v2.mw 

What should I fix my code in order to work?

Thanks in advance,

Can Maple carry around an unevaluated/inert  Matrix-Vector product(A matrix product without executing the matrix multiplication)? See Maple sheet.

inert_matrix_products.mw

restart

with(LinearAlgebra)

NULLNULL

Can Maple carry around an unevaluated/inert explicit Matrix-Vector product?

 

Define a matrix K and vector U as:

 

U := `<,>`(u1, u2)

Vector[column](%id = 36893490583464982996)

(1)

K := Matrix(2, 2, symbol = k)

Matrix(%id = 36893490583464975884)

(2)

I can take their product using MatrixVectorMultiply( ) I get,

MatrixVectorMultiply(K, U)

Vector[column](%id = 36893490583464964812)

(3)

however output I am really looking for is

 

(Matrix(2, 2, {(1, 1) = k[1, 1], (1, 2) = k[1, 2], (2, 1) = k[2, 1], (2, 2) = k[2, 2]})).(Vector(2, {(1) = u1, (2) = u2}))

NULL

In the later case, K.U is still a product however the actual matrix multiplication is not carried out. Sure, eventually I will want to evaluate the matrix-vector product but sometimes when setting up a problem I want to look at the explicit matrix equation before any explicit matrix multiplication is carried out.NULL

NULL

Here I show some ideas that don't work but may give a sense of what I am going for. I am essentially trying to mute the computation of the product while keeping the elements of the product together for further substitutions elsewhere. This there a standardized way to complish this? Or do I have to write my own procedure for something like this?

 

`&MatrixVectorMultiply`(K, U)

`&MatrixVectorMultiply`(Matrix(%id = 36893490583464975884), Vector[column](%id = 36893490583464982996))

(4)

%MatrixVectorMultiply(K, U)

%MatrixVectorMultiply(Matrix(%id = 36893490583464975884), Vector[column](%id = 36893490583464982996))

(5)

`&.`(K, U)

`&.`(Matrix(%id = 36893490583464975884), Vector[column](%id = 36893490583464982996))

(6)

K*%.U

`&.`(Matrix(%id = 36893490583464975884), Vector[column](%id = 36893490583464982996))*Matrix(%id = 36893490583464939756).Vector[column](%id = 36893490583464982996)

(7)

NULLNULL

Download inert_matrix_products.mw

After a long hiatus I have come back to the issue of null tetrads in the physics package in light of the updates to  Maple in 2021. I have uploaded a document file to illustrate. See below. My first question concerns the labelling of elements of a null tetrad. After calling the metric 27,37 from Stephani et al, and using Setup to specify a null tetrad, Maple's choice is such that the elements labelled m and bar m are not complex. Rather, both these elements are in fact real, while the elements lablled l and n are complex, with one being the negative complex conjugate of the other. While these are just labels, they don't agree with the usual conventions for the Newman-Penrose formalism, which is disorienting. What convention is Maple using to label the elments of a null tetrad?

Next, I try to specify the null tetrad used by Stephani et al., first by converting it into covariant form (which I did by hand rather than in Maple). In Maple's default null tetrad, the order in which Maple listed the elements of the null tetrad is n, m, bar m, l (as rows in the matrix display for e_[ ]), so I followed that convention (in the conventions of Stephani et al., the first and fourh element should have scalar product -1, the second and third scalar product 1, and all other scalar products zero, which is the case). After entering the matrix and using Setup to specify the null tetrad by the matrix, I get an error message saying that the components of the metric with respect to my tetrad are not just 0, 1, and -1. Yet,  executing eta_[ ]  does not confirm this warning; nor does a computation by hand.

Finally, IsTetrad asserts the tetrad is not null, contrary to the fact that it is a null tetrad.

Since I have followed the conventions implicit in Maple's default null tetrad for this metric, I am puzzled as to what has gone wrong.SKMHH27_37_2021_New.mw

On the other hand, taking into account how Maple 2019 orders the coordinates in Stephani et al 27.37 and labels the null vectors in a null ttetrad, if I translate accordingly what I have in the 2021 Maple file, Maple 2019 confirms Stephani et al.'s null tetrad is indeed a null tetrad, as one would expect. See the following file.SKMHH27_37_2019_Var.mw.

Consider this example:

    h := proc(x)
        printf("h says: %a evaluates to %a.", x, eval(x));
    end proc:
    f := proc()
        local z, g;
        g := proc(x)
            printf("g says: %a evaluates to %a.\n", x, eval(x));
        end proc;
        z := 2;
        g('z');
        h('z');
    end proc:

    > f()
    g says: z evaluates to 2.
    h says: z evaluates to 2.

I can't figure out, whats going on here. Now it comes as no surprise, of course, that g would be able to see z. After all, its definition is within the lexical scope of z. But how can h possibly see z?

When eval is called in h, does eval somehow look into the call stack, and find out it was called by h, which was in turn called by f and then inspect the local variables of f?

Could you explain, what's going on here, please?

Thank you all!

I was looking at symbolically solving a second-order differential equation and it looks like the method=laplace method has a sign error when the coefficients are presented in a certain way.  Below is a picture of some examples with and without method=laplace that should all have the same closed form.  Note that lines (s6) and (s8) have different signs in the exponential than they should have (which is a HUGE problem):

restart

s1 := dsolve([diff(x(t), t, t)+2*a*(diff(x(t), t))+a^2*x(t)], [x(t)])

{x(t) = exp(-a*t)*(_C2*t+_C1)}

(1)

s2 := dsolve([diff(x(t), t, t)+2*a*(diff(x(t), t))+a^2*x(t)], [x(t)], method = laplace)

x(t) = exp(-a*t)*(t*(D(x))(0)+x(0)*(a*t+1))

(2)

s3 := dsolve([diff(x(t), t, t)+2*(diff(x(t), t))/b+x(t)/b^2], [x(t)])

{x(t) = exp(-t/b)*(_C2*t+_C1)}

(3)

s4 := dsolve([diff(x(t), t, t)+2*(diff(x(t), t))/b+x(t)/b^2], [x(t)], method = laplace)

x(t) = exp(-t/b)*(t*(D(x))(0)+x(0)*(b+t)/b)

(4)

s5 := dsolve([diff(x(t), t, t)+2*(diff(x(t), t))/sqrt(L*C)+x(t)/(L*C)], [x(t)])

{x(t) = exp(-(L*C)^(1/2)*t/(L*C))*(_C2*t+_C1)}

(5)

s6 := dsolve([diff(x(t), t, t)+2*(diff(x(t), t))/sqrt(L*C)+x(t)/(L*C)], [x(t)], method = laplace)

x(t) = (t*(D(x))(0)+3*C*L*x(0)*t/(L*C)^(3/2)+x(0))*exp((L*C)^(1/2)*t/(L*C))

(6)

s7 := dsolve([L*C*(diff(x(t), t, t))+2*sqrt(L*C)*(diff(x(t), t))+x(t)], [x(t)])

{x(t) = exp(-(L*C)^(1/2)*t/(L*C))*(_C2*t+_C1)}

(7)

s8 := dsolve([L*C*(diff(x(t), t, t))+2*sqrt(L*C)*(diff(x(t), t))+x(t)], [x(t)], method = laplace)

x(t) = exp(t/(L*C)^(1/2))*(t*(D(x))(0)+x(0)*(L*C+3*(L*C)^(1/2)*t)/(L*C))

(8)

s9 := dsolve([diff(x(t), t, t)+2*z*wn*(diff(x(t), t))+wn^2*x(t)], [x(t)])

{x(t) = _C1*exp((-z+(z^2-1)^(1/2))*wn*t)+_C2*exp(-(z+(z^2-1)^(1/2))*wn*t)}

(9)

s10 := dsolve([diff(x(t), t, t)+2*z*wn*(diff(x(t), t))+wn^2*x(t)], [x(t)], method = laplace)

x(t) = exp(-wn*t*z)*(cosh((wn^2*(z^2-1))^(1/2)*t)*x(0)+(x(0)*wn*z+(D(x))(0))*sinh((wn^2*(z^2-1))^(1/2)*t)/(wn^2*(z^2-1))^(1/2))

(10)

s11 := dsolve([(diff(x(t), t, t))/wn^2+2*z*(diff(x(t), t))/wn+x(t)], [x(t)])

{x(t) = _C1*exp((-z+(z^2-1)^(1/2))*wn*t)+_C2*exp(-(z+(z^2-1)^(1/2))*wn*t)}

(11)

s12 := dsolve([(diff(x(t), t, t))/wn^2+2*z*(diff(x(t), t))/wn+x(t)], [x(t)], method = laplace)

x(t) = exp(-wn*t*z)*(cosh((wn^2*(z^2-1))^(1/2)*t)*x(0)+(x(0)*wn*z+(D(x))(0))*sinh((wn^2*(z^2-1))^(1/2)*t)/(wn^2*(z^2-1))^(1/2))

(12)

s13 := dsolve([(diff(x(t), t, t))/wn^2+2*z*(diff(x(t), t))/wn+x(t)], [x(t)])

{x(t) = _C1*exp((-z+(z^2-1)^(1/2))*wn*t)+_C2*exp(-(z+(z^2-1)^(1/2))*wn*t)}

(13)

s14 := dsolve([(diff(x(t), t, t))/wn^2+2*z*(diff(x(t), t))/wn+x(t)], [x(t)], method = laplace)

x(t) = exp(-wn*t*z)*(cosh((wn^2*(z^2-1))^(1/2)*t)*x(0)+(x(0)*wn*z+(D(x))(0))*sinh((wn^2*(z^2-1))^(1/2)*t)/(wn^2*(z^2-1))^(1/2))

(14)

NULL

Download DsolveLaplaceIssues.mw

Hello Everyone, 

My questions is about a straight forward as my title suggests. I know how to compute the variation by hand and of course it is in plently of books, but I would like to know how I could possibly do it in Maple as I have some terms with non-trivial contributions where I infact need that specific variation. 

I have attached my file I have been working with that has more comments.

RicciAction.mw

Thank you

Hello,

I am trying to solve the self similarity problem for external natural convection which is the following coupled problem

  •     3/4*F(eta)*Theta(eta)'  = Theta(eta)''
  •     1/2 (F(eta)')^2 - 3/4 F(eta)*F(eta)'' = Pr*(Theta(eta) - F(eta)''')

where Pr is a constant and  ()' denotes differentiation with respect to eta. The boundary conditions are:

  •     at eta = 0, F = 0, F'=0, Theta = 1
  •     at eta -> infinity, F' = 0, Theta = 0

I tried the following but I cannot obtain a solution

``

Pr:=1

1

(1)

etamax := infinity

infinity

(2)

``

eq:= 3/4*F(eta)*diff(theta(eta),eta) = diff(theta(eta),eta,eta),1/Pr*(1/2*diff(F(eta),eta)^2 - 3/4*F(eta)*diff(F(eta),eta,eta)) = -diff(F(eta),eta,eta,eta) + theta(eta)

(3/4)*F(eta)*(diff(theta(eta), eta)) = diff(diff(theta(eta), eta), eta), (1/2)*(diff(F(eta), eta))^2-(3/4)*F(eta)*(diff(diff(F(eta), eta), eta)) = -(diff(diff(diff(F(eta), eta), eta), eta))+theta(eta)

(3)

NULL

 

NULL

bcs := F(0) = 0, theta(0)=1, D(F)(0)=0,theta(etamax)=0,D(F)(etamax)=0

F(0) = 0, theta(0) = 1, (D(F))(0) = 0, theta(infinity) = 0, (D(F))(infinity) = 0

(4)

NULL

sol:=dsolve([eq,bcs],[F(eta),theta(eta)])

``

Download wip.mw

restart;
with(geometry):
with(plots):
_EnvHorizontalName = 'x':
_EnvVerticalName = 'y':
EQ := proc(M, N) 
local eq, sol; 
eq := simplify(expand((y - M[2])/(x - M[1]) - (N[2] - M[2])/(N[1] - M[1]))); 
sol := solve(eq, y); 
RETURN(y = sol); end proc:
_local(D);
point(A, [-2, 7]):
point(B, [-5, -2]):
point(C, [8, -7]):
point(E, [1, 4]):
EQ([-5, -2], [8, -7]):
point(D, [1, subs(x = 1, rhs(%))]):
dsegment(sgAD, [A, D]):
BD := distance(B, D):
DC := distance(C, D):
triangle(ABC, [A, B, C]):
area(ABC):
triangle(ABD, [A, B, D]):
area(ABD):
triangle(ADC, [A, D, C]):
area(ADC):
is(area(ABD)/area(ADC) = BD/DC):
triangle(EBD, [E, B, D]):
area(EBD):
triangle(EDC, [E, D, C]):
area(EDC):
triangle(AEC, [A, E, C]):
area(AEC):
triangle(ABE, [A, B, E]):
area(ABE):
is(area(ABE)/area(AEC) = BD/DC):
display*([draw*[A(color = black, symbol = solidcircle, symbolsize = 6), 
B(color = black, symbol = solidcircle, symbolsize = 6), 
C(color = black, symbol = solidcircle, symbolsize = 6), 
ABC(color = blue)], 
textplot*([[coordinates(A)[], "A"], 
[coordinates(B)[], "B"], 
[coordinates(C)[], "C3"]], 
align = [above, right])], 
axes = none, 
title = "Lemme du Chevron");
The program simply reproduces display...Why; Thank you.
display*([draw*[A(color = black, symbol = solidcircle, symbolsize = 12), B(color = black, symbol = solidcircle, symbolsize = 12), C(color = black, symbol = solidcircle, symbolsize = 12), ABC(color = blue)], textplot*([[-2, 7, "A"], [-5, -2, "B"], [8, -7, "C3"]], align = [above, right])], axes = none, title = "Lemme du Chevron")

First 6 7 8 9 10 11 12 Last Page 8 of 39