Maple 2022 Questions and Posts

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

I'd like to be able to define functions with units and then use them.

In the example below, things don't work with Maple input. I've shown one example, with the function f2.

It seems to work better with 2D input, but it seems that it is not possible to make plots.

In the example below, I define f4 as a function of two variables that returns a function of one variable.

I'd like to call the outer function, obtain a function as a result (r1 below) and then plot the latter.

restart

with(Units:-Simple)

NULL

f1 := proc (x) options operator, arrow; x*Unit('m') end proc

proc (x) options operator, arrow; Units:-Simple:-`*`(x, Unit('m')) end proc

(1)

f1(2)

2*Units:-Unit(m)

(2)

f2:=x->xUnit(m)

Units:-Unit(m)

(3)

f2(2)

f2(2)

(4)

f3 := proc (x, y) options operator, arrow; x*Unit('m')*y*Unit('m') end proc

proc (x, y) options operator, arrow; Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(x, Unit('m')), y), Unit('m')) end proc

(5)

f3(2, 3)

6*Units:-Unit(m^2)

(6)

f4 := proc (x, y) options operator, arrow; proc (z) options operator, arrow; x*Unit('m')*y*Unit('m')*z*Unit('m') end proc end proc

proc (x, y) options operator, arrow; proc (z) options operator, arrow; Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(x, Unit('m')), y), Unit('m')), z), Unit('m')) end proc end proc

(7)

r1 := f4(2, 3)

proc (z) options operator, arrow; Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(2, Unit('m')), 3), Unit('m')), z), Unit('m')) end proc

(8)

r1(4)

24*Units:-Unit(m^3)

(9)

plot(r1)

 

NULL

The contents above aren't showing the error that Maple gives when I try to plot.

Here is a screenshot

Download FunctionUnits.mw

I have a variable with the unit Volt.

I'd like to print something like "The voltage is %f" where the floating point is the value of the variable with the unit.

I've tried the options below so far.

How would one accomplish this?

with(Units:-Simple)

NULL

x := 5*Unit('V')

5*Units:-Unit(V)

(1)

printf(x)

Error, (in fprintf) format string expected

 

printf("%f", x)

Error, (in fprintf) number expected for floating point format

 

printf("%d", x)

Error, (in fprintf) integer expected for integer format

 

printf("%a", x)

5*Units:-Unit(V)

 

printf("%A", x)

5*Units:-Unit(V)

 

printf("%q", x)

5*Units:-Unit(V)

 

printf("%v", x)

5*Units:-Unit(V)

 

printf("%P", x)

                               5 Units:-Unit(V)

 

print(x)

5*Units:-Unit(V)

(2)

print(The*voltage*is, x)

The*voltage*is, 5*Units:-Unit(V)

(3)

print(The*voltage*is*x)

5*The*voltage*is*Units:-Unit(V)

(4)

NULL

Download PrintUnits.mw

I am trying to draw the streamline for my coupled system but do not get the outcome. Could anyone please help in this regard?

Detail: My system contains x and y;  Regrading x=0, if I do not assign it to zero, do not get the results. Otherwise, there is no need to put x=0 because I am interested in plotting stream plots between y and x (y on the vertical axis and x on the horizontal axis). Besides this, I solved this system analytically, then considered the stream function, did some steps, and plotted the streamline. It is different from the stream function, which has been obtained directly by using the numeric method. I have assigned the values to the parameters that I used during the analytical plot. I put x=0 and did not get the answer. Besides,  I am uploading the graph as a reference, which I have obtained by considering the stream function. This plot is similar to my flow direction, and I expect the same results from the numeric method.

streamline_Help.mw

I am trying to find the value of y4 at t=infinity and t=-infinity when lambda1>lambda2 or lambda1<lambda2. But every time I got the same answer. For example, if we do it by hand then the terms which are responsible for making the indeterminate form can be extracted and canceled (see Fig.). 

But in limit.mw y4 is too lengthy-expression and very difficult to do it manually.

Hi,

How can two specular equations generate two nonspecular (i.e., very different in length and form) solutions? I attach my script with two questions at the bottom: 

specular_equations_nonspecular_solutions.mw

Thank you.

How to handle these errors in plotting the solutions?compare.mw

As I assumed 'n' and 'm' are real, eta is complex. But still, there is a bar on these discrete independent variables. Secondly, the substitution of (8) applies in some terms of 'r2', and the remaining terms remain as is it.

