Maple 2023 Questions and Posts

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

Hi,

I'm looking for a harmonized layout for my weighted probability trees. Are there any possibilities to improve this code?

Thanks

Arbrepondéré.mw

The solve function is able to solve inequalities and return solutions that satisfy the inequalities. Unfortunately, it appears that for some toy problems, this command does not always perform efficiently
 

restart;

eqns__1 := {x >= 0, y >= 0, z >= 0, x*y*z+x^2+y^2+z^2 <= 2*(x*y+x*z+y*z), 2*(x^2+y^2+z^2) < x^2*y+x*z^2+y^2*z-27}

eqns__2 := {x > 0, y > 0, z > 0, x*y*z+x^2+y^2+z^2 <= 2*(x*y+x*z+y*z), 2*(x^2+y^2+z^2) <= x^2*y+x*z^2+y^2*z-27}

timelimit(0.1e2, :-solve(eqns__1, [x, y, z], AllSolutions))

timelimit(0.1e2, :-solve(eqns__2, [x, y, z], AllSolutions))

Error, (in RegularChains:-TRDcadEvalBox) time expired

 

Error, (in RegularChains:-TRDexquo) time expired

 

timelimit(0.1e2, MTM:-solve(eqns__1[], [x, y, z][]))

timelimit(0.1e2, MTM:-solve(eqns__2[], [x, y, z][]))

Warning, solving 5 equations for 3 variables

 

Error, (in sdmp:-mul) time expired

 

Warning, solving 5 equations for 3 variables

 

Error, (in RegularChains:-TRDcadMultiplyInterval) time expired

 

timelimit(0.1e2, RealDomain:-solve(eqns__1, [x, y, z]))

timelimit(0.1e2, RealDomain:-solve(eqns__2, [x, y, z]))

Error, (in RegularChains:-TRDcadIsIntervalNormal) time expired

 

Error, (in RegularChains:-TRDnext_sub_resultant2) time expired

 

timelimit(0.1e2, PDEtools:-Solve(eqns__1, [x, y, z]))

timelimit(0.1e2, PDEtools:-Solve(eqns__2, [x, y, z]))

Error, (in RegularChains:-TRDsub_resultant_chain_monomial_basis) time expired

 

Error, (in modp1/DistDeg) time expired

 

plots['implicitplot3d']([x*y*z+x^2+y^2+z^2 <= 2*(x*y+x*z+y*z), 2*(x^2+y^2+z^2) < x^2*y+x*z^2+y^2*z-27], x = 0 .. 6, y = 0 .. 6, z = 0 .. 6, lightmodel = "light1", orientation = [125, 105, 180], style = "patchnogrid")

 


 

Download x=y=z=3.mw

So none of them is capable of giving a complete description of the region defined by or  with a time limit of "ten seconds". (I believe that completing the evaluation may take a much long time; actually, if there is no constraint on the real time allowed, the symbolic solver will be stuck.) (Note that here it is not hard to find individual instances of values of variables that satisfy them (for example, via the 3-D region boundary plot above), yet they provide less insight into all solutions that exist.)
But in my view,  are too long for these two special systems.

Can Maple solve them more quickly at present? 

> eqns__1 := {x^2+y^2+z^2+x*y*z <= 2*(y*z+z*x+x*y), 2*(x^2+y^2+z^2) < y^2*z+z^2*x+x^2*y-27, x >= 0, y >= 0, z >= 0};
> eqns__2 := {x^2+y^2+z^2+x*y*z <= 2*(y*z+z*x+x*y), 2*(x^2+y^2+z^2) <= y^2*z+z^2*x+x^2*y-27, x > 0, y > 0, z > 0};

(It seems that a potential difficult part for Maple is likely attributable to proving completeness of the solution ….)

Hello community,

Could I please get help on how to invert a probability distribution (reciprocal of) and add the location and scale parameters? The distribution in question is from the built-in (Statistics package) of ChiSquare(n) transformed into a scaled inverse Chi Square with location (shift) parameters.

I have tried the following which results in verified (correct) empirical (sampled) data, but have not been equally successful in the theoretical moments and its quantiles.

 

restart;
st:=time():

with(Statistics):

 

InvChi2:=proc(a,b,n)
        description "inverse chisquare distribution with a=location, b=scale, n=degrees of freedom";


        local CHI := RandomVariable(ChiSquare(n)):
        
        Distribution(
                CDF = unapply(CDF(b*n/CHI+a,t),t),
                PDF = unapply(PDF(b*n/CHI+a,t),t),
                Mean = a+~Mean(b*n/CHI),
                Median = a+~Median(b*n/CHI),
                Variance = simplify(CentralMoment(a+b*n/CHI,2)),
                Skewness = simplify(CentralMoment(b*n/CHI, 3) / CentralMoment(b*n/CHI,2)^(3/2)),
                Kurtosis = simplify(CentralMoment(b*n/CHI, 4) / CentralMoment(b*n/CHI,2)^2),
                Conditions = [b > 0],
                RandomSample = proc(N::nonnegint)
                                a+~Sample(b*n/CHI,N)
                        end proc
                );
        end proc:

 

