Maple 2022 Questions and Posts

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

Below is the code in Maple 2022, and then I describe the problem.
restart;
with(plots);
a := 0.5;
j := BesselJ(0, sqrt(2*I)*sqrt(x^2 + y^2)*a)/BesselJ(0, sqrt(2*I)*a);
A := sqrt(Re(j)^2 + Im(j)^2);
densityplot(A, x = -1 .. 1, y = -sqrt(-x^2 + 1) .. sqrt(-x^2 + 1), grid = [68, 68], style = patchnogrid, scaletorange = 0 .. 1);

 

Thus, I have a real function of two variables: $A(x, y)$. At zero it is minimal (value 0.996). At the boundary of the unit circle it is maximal with a value equal to 1. In theory, scaletorange = 0 .. 1 should give a picture with almost perfectly white everywhere in the circle since the function values ​​are very close to 1. However, both with scaletorange and without it, the command produces a picture with a significantly dark circle in the center...

Since the temporal term disappears from the denominator for any values of the parameters, I am puzzled. Why is this happening? It seems I might be missing something. When I consider one of the terms (named 'opnumeric') in the denominator and assign parametric values, the temporal term is present. However, when looking at the whole expression, the temporal term is absent in the denominator (named 'den1numeric'). How can this be resolved? numericden.mw

Is it possible to  convert an existing document in worksheet mode to document mode in Maple22 ?

It seems you can only select either at creation of document but not convert documents already existing.

I have multiple questions on how Units[TestDimensions] works from reading the Maple documentation. I will use this thread to ask them.

My first question regards the difference between Unit(expr) and units inserted using shortcut (CMD+SHIFT+U) on a mac?

restart

Automatically loading the Units[Simple] subpackage
 

 

What is the difference between the following two commands?

Units:-TestDimensions(x*Unit('m')+y*Unit('s'), output = dimensions)

{x::(length^(-1+_t3[7, 1])*mass^_t3[7, 2]*time^_t3[7, 3]*electric_current^_t3[7, 4]*thermodynamic_temperature^_t3[7, 5]*amount_of_substance^_t3[7, 6]*luminous_intensity^_t3[7, 7]*currency^_t3[7, 8]*amount_of_information^_t3[7, 9]*logarithmic_gain^_t3[7, 10]), y::(length^_t3[7, 1]*mass^_t3[7, 2]*time^(-1+_t3[7, 3])*electric_current^_t3[7, 4]*thermodynamic_temperature^_t3[7, 5]*amount_of_substance^_t3[7, 6]*luminous_intensity^_t3[7, 7]*currency^_t3[7, 8]*amount_of_information^_t3[7, 9]*logarithmic_gain^_t3[7, 10]), (x*Units:-Unit(m))::(length^_t3[7, 1]*mass^_t3[7, 2]*time^_t3[7, 3]*electric_current^_t3[7, 4]*thermodynamic_temperature^_t3[7, 5]*amount_of_substance^_t3[7, 6]*luminous_intensity^_t3[7, 7]*currency^_t3[7, 8]*amount_of_information^_t3[7, 9]*logarithmic_gain^_t3[7, 10]), (y*Units:-Unit(s))::(length^_t3[7, 1]*mass^_t3[7, 2]*time^_t3[7, 3]*electric_current^_t3[7, 4]*thermodynamic_temperature^_t3[7, 5]*amount_of_substance^_t3[7, 6]*luminous_intensity^_t3[7, 7]*currency^_t3[7, 8]*amount_of_information^_t3[7, 9]*logarithmic_gain^_t3[7, 10]), (x*Units:-Unit(m)+y*Units:-Unit(s))::(length^_t3[7, 1]*mass^_t3[7, 2]*time^_t3[7, 3]*electric_current^_t3[7, 4]*thermodynamic_temperature^_t3[7, 5]*amount_of_substance^_t3[7, 6]*luminous_intensity^_t3[7, 7]*currency^_t3[7, 8]*amount_of_information^_t3[7, 9]*logarithmic_gain^_t3[7, 10])}

(1)

Units:-TestDimensions(2*Unit(m)+y*Unit(s), output = dimensions)

{y::(length/time), (y*Units:-Unit(s))::length, (2*Units:-Unit(m)+y*Units:-Unit(s))::length}

(2)

NULL

I think my question is what is the difference between inserting units using CMD+SHIFT+U on a mac, which generates the units as seen in the first command, versus using Unit(expr) as in the second version of the command?

Download Units_-_TestDimensions.mw

