Maple 2022 Questions and Posts

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

Please check:

My end goal is to find the following three expressions:

chi_1 := collect(X_A,[nnu[1],nnu[2]]);

chi_2 := collect(X_B,[nnu[1],nnu[2]]);

chi_3 := collect(X_C,[nnu[1],nnu[2]]);

I expect these three expressions to be linear combinations of random variables nu[1] (nnu[1]) and nu[2] (nnu[2]).

While calling solve(), I encounter this error:

Error, (in assuming) when calling 'SolveTools:-Engine:-Dispatch'. Received: 'badly formed input to solve: not fully algebraic'

What is exactly the issue here? If it can help you answer my doubt, that argmin expression I defined is composed by conditional means and variances which I computed as in here:

The two formulas I am trying to implement in Maple are conditional distribution of a multivariate normal distributionAm I already doing any mistake in An alternative interpretation of mine for these two formulas is: Please check the light-blue-highlighted differences in the conditional variance calculation. This alternative interpretation leads to, which I also can't solve() (solver stuck in "evaluating") but at least I don't get the error mentioned above...

I am a bit lost to be honest: Is Finding_Chi_Version1 or Finding_Chi_Version2 the correct interpretation? 


I m wondering if/how (i) can use the collect function twice:  collect(a, x, form, func ):  
collect(a, x, form, collect(x)), but it seems I can't use a func with opt. 
Can someone help please? 


Hello Y'all,

I've been on this problem for a few days now and can't seem to find a solution and hope you fine people here can help me.

Is there a way to symbolically work with matrices? In detail I'm trying to calculate blocks in a block matrix equation symbolically/analytically. The first problem I had was that of course matrices dont commutate, which is solvable by just using the LinearAlgebra package and typing in

A.B instead of A*B

For now the big problem that remains is that of course in addition to that the inversion of a matrix A is not just 1/A (or \frac{1}{A} in LaTeX) but simply A^(-1). There is the MatrixInverse function but that needs a declared matrix. And since I dont have explicit matrices I can't use Matrix or the like to declare that A is a matrix. Any help here would appreciated. I tried to work with assume, but that didn't work either and I am kind of out of options (that I find on the web) right now. In essence I just want Maple to write A^(-1) and only cancel that if an A is next to it... (albeit with not just A but of course A also being setup by addition and multiplication of matrices...).

A smaller, related interest would be a general identity matrix. One that basically just fulfills A.I=I.A=A and I^(-1)=I. At least to me that seems kind of similar but I can't just define a Mtrix as being a Matrix and not having elements...

Thank you in advance and have a nice weekend y'all! :)

Good day! 

I attempted to download the geocoding package for Maple and I cannot get it to work. Executing the worksheet produces no results.

I am using Maple 2022. 

Can anyone shed some light on this please?

Thanks for reading ..

How to use collect() or coeffs() on random variables instead of standard variables?

I need to re-organize a linear combination of RVs nu[1], nu[2], u[1], u[2], u[3] by collecting the coefficients on each of these 5 RVs. Note that the Xs are correlated with each other and the Ys are correlated with each other (but Xs and Ys are uncorrelated).

For example, nu is a 2D gaussian vector where nu[1] and nu[2] are defined in terms of _R1, _R2, means, standard deviations and correlation coefficient. They are quite "nested" and the 3D gaussian vector u is even worse, so when these enter a linear combination it becomes hard to identify them back as simply nu[1], nu[2], u[1], u[2], u[3].

Is there a way to "isolate" them in a linear combination by using collect()-like or coeffs()-like functions (i) directly on the RVs or (ii) indireclty on the explicit expressions of _Rs, means, standard devs, correlation coeffs? 