T:= RandomVariable(InvChi2(2,4.32,3))

 

 

_R0

(1)

evalf(Median(T))

FAIL

(2)

evalf(Mean(T))

14.96000000

(3)

Variance(T)

Float(infinity)

(4)

Skewness(T)

Float(undefined)

(5)

Kurtosis(T)

Float(undefined)

(6)

Quantile(T,.25)

FAIL

(7)

A:=Sample(T,10^5):

Median(A)

HFloat(7.509476657413067)

(8)

Mean(A)

HFloat(14.419072346310452)

(9)

Variance(A)

HFloat(2692.8025716746843)

(10)

Skewness(A)

HFloat(47.59107730088799)

(11)

Quantile(A,.25)

HFloat(5.177452862452726)

(12)

Quantile(A,.75)

HFloat(12.76851658170427)

(13)

printf("Time to execute worksheet = %a seconds", time() - st)

Time to execute worksheet = 2.813 seconds

 

 


Download invChi2.mw

Thank you

How to randomly generate a matrix with the given determinant?

Many thanks!

Hi,

I can build my trigonometric circle, but I want to display irrational values ( instead of decimal values) in the tickmarks option. ideas? P.S : My code is quite long, because I wanted to display amplitudes in an optimal way.

 CERCLETEST.mwCERCLETEST.mw

Hi,

I previously wrote and ran a program with Maple 2020, but I deleted Maple 2020 and now I installed 2023, but that program runs with an error.

Download sssss.mw

B:=5

N:=1

R:=1/2

x = sum(R^g*product(-Br + 1 + Ng, r = 1 .. g - 1)/(B^g*g!), g = 0 .. infinity)

when i press enter it shows this

R := 1/2

1/2

(1)

B := 5

5

(2)

N := 1

1

(3)

x = sum(R^g*(product(-Br+1+Ng, r = 1 .. g-1))/(B^g*factorial(g)), g = 0 .. infinity)

x = 1/((-Br+1+Ng)*exp((1/10)*Br-1/10-(1/10)*Ng))

(4)

``

Download brn.mw

I need him to show it

x=1.090970406879337658

I would like to write this equation:

That is a symbol that I want to be able to use (the S can be added after inserting the symbol). Sometimes, this helps the students to comprehend what they are doing. It could be added the symbols for double and triple integral. So it is some kind of suggestion, but for the moment, it is the actual symbol I would like to have.

I think that I could write it in LaTeX but I don't know if I can do it in Maple and ask him to convert it inside the document.

Thank you in advance for your help.

I try to understand why Maple throws 2 times an error but on a third attempt (with the same input) output is returned. Is that a new mechanism of suppression of error or warning messages and returning output up to a point where evaluation cannot further be performed.

With -sin instead of cos Maple returns output immediately. Does this mean that there is no information to the user available (yet) for this particular case?

three_times_entering_the_same.mw

A very easy example: 

solve({a > 0, ln(a) + ln(1 + a) >= 0}, a);
 = 
                        /    2         \ 
                        |---------- < a| 
                       <  (1/2)         >
                        |5      + 1    | 
                        \              / 

The output is . Clearly,  is also a solution to this inequality, so the solutions have been lost. But there is no warning message. Why?

Respected fellows, greetings!
I wonder if there is a way to increase the length of the legend in maple? I can easily do it in mathematica but I failed to find a way to do the same in maple. It would be so nice if someone could guide me about that please.

It says that one may specify the number of significant (decimal) digits when performing calculations. However, it appears that setting a higher precision does not yield more satisfactory results. Actually, the recommended solver (in the package) can report that a maximization succeeded, and yet the reported solution can be, in effect, incorrect.

restart;

kernelopts(version);

         Maple 2023.0, X86 64 WINDOWS, Mar 06 2023, Build ID 1689885

 

fun := ((2*(x+y+z))*(sqrt(y*z*(z+x)*(x+y))/(z+2*x+y)+sqrt(z*x*(x+y)*(y+z))/(x+2*y+z)+sqrt(x*y*(y+z)*(z+x))/(y+2*z+x))-9*x*y*z/(x+y+z)-2*(x*y+x*z+y*z))/(sqrt(x*y*z/(x+y+z))*(x+y+z-sqrt(27*x*y*z/(x+y+z))))

Digits := 5

Optimization['Maximize'](fun, assume = nonnegative, initialpoint = ({seq})(w = (rand())(), `in`(w, [x, y, z])))

Warning, no iterations performed as initial point satisfies first-order conditions

 

[2.56454435679811255, [x = HFloat(8.44225460865e11), y = HFloat(1.5121750086e11), z = HFloat(3.58747328735e11)]]