restart

with(LinearAlgebra); with(PDEtools); with(plots); with(LREtools)

setup(mathematicalnotation = true)

setup(mathematicalnotation = true)

(1)

assume(n::real); assume(m::real)

A := proc (n, m) options operator, arrow; Matrix([[eta*phi(n, m), conjugate(eta)*conjugate(psi(n, m))], [phi(n, m), conjugate(psi(n, m))]]) end proc; Adet := Determinant(A(n, m))

eta*phi(n, m)*conjugate(psi(n, m))-conjugate(eta)*conjugate(psi(n, m))*phi(n, m)

(2)

B := proc (n, m) options operator, arrow; Matrix([[phi(n, m), conjugate(psi(n, m))], [-psi(n, m), conjugate(phi(n, m))]]) end proc; Bdet := Determinant(B(n, m))

phi(n, m)*conjugate(phi(n, m))+conjugate(psi(n, m))*psi(n, m)

(3)

r := Adet/Bdet

(eta*phi(n, m)*conjugate(psi(n, m))-conjugate(eta)*conjugate(psi(n, m))*phi(n, m))/(phi(n, m)*conjugate(phi(n, m))+conjugate(psi(n, m))*psi(n, m))

(4)

p := {eta = 1+I, phi(n, m) = (1+I*a*eta)^n*(1+I*b*eta^2)^m, psi(n, m) = (1-I*a*eta)^n*(1-I*b*eta^2)^m, conjugate(eta) = 1-I, conjugate(phi(n, m)) = (1-I*a*conjugate(eta))^n*(1-I*b*conjugate(eta)^2)^m, conjugate(phi(n, m)) = (1+I*a*conjugate(eta))^n*(1+I*b*conjugate(eta)^2)^m}

{eta = 1+I, phi(n, m) = (1+I*a*eta)^n*(1+I*b*eta^2)^m, psi(n, m) = (1-I*a*eta)^n*(1-I*b*eta^2)^m, conjugate(eta) = 1-I, conjugate(phi(n, m)) = (1-I*a*conjugate(eta))^n*(1-I*b*conjugate(eta)^2)^m, conjugate(phi(n, m)) = (1+I*a*conjugate(eta))^n*(1+I*b*conjugate(eta)^2)^m}

(5)

r1 := simplify(subs(p, r))

(2*I)*(1+I*a*eta)^n*(1+I*b*eta^2)^m*conjugate((1-I*a*eta)^n*(1-I*b*eta^2)^m)/((1+I*a*eta)^n*(1+I*b*eta^2)^m*(1-I*a*conjugate(eta))^n*(1-I*b*conjugate(eta)^2)^m+abs(-1+I*a*eta)^(2*n)*abs(I*b*eta^2-1)^(2*m))

(6)

r2 := 1-I*delta(r1, n)

1-I*((2*I)*(1+I*a*eta)^(n+1)*(1+I*b*eta^2)^m*conjugate((1-I*a*eta)^(n+1)*(1-I*b*eta^2)^m)/((1+I*a*eta)^(n+1)*(1+I*b*eta^2)^m*(1-I*a*conjugate(eta))^(n+1)*(1-I*b*conjugate(eta)^2)^m+abs(-1+I*a*eta)^(2*n+2)*abs(I*b*eta^2-1)^(2*m))-(2*I)*(1+I*a*eta)^n*(1+I*b*eta^2)^m*conjugate((1-I*a*eta)^n*(1-I*b*eta^2)^m)/((1+I*a*eta)^n*(1+I*b*eta^2)^m*(1-I*a*conjugate(eta))^n*(1-I*b*conjugate(eta)^2)^m+abs(-1+I*a*eta)^(2*n)*abs(I*b*eta^2-1)^(2*m)))

(7)

exp_expr := subs({(1+I*b*eta^2)^m = exp(I*eta^2*t)}, r2)

1-I*((2*I)*(1+I*a*eta)^(n+1)*exp(I*eta^2*t)*conjugate((1-I*a*eta)^(n+1)*(1-I*b*eta^2)^m)/((1+I*a*eta)^(n+1)*exp(I*eta^2*t)*(1-I*a*conjugate(eta))^(n+1)*(1-I*b*conjugate(eta)^2)^m+abs(-1+I*a*eta)^(2*n+2)*abs(I*b*eta^2-1)^(2*m))-(2*I)*(1+I*a*eta)^n*exp(I*eta^2*t)*conjugate((1-I*a*eta)^n*(1-I*b*eta^2)^m)/((1+I*a*eta)^n*exp(I*eta^2*t)*(1-I*a*conjugate(eta))^n*(1-I*b*conjugate(eta)^2)^m+abs(-1+I*a*eta)^(2*n)*abs(I*b*eta^2-1)^(2*m)))