(I already checked the answers to these two somewhat similar questions but did not help for my case:


See my script below: 

For example, I would want collect() on nu[1] (or equivalently on _R1*sigma__v[1]+nu__0[1]) to give me X__1+X__3 (as you easily see from my definition of Omega).

# 2.2.1 Define the Omega random variable as Omega__1+Omega__2+Omega__3:

`Ω__1` := X__1*(nu[1]-`μ__1`-`λ__1`*(u[1]+X__1)); `Ω__2` := X__2*(nu[2]-`μ__2`-`λ__2`*(u[2]+X__2)); `Ω__3` := X__3*(nu[1]+nu[2]-`μ__3`-`λ__3`*(u[3]+X__3)); Omega := `Ω__1`+`Ω__2`+`Ω__3`

X__1*(sigma__v[1]*_R1+nu__0[1]-mu__1-lambda__1*(_R3*sigma__u[1]+X__1))+X__2*(sigma__v[2]*rho__v[1, 2]*_R1+(-rho__v[1, 2]^2+1)^(1/2)*sigma__v[2]*_R2+nu__0[2]-mu__2-lambda__2*(rho__u[1, 2]*sigma__u[2]*_R3+(-rho__u[1, 2]^2+1)^(1/2)*sigma__u[2]*_R4+X__2))+X__3*(sigma__v[1]*_R1+nu__0[1]+sigma__v[2]*rho__v[1, 2]*_R1+(-rho__v[1, 2]^2+1)^(1/2)*sigma__v[2]*_R2+nu__0[2]-mu__3-lambda__3*(rho__u[1, 3]*sigma__u[3]*_R3-sigma__u[3]*(rho__u[1, 2]*rho__u[1, 3]-rho__u[2, 3])*_R4/(-rho__u[1, 2]^2+1)^(1/2)+((-2*rho__u[1, 2]*rho__u[1, 3]*rho__u[2, 3]+rho__u[1, 2]^2+rho__u[1, 3]^2+rho__u[2, 3]^2-1)/(rho__u[1, 2]^2-1))^(1/2)*sigma__u[3]*_R5+X__3))


# 2.2.2 Simplify and re-arrange the Omega RV to obtain the easy-to-read version (a,b,c,d,e,f are the coefficients):
#Omega__* = a + b*nu[1] + c*nu[2] + d*u[1] + e*u[2] + f*u[3];
# How to do it? Collect() does not work...simplify() doesn't make it any easier...

`Ω__*` := collect(Omega, [_R1*`σ__v`[1]+`ν__0`[1], `σ__v`[2]*`ρ__v`[1, 2]*_R1+sqrt(-`ρ__v`[1, 2]^2+1)*`σ__v`[2]*_R2+`ν__0`[2], `σ__u`[1]*_R3, `σ__u`[2]*`ρ__u`[1, 2]*_R3+sqrt(-`ρ__u`[1, 2]^2+1)*`σ__u`[2]*_R4, `σ__u`[3]*`ρ__u`[1, 3]*_R3-`σ__u`[3]*(`ρ__u`[1, 2]*`ρ__u`[1, 3]-`ρ__u`[2, 3])*_R4/sqrt(-`ρ__u`[1, 2]^2+1)+sqrt((-2*`ρ__u`[1, 2]*`ρ__u`[1, 3]*`ρ__u`[2, 3]+`ρ__u`[1, 2]^2+`ρ__u`[1, 3]^2+`ρ__u`[2, 3]^2-1)/(`ρ__u`[1, 2]^2-1))*`σ__u`[3]*_R5])

Error, (in collect) cannot collect _R1*sigma__v[1]+nu__0[1]


`Ω__col` := collect(Omega, [nu[1], nu[2], u[1], u[2], u[3]])

Error, (in collect) cannot collect _R1*sigma__v[1]+nu__0[1]




I can derive a symbolic solution by hand for the following ODE, but cannot get Maple to do it for me.  Any tricks?


Velocity field, -infinity < x and x < infinity,  t > 0.

v := (x,t) -> piecewise(x <= -t, 0, x < t, 1 - 1/2*(1 - x/t));

v := proc (x, t) options operator, arrow; piecewise(x <= -t, 0, x < t, 1/2+(1/2)*x/t) end proc

Position x(t):

de := diff(x(t),t) = v(x(t),t);

de := diff(x(t), t) = piecewise(x(t) <= -t, 0, x(t) < t, 1/2+x(t)/(2*t))

Initial condition, assuming a > 0

ic := x(0) = -a;

x(0) = -a

Symbolic solution, calculated by hand:

x__exact := t -> piecewise(t < a, -a, t - 2*sqrt(t)*sqrt(a));

x__exact := proc (t) options operator, arrow; piecewise(t < a, -a, t-2*sqrt(t)*sqrt(a)) end proc

Verify exact solution by comparing it against the numeric solution for some a > 0:

a := 3;  # any a>0 should do
dsol := dsolve({de,ic}, numeric):
plots:-odeplot(dsol, t=0..5);   # dsolve solution
plot(x__exact(t), t=0..5);      # symbolic solution (calculated by hand)
a := 'a';



Can Maple's dsolve find the exact solution?  This one returns empty in Maple 2022:

dsolve({de, ic}) assuming a > 0, t > 0;



I obtain the adjacency matrix from a graph. We know that it is indexed according to the order of vertices in the Vertices. But what if I want to rearrange it in a different order? Here is a specific example.

Vertices(g); #[1,2,3]

I would like to display this matrix in the order of [3, 1, 2].

I have give this below fit command my data is only continous data either positive or negative float data. Their never any complex number at all.

I use the below fit command

Error, complex argument to max/min

It can be observed it is running into error in C1 I dont know why can someone suggest where should I check and why is this happening kind help.   In Excel we can see the intercept coming big.


I attach the toycode to see the error I get too

# countourplot3d piggybacks on top of plot3d.
# For the "coloring=[lowColor, highColor]", the "filledregions=true" option must be present.
# If "filledregions=true" is not present, plot3d will throw an error.
# This code shows the three cases, only one of which will work.
Note to support. I cannot add a new tag. contourplot3d should be a tag.

cGr4s := Color([0.50, 0.50, 0.50]);
contourplot3d(-5*d/(d^2 + y^2 + 1), d = -3 .. 3, y = -3 .. 3, color = black, thickness = 3, coloring = [cGr4s, cGr4s], contours = [-2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2]);
contourplot3d(-5*d/(d^2 + y^2 + 1), d = -3 .. 3, y = -3 .. 3, filledregions = false, color = black, thickness = 3, coloring = [cGr4s, cGr4s], contours = [-2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2]);
contourplot3d(-5*d/(d^2 + y^2 + 1), d = -3 .. 3, y = -3 .. 3, filledregions = true, color = black, thickness = 3, coloring = [cGr4s, cGr4s], contours = [-2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2]);

I'm having a symmetric bivariate polynomial P(x,y) with a high degree (larger than 8). I want to know if there exists a root of P(x,y) or not. I may not need a specific root but rather to know if P(x,y) has a root or not. I've been doing some research but I only find the command that helps solve univariate functions or solve systems of bivariate functions. 

In conclusion, my question is: How can I know that a symmetric bivariate polynomial has a root or not using Maple?

Here is the polynomial I want to check

P(x,y)=x^12*y^3 + 10*x^11*y^4 + 43*x^10*y^5 + 105*x^9*y^6 + 161*x^8*y^7 + 161*x^7*y^8 + 105*x^6*y^9 + 43*x^5*y^10 + 10*x^4*y^11 + x^3*y^12 - x^12*y^2 - 8*x^11*y^3 - 17*x^10*y^4 + 8*x^9*y^5 + 82*x^8*y^6 + 128*x^7*y^7 + 82*x^6*y^8 + 8*x^5*y^9 - 17*x^4*y^10 - 8*x^3*y^11 - x^2*y^12 - x^12*y - 4*x^11*y^2 - 62*x^10*y^3 - 341*x^9*y^4 - 902*x^8*y^5 - 1410*x^7*y^6 - 1410*x^6*y^7 - 902*x^5*y^8 - 341*x^4*y^9 - 62*x^3*y^10 - 4*x^2*y^11 - x*y^12 + x^12 - 8*x^11*y - 62*x^10*y^2 - 680*x^9*y^3 - 3169*x^8*y^4 - 7312*x^7*y^5 - 9540*x^6*y^6 - 7312*x^5*y^7 - 3169*x^4*y^8 - 680*x^3*y^9 - 62*x^2*y^10 - 8*x*y^11 + y^12 + 10*x^11 - 17*x^10*y - 341*x^9*y^2 - 3169*x^8*y^3 - 11838*x^7*y^4 - 21793*x^6*y^5 - 21793*x^5*y^6 - 11838*x^4*y^7 - 3169*x^3*y^8 - 341*x^2*y^9 - 17*x*y^10 + 10*y^11 + 43*x^10 + 8*x^9*y - 902*x^8*y^2 - 7312*x^7*y^3 - 21793*x^6*y^4 - 30696*x^5*y^5 - 21793*x^4*y^6 - 7312*x^3*y^7 - 902*x^2*y^8 + 8*x*y^9 + 43*y^10 + 105*x^9 + 82*x^8*y - 1410*x^7*y^2 - 9540*x^6*y^3 - 21793*x^5*y^4 - 21793*x^4*y^5 - 9540*x^3*y^6 - 1410*x^2*y^7 + 82*x*y^8 + 105*y^9 + 161*x^8 + 128*x^7*y - 1410*x^6*y^2 - 7312*x^5*y^3 - 11838*x^4*y^4 - 7312*x^3*y^5 - 1410*x^2*y^6 + 128*x*y^7 + 161*y^8 + 161*x^7 + 82*x^6*y - 902*x^5*y^2 - 3169*x^4*y^3 - 3169*x^3*y^4 - 902*x^2*y^5 + 82*x*y^6 + 161*y^7 + 105*x^6 + 8*x^5*y - 341*x^4*y^2 - 680*x^3*y^3 - 341*x^2*y^4 + 8*x*y^5 + 105*y^6 + 43*x^5 - 17*x^4*y - 62*x^3*y^2 - 62*x^2*y^3 - 17*x*y^4 + 43*y^5 + 10*x^4 - 8*x^3*y - 4*x^2*y^2 - 8*x*y^3 + 10*y^4 + x^3 - x^2*y - x*y^2 + y^3

Say I have 20 userdefined functions defined by me say

Now i required function which picks one of the userdefined from the above 20 functions randomly

Can anyone help me fix a corrupted maple file?

I have tried to fix it myself and searched all over for a solution but can' seem to fix it myself. Please help

Download Styrkelære2regneopgaver.mwStyrkelære2regneopgaver.mwStyrkelæ

Hello everyone,

Here is a stylized version of my problem. Given three normally distributed random variables {A, B, C}, I want to find the X_1, X_2, X_3 that maximize the following expression (gamma being a constant and A being a linear combination of other normally distributed random variables):

Max{ Exp[A|B,C] - (gamma/2)*Var[A|B,C] }

All the details are here:

In particular, I am seeking your help to:

  1. Correlate three random variables (an example of the procedure for correlating two random variables is already provided in the script).
  2. Verify my understanding of the linear projection theorem ( in two dimensions, that is, to compute conditional means and variances of the form E[X|Y,Z] and V[X|Y,Z].
  3. Implement and adapt the linear projection theorem to my problem in Maple.
  4. Combine all together to obtain Expr = E[A|B,C] + V[A|B,C] and find the optimal {X_1, X_2, X_3} by solving the linear system of three equations in the three variables {X_1, X_2, X_3}, where the three equations are obtained by setting to 0 the partial derivatives of Expr with respect to {X_1, X_2, X_3}.


In relation to point 2., did I correctly interpret the matrix form of the three-dimensions version of the linear projection theorem?


In relation to point 3., I attach a stylized script for the three-dimensions version (note that I need the two-dimensions version for my problem): Assuming a correct interpretation of the theorem:

  • Did I correctly implement E[X_2|Y_1,Y_2,Y_3] and E[X_3|Y_1,Y_2,Y_3] as in the picture above?
  • How to adapt it accordingly to include E[X_1|Y_1,Y_2,Y_3] and V[X_1|Y_1,Y_2,Y_3], V[X_2|Y_1,Y_2,Y_3], and V[X_3|Y_1,Y_2,Y_3]? 
  • How to apply it to the random variables in my script to eventually find the optimal {X_1,X_2,X_3}?


You can play around with my script and send me the updated version. The problem I am trying to solve is quite convoluted, so let me know if you need any further clarification. Thanks a lot!

Actually, I have two questions here, I don't know if they are connected.

I don't know if it's the right way to deifne function with indexed variables, is there any difference between f and g?

I assume they are the same since neither of them work with Maximize.

Finally, I use the most original way in (5), why give the wrong answer? (no way the answer is -infinity)


f := proc (x) options operator, arrow; sum(ln(x[i]), i = 1 .. 4) end proc

proc (x) options operator, arrow; sum(ln(x[i]), i = 1 .. 4) end proc``


g := proc (x) options operator, arrow; ln(x[1])+ln(x[2])+ln(x[3])+ln(x[4]) end proc

proc (x) options operator, arrow; ln(x[1])+ln(x[2])+ln(x[3])+ln(x[4]) end proc


f([1, 1, 1, 1])



cons := {x[1]+x[2] <= 1, x[1]+x[3] <= 2}

{x[1]+x[2] <= 1, x[1]+x[3] <= 2}



Maximize(f, cons, assume = nonnegative)

Error, (in Optimization:-NLPSolve) constraints must be specified as a set or list of  procedures


Maximize(f, {x[1]+x[2] <= 1, x[1]+x[3] <= 2}, assume = nonnegative)

Error, (in Optimization:-NLPSolve) constraints must be specified as a set or list of  procedures


Maximize(g, cons, assume = nonnegative)

Error, (in Optimization:-NLPSolve) constraints must be specified as a set or list of  procedures


Maximize(g, {x[1]+x[2] <= 1, x[1]+x[3] <= 2}, assume = nonnegative)

Error, (in Optimization:-NLPSolve) constraints must be specified as a set or list of  procedures



Maximize(sum(ln(x[i]), i = 1 .. 4), {x[1]+x[2] <= 1, x[1]+x[3] <= 2}, assume = nonnegative)

[Float(-infinity), [x[1] = HFloat(1.0), x[2] = HFloat(0.0), x[3] = HFloat(1.0), x[4] = HFloat(1.0)]]




In the last two months I've have been asked to download an update to 2022.1 around 7 times.

Each oupdates takes 5-10 minutes and I have to sit idle.

1. Is this the typical pace of updates?

2.Is there a veriosn 2023 I need to get? if yes, how?


3 4 5 6 7 8 9 Last Page 5 of 32