(1)

Digits := 10

Optimization['Maximize'](fun, assume = nonnegative, initialpoint = ({seq})(w = (rand())(), `in`(w, [x, y, z])))

Warning, no iterations performed as initial point satisfies first-order conditions

 

[2.54449612902387834, [x = HFloat(9.50923834782e11), y = HFloat(8.94868300574e11), z = HFloat(2.30179425858e11)]]

(2)

Digits := 15

Optimization['Maximize'](fun, assume = nonnegative, initialpoint = ({seq})(w = (rand())(), `in`(w, [x, y, z])))

Warning, no iterations performed as initial point satisfies first-order conditions

 

[2.53798179305501392, [x = HFloat(9.91986977089e11), y = HFloat(5.97663762096e11), z = HFloat(4.31192847449e11)]]

(3)

Digits := 20

Optimization['Maximize'](fun, assume = nonnegative, initialpoint = ({seq})(w = (rand())(), `in`(w, [x, y, z])))

[2.5281266501331255053, [x = 583804136381.99996354, y = 332585592469.99985371, z = 642614553072.00010884]]

(4)

Digits := 25

Optimization['Maximize'](fun, assume = nonnegative, initialpoint = ({seq})(w = (rand())(), `in`(w, [x, y, z])))

Error, (in Optimization:-NLPSolve) complex value encountered

 

Digits := 30

Optimization['Maximize'](fun, assume = nonnegative, initialpoint = ({seq})(w = (rand())(), `in`(w, [x, y, z])))

Warning, undefined value encountered

 

[Float(infinity), [x = 996095848033.138573379019582678, y = 0., z = 473765214257.250967995851222582]]

(5)


 

Download NMaxValue.mw

It is said that the approximate supremum of  is 3e0 (under the assumptions). 

fun:=`assuming`((2*(x+y+z)*(sqrt(y*z*(z+x)*(x+y))/(z+2*x+y\
)+sqrt(z*x*(x+y)*(y+z))/(x+2*y+z)+sqrt(x*y*(y+z)*(z+x))/(y\
+2*z+x))-(9*x*y*z/(x+y+z)+2*(y*z+z*x+x*y)))/(sqrt(x*y*z/(x+y+z))*(x+y+z-sqrt(27*x*y*z/(x+y+z)))),[(x,y,z)>~0]):

I am not sure if the toolbox performs better. But is there a way to obtain significantly accurate output natively?

First Question

 

Let's define a function:

f := proc (x) options operator, arrow; a*x/(4*x^2+b) end proc

proc (x) options operator, arrow; a*x/(4*x^2+b) end proc

(1.1)

now define a new function that is the derivative of f.

g := proc (x) options operator, arrow; diff(f(x), x) end proc

proc (x) options operator, arrow; diff(f(x), x) end proc

(1.2)

g is not what I expected. I expect:

g := proc (x) options operator, arrow; a/(4*x^2+b)-8*a*x^2/(4*x^2+b)^2 end proc

NULL

and if i try to calculate g(0), the result is:

g(0)

Error, (in g) invalid input: diff received 0, which is not valid for its 2nd argument

 

NULL

instead of

a/b

a/b

(1.3)

Second Question

 

I need to define an integral function in which the variable is an integration boundary:

 

h := proc (x) options operator, arrow; int(f(t), t = 0 .. x) end proc

proc (x) options operator, arrow; int(f(t), t = 0 .. x) end proc

(2.1)

if I try to calculate :

h(x)

int(a*t/(4*t^2+b), t = 0 .. x)

(2.2)

how can i do the calculation and display the explicit form of the function, and assign to a name ?

  (1/8)*a*ln(4*x^2+b)-(1/8)*a*ln(b)

(1/8)*a*ln(4*x^2+b)-(1/8)*ln(b)*a

(2.3)

Third Question

 

is there a way to write a system of equation in text mode (or math) in the usual math notation with a big curly bracket followed by the list of equation ? graphically similar to the piecewice operator that seems to be not useful for this purpose?

About the first and the second question i read on the web something but i don't understand deeply what is the reason of the behaviour. I would like to understand really that. Thanks a lot.

Download Questions.mw

In the end of numerics - Mathematica Stack Exchange,  claimed that "I don't know if it also has generalized precision tracking". (Another answer additionally claimed that Mma chooses "significance arithmetic" to track the precision.) So, the question is simple: Does Maple always (automatically) keep track of the accuracy of inexact numbers through a computation?

I beleave this must be wrong - plea

NULL

int(int(x^2+1, x), x)

(1/12)*(x^2+3)^2``

(1)

int(x^2+1, x)

(1/3)*x^3+x

(2)

int((1/3)*x^3+x, x)

(1/12)*(x^2+3)^2

(3)

NULL

NULL


Download Bug_in_Maple_2023.mw

se see attachment !

First 20 21 22 23 24 25 26 Last Page 22 of 32