(8)

``

NULL

NULL

NULL

plot3d(abs(exp_expr), n = -5 .. 5, t = -5 .. 5, eta = 1+I)

Error, (in plot3d) unexpected option: eta = 1+I

 
 

Download soldis.mw

I am re-posting. I am not sure why my question was deleted. Please advise on how to amend my post so that it's not considered spam.

I simply wonder how parameters can "disappear" in a solution. In particular, in my example below the parameter gamma correctly appears in 3 out of 4 solution. However, the solution in which 'gamma' does not appear is also the solution I am most interested in, given its manageable size. Why gamma is "lost" for this solution? 281223_gamma_disappear.mw

I would like to take advantage from the powerful command "SSTransformation" of the DynamicSystems package to reuse the corresponding output.

For example, if we use the following shape:

         > SSTransformation( Amat, Bmat, Cmat, Dmat, form = ModalCanon, output=['A','B','C','D','T'] );

How to do to assign names to the outputs A,B,C,D and T to subsequently reuse them?

NULL

restart

with(LinearAlgebra)

prel := {p1 = (1/2)*exp(I*a*x*(1/2)+I*b*t*(1/2))*(I*a*g[1](t, x)+2*(diff(g[1](t, x), x))), p2 = -(1/2)*exp(-I*a*x*(1/2)-I*b*t*(1/2))*(I*a*g[2](t, x)-2*(diff(g[2](t, x), x))), p3 = -(1/2)*exp(-I*a*x*(1/2)-I*b*t*(1/2))*(I*a*g[3](t, x)-2*(diff(g[3](t, x), x)))}

{p1 = (1/2)*exp(((1/2)*I)*a*x+((1/2)*I)*b*t)*(I*a*g[1](t, x)+2*(diff(g[1](t, x), x))), p2 = -(1/2)*exp(-((1/2)*I)*a*x-((1/2)*I)*b*t)*(I*a*g[2](t, x)-2*(diff(g[2](t, x), x))), p3 = -(1/2)*exp(-((1/2)*I)*a*x-((1/2)*I)*b*t)*(I*a*g[3](t, x)-2*(diff(g[3](t, x), x)))}

(1)

A := Matrix([[rhs(prel[1]), rhs(prel[2]), rhs(prel[3])]])

A1 := Transpose(A)

Matrix(%id = 36893490201564614396)

(2)

prel1 := {p4 = exp((1/2*I)*a*x+(1/2*I)*b*t)*(-I*lambda*g[1](t, x)+c[1]*g[2](t, x)+c[2]*g[3](t, x)), p5 = exp(-(1/2*I)*a*x-(1/2*I)*b*t)*(I*lambda*g[2](t, x)-c[1]*g[1](t, x)), p6 = exp(-(1/2*I)*a*x-(1/2*I)*b*t)*(I*lambda*g[3](t, x)-c[2]*g[1](t, x))}

{p4 = exp(((1/2)*I)*a*x+((1/2)*I)*b*t)*(-I*lambda*g[1](t, x)+c[1]*g[2](t, x)+c[2]*g[3](t, x)), p5 = exp(-((1/2)*I)*a*x-((1/2)*I)*b*t)*(I*lambda*g[2](t, x)-c[1]*g[1](t, x)), p6 = exp(-((1/2)*I)*a*x-((1/2)*I)*b*t)*(I*lambda*g[3](t, x)-c[2]*g[1](t, x))}

(3)

A2 := Matrix([[rhs(prel1[1]), rhs(prel1[2]), rhs(prel1[3])]]); A3 := Transpose(A2)

Matrix(%id = 36893490201519962460)

(4)

NULL

Download simplify2getgXisBg.mw

Maple 2022.2

> restart
> expr = x^4-10*x^2+1
> plot(expr)

produces an error message:
com.maplesoft.maplets.ComponentAccessException: not a valid plot structure

plot(expr, x) works Ok.

Tom Dean

How do i retrieve the expression fra a "Fit" command so that i can use the expression for later calculations.