I read in the programming guide that to print the body of Maple library commands we set the Maple interface variable `verboseproc` to 2 then use the print command passing in the procedure we're interested in as argument.

Built-in kernel commands are compiled in machine code and not written in Maple language so we cannot view their definitions.

According to the guide, if we try to print such procedures we will see that the procedure has only an `option builtin` statement and no visible body.

If I try to view `Units:-TestDimensions`, as follows

```interface(verboseproc=1);
print(Units:-TestDimensions);

```

then what I see is

In this case there isn't the `option builtin` but neither is there a visible body.

Is this procedure built-in or is there a way to see the code?

I am reading the documentation on the `Units[Simple]` package.

There is a section that says

"In the Simple Units environment, in contrast to the Standard and Natural environments, unassigned variables are not automatically assumed to represent unit-free quantities. For example, 5m+x is a valid expression if x is unassigned, because x may represent a length. On the other hand (5m+x)(6s+x) is an invalid expression because the first factor implies that x represents a length and the second factor implies that x is a duration."

The way I understood this paragraph is that in Units:-Simple an unassigned variable is not assumed to represent a unit-free quantity, but in Units:-Standard it is assumed to represent a unit-free quantity.

Consider the expression 5m+x. This expression works in Units:-Simple but not in Units:-Standard.

Units:-Simple adds a quantity 5m to a quantity without units. But why can one add a quantity with units to a quantity without units?

Units:-Standard tries to add a quantity 5m to a quantity that is assumed to have units. What units are assumed?

Next, consider (5m+x)(6s+x).

This fails in both packages, as can be seen below (actually, for some reason, the embed below is not showing the expressions typed in for Units:-Standard, but can be seen if you download the worksheet I imagine).

restart

with(Units:-Simple)

5*Unit('m')+x

5*Units:-Unit(m)+x

(1)

(5*Unit('m')+x)*(6*Unit('s')+x)

Error, (in Units:-Simple:-*) the following expressions imply incompatible dimensions: {5*Units:-Unit(m)+x, 6*Units:-Unit(s)+x}

 

restart

with(Units:-Standard)

(5*Unit('m')+x)*(6*Unit('s')+x)

Error, (in Units:-Standard:-+) the units `m` and `1` have incompatible dimensions

 

5*Unit('m')+x

Error, (in Units:-Standard:-+) the units `m` and `1` have incompatible dimensions

 

NULL

So my question is, what exactly is the difference between considering unassigned variables to be unit-free vs not unit-free?

Download Units_Simple_vs_Standard.mw

Dear all,

I am trying to minimize this polynomial function G on [0,1]x[0,1]:

Maple 2022 seems unable to find the (approximate) minimum. Even adding _EnvExplicit:=true, as suggested here on a previous post, does not fix the issue.

Any suggestion?

Thanks, Nicola

restart:

_EnvExplicit:=true:

G := (x, y) -> ((-1)*38.87*y^4 + 39.7800000000000*y^3 + (-1)*6.76000000000000*y^2 + 10.4000000000000*y - 3.90000000000000)*x^4 + (39.78*y^4 + (-1)*40.4600000000000*y^3 + 6.80000000000000*y^2 + (-1)*10.2000000000000*y + 3.40000000000000)*x^3 + ((-1)*6.76*y^4 + 6.80000000000000*y^3 + (-1)*1.12000000000000*y^2 + 1.60000000000000*y - 0.400000000000000)*x^2 + (10.4*y^4 + (-1)*10.2000000000000*y^3 + 1.60000000000000*y^2 + (-1)*2.00000000000000*y)*x + 1. + (-1)*3.9*y^4 + (-1)*0.4*y^2 + 3.4*y^3

proc (x, y) options operator, arrow; (-38.87*y^4+39.7800000000000*y^3-6.76000000000000*y^2+10.4000000000000*y-3.90000000000000)*x^4+(39.78*y^4-40.4600000000000*y^3+6.80000000000000*y^2-10.2000000000000*y+3.40000000000000)*x^3+(-6.76*y^4+6.80000000000000*y^3-1.12000000000000*y^2+1.60000000000000*y-.400000000000000)*x^2+(10.4*y^4-10.2000000000000*y^3+1.60000000000000*y^2-2.00000000000000*y)*x+1.-3.9*y^4-.4*y^2+3.4*y^3 end proc

(1)

minimize(G(x,y),x=0..1,y=0..1)

 

NULL

Download Untitled.mw

What is the problem with the integral below when I use a variable n?

with(Units:-Simple)

V__1 := Unit('m'^3) = Units:-Unit(m^3)NULL

V__2 := 2*Unit('m'^3) = 2*Units:-Unit(m^3)NULL