As you can see from the picture below, i use the "Fit" command to find an expression based on the values specified in X and Y. From there i would like to use the expression to find points on the line and to automate the proces. I can succesfully retrieve the expression by using the reference label, but is there another way to retrieve the expression so that i can avoid having to display the expression after evaluating?

I guess the question can be rephrased to: How do i retrieve the same information as the label reference does, but with a command and without using a label reference?

Since (1/h)[f(i+1,t)-f(i,t)]=f(x,t)_{x} as h goes to zero, 'i' is the discrete index along x-axis. How to do it in Maple? How to reduce Eq. (5) into continuous derivatives?

restart

with(LinearAlgebra)

with(PDEtools)

with(Physics)

with(plots)

Setup(mathematicalnotation = true)

[mathematicalnotation = true]

(1)

``

U := proc (i, t) options operator, arrow; Matrix([[1+I*(q(i+1, t)-q(i, t))/lambda, I*(r(i+1, t)-r(i, t))/lambda], [I*(r(i+1, t)-r(i, t))/lambda, 1-I*(q(i+1, t)-q(i, t))/lambda]]) end proc

proc (i, t) options operator, arrow; Matrix([[1+Physics:-`*`(Physics:-`*`(I, q(i+1, t)-q(i, t)), Physics:-`^`(lambda, -1)), Physics:-`*`(Physics:-`*`(I, r(i+1, t)-r(i, t)), Physics:-`^`(lambda, -1))], [Physics:-`*`(Physics:-`*`(I, r(i+1, t)-r(i, t)), Physics:-`^`(lambda, -1)), 1-Physics:-`*`(Physics:-`*`(I, q(i+1, t)-q(i, t)), Physics:-`^`(lambda, -1))]]) end proc

(2)

``

V := proc (i, t) options operator, arrow; Matrix([[-((1/2)*I)*lambda, -r(i, t)], [r(i, t), ((1/2)*I)*lambda]]) end proc

proc (i, t) options operator, arrow; Matrix([[Physics:-`*`(Physics:-`*`(Physics:-`*`(Physics:-`*`(1, Physics:-`^`(2, -1)), I), lambda), -1), Physics:-`*`(r(i, t), -1)], [r(i, t), Physics:-`*`(Physics:-`*`(Physics:-`*`(1, Physics:-`^`(2, -1)), I), lambda)]]) end proc

(3)

NULL

z := diff(U(i, t), t)+U(i, t).V(i, t)-V(i+1, t).U(i, t)

Matrix(%id = 4525182530)

(4)

z11 := simplify(lambda*z[1, 1]/h, size) = 0

I*(r(i+1, t)^2-r(i, t)^2+(D[2](q))(i+1, t)-(diff(q(i, t), t)))/h = 0

(5)

NULL

Download limit.mw

restart

V := m^4*(1-(varphi/mu)^p);

m^4*(1-(varphi/mu)^p)

(1)

V1 := diff(V, varphi);

-m^4*(varphi/mu)^p*p/varphi

(2)

V2 := diff(V1, varphi);

-m^4*(varphi/mu)^p*p^2/varphi^2+m^4*(varphi/mu)^p*p/varphi^2

(3)

f := Zeta * (varphi^2);

Zeta*varphi^2

(4)

f1 := diff(f, varphi);

2*Zeta*varphi

(5)

f2 := diff(f1, varphi);

2*Zeta

(6)

R:= simplify(((V/3-f1*V1/(3*V))/((1-kappa^2*f)/(12*kappa^2)+f1/V)));

4*kappa^2*m^4*(-3*(varphi/mu)^(2*p)*m^4+(varphi/mu)^(3*p)*m^4+3*(varphi/mu)^p*m^4-m^4-2*Zeta*(varphi/mu)^p*p+2*Zeta*(varphi/mu)^(2*p)*p)/((m^4*(Zeta*kappa^2*varphi^2-1)*(varphi/mu)^p+(-Zeta*kappa^2*varphi^2+1)*m^4+24*Zeta*varphi*kappa^2)*(-1+(varphi/mu)^p))

(7)

N:=evalf(int((3*V1*kappa^2*((2*V*V1)/3 - f1^2*V1*R/(3*V) - f1*V1^2/(3*V))/(V*(-f*kappa^2 + 1)*(-R*f1 - 2*V1))),varphi=varphi__hc..varphi__end)assuming varphi__hc > 0, varphi__hc > varphi__end);

-1.*(int(-3.*(varphi/mu)^p*p*kappa^2*(-.6666666667*m^8*(1.-1.*(varphi/mu)^p)*(varphi/mu)^p*p/varphi+5.333333333*Zeta^2*varphi*m^4*(varphi/mu)^p*p*kappa^2*(-3.*(varphi/mu)^(2.*p)*m^4+(varphi/mu)^(3.*p)*m^4+3.*(varphi/mu)^p*m^4-1.*m^4-2.*Zeta*(varphi/mu)^p*p+2.*Zeta*(varphi/mu)^(2.*p)*p)/((m^4*(Zeta*kappa^2*varphi^2-1.)*(varphi/mu)^p+(-1.*Zeta*kappa^2*varphi^2+1.)*m^4+24.*Zeta*varphi*kappa^2)*(-1.+(varphi/mu)^p)*(1.-1.*(varphi/mu)^p))-.6666666667*Zeta*m^4*((varphi/mu)^p)^2*p^2/(varphi*(1.-1.*(varphi/mu)^p)))/(varphi*(1.-1.*(varphi/mu)^p)*(-1.*Zeta*kappa^2*varphi^2+1.)*(-8.*kappa^2*m^4*(-3.*(varphi/mu)^(2.*p)*m^4+(varphi/mu)^(3.*p)*m^4+3.*(varphi/mu)^p*m^4-1.*m^4-2.*Zeta*(varphi/mu)^p*p+2.*Zeta*(varphi/mu)^(2.*p)*p)*Zeta*varphi/((m^4*(Zeta*kappa^2*varphi^2-1.)*(varphi/mu)^p+(-1.*Zeta*kappa^2*varphi^2+1.)*m^4+24.*Zeta*varphi*kappa^2)*(-1.+(varphi/mu)^p))+2.*m^4*(varphi/mu)^p*p/varphi)), varphi = varphi__end .. varphi__hc))

(8)

simplify(-1.*(int(-3.*(varphi/mu)^p*p*kappa^2*(-.6666666667*m^8*(1.-1.*(varphi/mu)^p)*(varphi/mu)^p*p/varphi+5.333333333*Zeta^2*varphi*m^4*(varphi/mu)^p*p*kappa^2*(-3.*(varphi/mu)^(2.*p)*m^4+(varphi/mu)^(3.*p)*m^4+3.*(varphi/mu)^p*m^4-1.*m^4-2.*Zeta*(varphi/mu)^p*p+2.*Zeta*(varphi/mu)^(2.*p)*p)/((m^4*(Zeta*kappa^2*varphi^2-1.)*(varphi/mu)^p+(-1.*Zeta*kappa^2*varphi^2+1.)*m^4+24.*Zeta*varphi*kappa^2)*(-1.+(varphi/mu)^p)*(1.-1.*(varphi/mu)^p))-.6666666667*Zeta*m^4*((varphi/mu)^p)^2*p^2/(varphi*(1.-1.*(varphi/mu)^p)))/(varphi*(1.-1.*(varphi/mu)^p)*(-1.*Zeta*kappa^2*varphi^2+1.)*(-8.*kappa^2*m^4*(-3.*(varphi/mu)^(2.*p)*m^4+(varphi/mu)^(3.*p)*m^4+3.*(varphi/mu)^p*m^4-1.*m^4-2.*Zeta*(varphi/mu)^p*p+2.*Zeta*(varphi/mu)^(2.*p)*p)*Zeta*varphi/((m^4*(Zeta*kappa^2*varphi^2-1.)*(varphi/mu)^p+(-1.*Zeta*kappa^2*varphi^2+1.)*m^4+24.*Zeta*varphi*kappa^2)*(-1.+(varphi/mu)^p))+2.*m^4*(varphi/mu)^p*p/varphi)), varphi = varphi__end .. varphi__hc)))

Error, (in content/content) invalid arguments

 

NULL

Download ex.mw

Download Exercises_all_lectures_1.mw

Exercises_all_lectures_1.mw

Hello,

I have a Maple document that contains a lot of notes that I have an exam for tomorrow. I opened the document today and it suggests I save a copy of a corrupt document and also it gives me the message "There were problems during the loading process.
Your worksheet may be incomplete." when it finally does load.

Any suggestions for how I could fix this would be greatly greatly appreciated.

Thank you

5 6 7 8 9 10 11 Last Page 7 of 40