int(1/V, V = V__1 .. V__2)

ln(2)

(1)

`assuming`([int(n/V, V = n*Unit('m'^3) .. m*Unit('m'^3))], [n > 0, m > 0])

-ln(n)*n+ln(m)*n

(2)

NULL

Download Units_Int.mw

I was just using Maple to do a simple calculation but the units came out all complicated. 

The expression in question is work done by a van der Waals gas. The units should come out to Joules per mol. 

When I do the calculation manually (second expression below) I do get that result, albeit in more basic units than Joules.

In the first expression, in which I am using subs to sub in values with units into the expression, the final expression is very complicated. Why?

with(Units:-Simple)

simplify(subs({R = 8.314*Unit('J'/('K'*'mol')), T = 298*Unit('K'), V__1 = Unit('L'/'mol'), V__2 = 50*Unit('L'/'mol'), a = 2.283*Unit('L'^2*'bar'/'mol'^2), b = 0.4278e-1*Unit('L'/'mol')}, -R*T*ln((V__2-b)/(V__1-b))+a*(1/V__1-1/V__2)))

(-9798.522418*Units:-Unit(J/(K*mol))*Units:-Unit(K)*Units:-Unit(L/mol)+2.23734*Units:-Unit(L^2*bar/mol^2))/Units:-Unit(L/mol)

(1)

How do we simplify the units above so they become the same as the units in the same (manual) calculation below?

-(8.314*Unit('J'/('K'*'mol'))*298)*Unit('K')*ln((50*Unit('L'/'mol')-0.4278e-1*Unit('L'/'mol'))/(Unit('L'/'mol')-0.4278e-1*Unit('L'/'mol')))+2.283*Unit('L'^2*'bar'/'mol'^2)/Unit('L'/'mol')

-9570.222418*Units:-Unit(m^2*kg/(s^2*mol))

(2)

NULL

Download Units_-_Subs.mw

Dear all,

I'd like to explore graphically a polynomial surface depending on two parameters a and b.

The problem is that, as soon as I start playing with the sliders, Maple freezes and I have to 'force quit'.

Can you please tell me if you have the same problem with this example?

Thanks.

restart:

with(plots):

K := 1 - y*x - (1 - x)*(b*x^3 + a*x^2 + x + 1)*(1 - y)*(b*y^3 + a*y^2 + y + 1)

1-y*x-(1-x)*(b*x^3+a*x^2+x+1)*(1-y)*(b*y^3+a*y^2+y+1)

(1)

Explore(plot3d(K, x=0..1, y=0..1,  font= [Times, bold, 20], labels= ['x', 'y','z'],   labelfont= [Times, bold, 40],  title = "K(x,y)"), b = 0..1., a=0..1.);

 

 

Download Explore.mw

Dear all,

I have this polynomial function

G(x, y) := (-0.14*y^3 + 1.20000000000000*y^2 - 1.26000000000000*y + 0.200000000000000)*x^3 + (1.20*y^3 - 10.0800000000000*y^2 + 10.0800000000000*y - 1.20000000000000)*x^2 + (-8.82*y + 10.08*y^2 - 1.26*y^3)*x + 1. - 1.2*y^2 + 0.2*y^3

I don't understand why the command

minimize(G(x,y),x=0..1,y=0..1);

produces the error

Error, (in RootOf/RootOf:-algnum_in_range) invalid input: RootOf/RootOf:-rootof_in_range expects its 1st argument, rt, to be of type ('RootOf')(polynom(rational,_Z),identical(index) = posint), but received RootOf(7*_Z^3-93*_Z^2+327*_Z-187)

Thanks for your advices, Nicola

Dear all

I have a function like 

F[1] := (x, y) -> x*y/(1 + 10.35841093*(1 - x)*((-1)*0.9*x + 1)*(1 - y)*((-1)*0.9*y + 1))

This function is continuous on D = [0,1]x[0,1]. I'm interested in the (approximate) value of the double integral over D.

Unfortunately the entry

int(int(F[1](x,y),x=0..1.),y=0..1.)

produces Float(infinity). 

Thanks Nicola

Why Maple return 0 when I try to find coefficients of different power of lambda's.coeff.mw

i have made a full working code for differential quadrature method now i am  changing examples and it is not working although i have properly defined new parameters i am attaching my code kindly help me out
one more thing one example include summation n=0..ininity it is not even evaluating taking alot of time i am attaching both codes kindly help me out
A+B_example.mw
chelishkov_comparison.mw

1 2 3 4 5 6 7 Last Page 2 of 39