Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Found integration problem which causes server.exe to crash each time. I hope this can be used to help find why server.exe keeps crashing much more than before in Maple 2022.

 

This happens each time. The above is a typical example of what I have been saying all the time above server.exe crashing. It should not do that. If it can not solve the problem, it should simply return.

I hope these problems will be fixed in Maple 2023.

Any one can figure why it crashes?

Attached worksheet.


 

interface(version);

`Standard Worksheet Interface, Maple 2022.2, Windows 10, October 23 2022 Build ID 1657361`

restart;

integrand:=(2*x^2022+1)/(x^2023+x);
int(integrand,x);

(2*x^2022+1)/(x^2023+x)


 

Download crash_feb_3_2023.mw

 

This question stems from a previous question that has been perfectly resolved by acer and Carl Love, but as Carl Love mentioned the foldl function, today I attempted to experience its functionality (In order to understand the foldl or foldr function). But I encountered a small issue. 

s:="[ (0, 1), (1, 2), (1, 10), (2, 3), (3, 4), (4, 5),
(4, 9), (5, 6), (6, 7), (7, 8),(8, 9), (10, 11), (11, 12),
(11, 16), (12, 13), (13, 14), (14, 15), (15, 16)]";
with(StringTools):
L1:= "()[]": L2:= "{}{}":
X:=foldl(SubstituteAll,s,op([L1[1],L2[1]]),op([L1[2],L2[2]]),op([L1[3],L2[3]]),op([L1[4],L2[4]]));

Error, (in StringTools:-SubstituteAll) expecting 3 arguments, but got 2

I find it strange that foldl doesn't recognize SubstituteAll with three arguments. 

Isn't s and op([L1[i], L2[i]]) providing three arguments? Of course, s is constantly changing.

 

The goal is to replace the above string with:

{ {0, 1}, {1, 2}, {1, 10}, {2, 3}, {3, 4}, {4, 5},

    {4, 9}, {5, 6}, {6, 7}, {7, 8},{8, 9}, {10, 11}, {11, 12},

    {11, 16}, {12, 13}, {13, 14}, {14, 15}, {15, 16}}

 

Hey
My notes from my math course is corrupt and i really need them. When i open the document it just say "worksheet may be incomplete" Can anyone help recovering them? I tried the recover function but it didn't work. Here is the original document: Mat_1_-_Noter.mw

I also have this .bak from the day before where i know it worked:   _Users_jonathanlarsen_Desktop_Mat_1_-_Noter70_MAS.bak.zip
How can i prevent this in the future? It's the second time it has happenend.

Sincerely a frustrated student :(

For instance, here is a list of valid "rules" (given as equations): 

(* restart; *)
rules := [g = d, e = a, a = b, f = d, c = g, b = b, d = c, c = f, a = e]:

But these rules can be represented more compactly as a list of "cycles": 

cycles := [[g, d, c], [e, a], [f, d, c], [b]]:

Is there a efficient way to convert into ? 

Hey guys

I have a question using the piecewise function:

fa := unapply(piecewise(0 < x and x < a, k1, a < x and x < b, k2), x);

simplify(fa(x)) assuming 0 < a, 0 < x and x < a;

It should return k1, but it doesn't. Does anyone have a solution?

Sincerely,

Oliveira

Suppose I have a polynomial:

poly := x^6 - 3*x + 3

And I know one of its roots and its galois group:

firstroot := [solve](poly, x)[1]:
G := GaloisGroup(poly, x):

Since G act transitively on the all roots. How do I get all the other roots of this polynomial just by the firstroot and G, but not by solving the equation.

I would like to set a axis lable as  A (kg/m3)

where A is in italic style, (kg/m3) is in normal style

Is there documentation that tells about what the dollar sign means and how to manage it. It just appears in recent releases and it didn't used to in older releases. It is distracting and seems to appear randomly.

Thanks

I have to maximize my non linear objective function TBCI (given in attached worksheet) with 4 inequality constraints. The decision variables are i and q.The range of i is 0 to 1 and of q is 0 to 76.

When i tru to solve it using NLP solve it is showing error-"Error, (in Optimization:-NLPSolve) constraints must be specified as a set or list of equalities and inequalities".

Please help me to solve it. please find attached the maple file

restart

with(plots); with(DEtools); with(LinearAlgebra); with(Student[VectorCalculus]); with(linalg); with(Optimization); with(student)

TC := proc (Q) options operator, arrow; O1*(1-beta)*D/Q+(1/2)*h1*Q+(1/2)*h2*(gamma-beta)*Qr/gamma+O2*beta*D/Qr+r*beta*D-q*beta*D-P*(1-i)*beta*D end proc

proc (Q) options operator, arrow; Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(O1, Student:-VectorCalculus:-`+`(1, Student:-VectorCalculus:-`-`(beta))), Student:-VectorCalculus:-D), Q^Student:-VectorCalculus:-`-`(1)), Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(h1, Q), 2^Student:-VectorCalculus:-`-`(1))), Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(h2, Student:-VectorCalculus:-`+`(gamma, Student:-VectorCalculus:-`-`(beta))), Qr), Student:-VectorCalculus:-`*`(2, gamma)^Student:-VectorCalculus:-`-`(1))), Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(O2, beta), Student:-VectorCalculus:-D), Qr^Student:-VectorCalculus:-`-`(1))), Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(r, beta), Student:-VectorCalculus:-D)), Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(q, beta), Student:-VectorCalculus:-D))), Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(P, Student:-VectorCalculus:-`+`(1, Student:-VectorCalculus:-`-`(i))), beta), Student:-VectorCalculus:-D))) end proc

(1)

diff(TC(Q), Q)

-O1*(1-beta)*Student:-VectorCalculus:-D/Q^2+(1/2)*h1

(2)

simplify(isolate(%, Q))

Q = RootOf(2*Student:-VectorCalculus:-D*O1*beta+_Z^2*h1-2*Student:-VectorCalculus:-D*O1)

(3)

diff(TC(Q), Qr)

(1/2)*h2*(gamma-beta)/gamma-O2*beta*Student:-VectorCalculus:-D/Qr^2

(4)

simplify(isolate(%, Qr))

Qr = RootOf((beta*h2-gamma*h2)*_Z^2+2*gamma*O2*beta*Student:-VectorCalculus:-D)

(5)

diff(TC(Q), `$`(Q, 2))

2*O1*(1-beta)*Student:-VectorCalculus:-D/Q^3

(6)

diff(TC(Q), `$`(Qr, 2))

2*O2*beta*Student:-VectorCalculus:-D/Qr^3

(7)

TC1 := proc (Q, Qr) options operator, arrow; O1*(-beta*i+1)*D/Q+(1/2)*h1*Q+(1/2)*h2*(-beta*i+gamma)*Qr/gamma+O2*i*beta*D/Qr+r*i*beta*D-q*i*beta*D-P*(1-i)*i*beta*D end proc

proc (Q, Qr) options operator, arrow; Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(O1, Student:-VectorCalculus:-`+`(1, Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(i, beta)))), Student:-VectorCalculus:-D), Q^Student:-VectorCalculus:-`-`(1)), Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(h1, Q), 2^Student:-VectorCalculus:-`-`(1))), Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(h2, Student:-VectorCalculus:-`+`(gamma, Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(i, beta)))), Qr), Student:-VectorCalculus:-`*`(2, gamma)^Student:-VectorCalculus:-`-`(1))), Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(O2, i), beta), Student:-VectorCalculus:-D), Qr^Student:-VectorCalculus:-`-`(1))), Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(r, i), beta), Student:-VectorCalculus:-D)), Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(q, i), beta), Student:-VectorCalculus:-D))), Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(P, Student:-VectorCalculus:-`+`(1, Student:-VectorCalculus:-`-`(i))), i), beta), Student:-VectorCalculus:-D))) end proc

(8)

diff(TC1(Q, Qr), Q)

-O1*(-beta*i+1)*Student:-VectorCalculus:-D/Q^2+(1/2)*h1

(9)

a1 := isolate(-O1*(-beta*i+1)*D/Q^2+(1/2)*h1, Q)

Q = RootOf(2*Student:-VectorCalculus:-D*O1*beta*i+_Z^2*h1-2*Student:-VectorCalculus:-D*O1)

(10)

diff(TC1(Q, Qr), Qr)

(1/2)*h2*(-beta*i+gamma)/gamma-O2*i*beta*Student:-VectorCalculus:-D/Qr^2

(11)

a2 := isolate(diff(TC1(Q, Qr), Qr), Qr)

Qr = RootOf((beta*h2*i-gamma*h2)*_Z^2+2*gamma*O2*i*beta*Student:-VectorCalculus:-D)

(12)

TC2 := proc (Q) options operator, arrow; O1*(1-gamma)*D/Q+(1/2)*h1*Q+r*gamma*D-q*gamma*D-P*(1-i)*gamma*D end proc

proc (Q) options operator, arrow; Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`+`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(O1, Student:-VectorCalculus:-`+`(1, Student:-VectorCalculus:-`-`(gamma))), Student:-VectorCalculus:-D), Q^Student:-VectorCalculus:-`-`(1)), Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(h1, Q), 2^Student:-VectorCalculus:-`-`(1))), Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(r, gamma), Student:-VectorCalculus:-D)), Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(q, gamma), Student:-VectorCalculus:-D))), Student:-VectorCalculus:-`-`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(Student:-VectorCalculus:-`*`(P, Student:-VectorCalculus:-`+`(1, Student:-VectorCalculus:-`-`(i))), gamma), Student:-VectorCalculus:-D))) end proc

(13)

b1 := isolate(diff(TC2(Q), Q), Q)

Q = RootOf(2*Student:-VectorCalculus:-D*O1*gamma+_Z^2*h1-2*Student:-VectorCalculus:-D*O1)

(14)

E1 := eval(a1, [P = 765, D = 347933, O1 = 30, O2 = 10, h1 = 76.5, h2 = 38.25, beta = 0.5e-1, gamma = 0.4e-1, q = 7.65, r = 382.5, i = .5])

Q = RootOf(76.5*_Z^2-20354080.50)

(15)

simplify(E1)

Q = 515.8162578

(16)

E2 := eval(a2, [P = 765, D = 347933, O1 = 30, O2 = 10, h1 = 76.5, h2 = 38.25, beta = 0.5e-1, gamma = 0.4e-1, q = 7.65, r = 382.5, i = .5])

Qr = RootOf(.57375*_Z^2-6958.66000)

(17)

simplify(E2)

Qr = 110.1289401

(18)

Totcost := eval(TC1(Q, Qr), [Q = 516, Qr = 110, P = 765, D = 347933, O1 = 30, O2 = 10, h1 = 76.5, h2 = 38.25, beta = 0.5e-1, gamma = 0.4e-1, q = 7.65, r = 382.5, i = .5])

-25502.577

(19)

TB1 := B1*D*P*beta*i-D*beta*i*q

B1*Student:-VectorCalculus:-D*P*beta*i-Student:-VectorCalculus:-D*beta*i*q

(20)

TBC := eval(TB1, [B1 = 3.36, P = 765, D = 347933, O1 = 30, O2 = 10, h1 = 76.5, h2 = 38.25, beta = 0.5e-1, gamma = 0.4e-1, r = 382.5])

-17396.65*q*i+44716349.16*i

(21)

Totincent := P*i^2*beta*D

P*i^2*beta*Student:-VectorCalculus:-D

(22)

TI := eval(Totincent, [B1 = 3.36, P = 765, D = 347933, O1 = 30, O2 = 10, h1 = 76.5, h2 = 38.25, beta = 0.5e-1, gamma = 0.4e-1, r = 382.5])

13308437.25*i^2

(23)

NULL

simplify(subs(P = 765, D = 347933, O1 = 30, O2 = 10, h1 = 76.5, h2 = 38.25, gamma = 0.4e-1, q = 7.65, r = 382.5, beta = 0.5e-1, Q = sqrt((2*(-beta*i+1))*O1*D/h1))); simplify(subs(P = 765, D = 347933, O1 = 30, O2 = 10, h1 = 76.5, h2 = 38.25, gamma = 0.4e-1, q = 7.65, r = 382.5, beta = 0.5e-1, Qr = sqrt(2*i*beta*gamma*O2*D/((gamma-beta)*h2))))

Q = 3230.787830*(-0.1307189542e-2*i+0.2614379084e-1)^(1/2)

 

Qr = 190.7489196*(-i)^(1/2)

(24)

TCo := eval(TC1(Q, Qr), [Q = 3230.787830*sqrt(-0.1307189542e-2*i+0.2614379084e-1), Qr = 190.7489196*sqrt(-i), P = 765, D = 347933, O1 = 30, O2 = 10, h1 = 76.5, h2 = 38.25, gamma = 0.4e-1, q = 7.65, r = 382.5, beta = 0.5e-1])

3230.787829*(-0.5e-1*i+1)/(-0.1307189542e-2*i+0.2614379084e-1)^(1/2)+123577.6345*(-0.1307189542e-2*i+0.2614379084e-1)^(1/2)+91201.82720*(-0.5e-1*i+0.4e-1)*(-i)^(1/2)+912.0182718*i/(-i)^(1/2)+6521134.252*i-13308437.25*(1-i)*i

(25)

eq1 := TCo <= 0

3230.787829*(-0.5e-1*i+1)/(-0.1307189542e-2*i+0.2614379084e-1)^(1/2)+123577.6345*(-0.1307189542e-2*i+0.2614379084e-1)^(1/2)+91201.82720*(-0.5e-1*i+0.4e-1)*(-i)^(1/2)+912.0182718*i/(-i)^(1/2)+6521134.252*i-13308437.25*(1-i)*i <= 0

(26)

eq2 := 0 <= q/P and q/P <= 1

0 <= q/P and q/P <= 1

(27)

eq3 := 0 <= i and i <= gamma/beta

0 <= i and i <= gamma/beta

(28)

eq4 := TBC >= 0

0 <= -17396.65*q*i+44716349.16*i

(29)

``

TBCI := TBC-TCo+TI

-17396.65*q*i+38195214.91*i-3230.787829*(-0.5e-1*i+1)/(-0.1307189542e-2*i+0.2614379084e-1)^(1/2)-123577.6345*(-0.1307189542e-2*i+0.2614379084e-1)^(1/2)-91201.82720*(-0.5e-1*i+0.4e-1)*(-i)^(1/2)-912.0182718*i/(-i)^(1/2)+13308437.25*(1-i)*i+13308437.25*i^2

(30)

NLPSolve(TBCI, {eq1, eq2, eq3, eq4}, assume = nonnegative)

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

 

``

For instance, Hypergeometric0F1Regularized^(1,0)[1,1.] = -0.113894... as given in Mathematica. I was wondering how this type of regularized hypergeometric function is defined in Maple. 

I incidently(*) discovered that using MatrixPower to find the square root matrix of a relatively small matrix, returns wrong results, even for symetric positive definite matrices.

Trying to understand how MatrixPower proceeds using showstat is not that easy, but something I'm almost sure is that it doesn't ise an Eigenvectors decomposition.

Here is an example where I'm seeking for a matrix M such that C = M^2 and C is symetric definite positive of dimension 40.
(I didn't check if problems already occurs for smaller sizes)

(*)  I was very bored by the prohibitive execution time of MatrixPower and looked for an alternative.

The matrix M that MatrixPower generates is far from verifying C = M^2 (using the option 'shape'='symmetric' doesn't improve anything).
The naive alternative based on an Eigenvectors decomposition works perfectly well while being 200 times faster.

restart:

with(LinearAlgebra):
with(Statistics):

f := proc(p)
  Sample(Uniform(0, 1), [100, p]):
  CorrelationMatrix(%):
end proc:

C := f(40):

M_MP := CodeTools:-Usage( MatrixPower(C, 1/2) ):

memory used=382.38MiB, alloc change=12.01MiB, cpu time=6.05s, real time=6.26s, gc time=386.00ms

 

LE := proc(R)
  local L, E;
  L, E := LinearAlgebra:-Eigenvectors(evalf(R)):
  L    := map(Re, L):
  E    := map(Re, E):
  E . DiagonalMatrix(sqrt~(L)) . E^(-1)
end proc:

IsDefinite(C, query = 'positive_definite');

M_LE := CodeTools:-Usage( LE(C) ):

true

 

memory used=0.90MiB, alloc change=0 bytes, cpu time=29.00ms, real time=10.00ms, gc time=0ns

 

map(fnormal, M_MP . M_MP - C):
%[1..5, 1..5];

Matrix([[-493.2020830, -3096.801269, 3350.121141, -2972.190814, -6160.797678], [-2436.661317, -6415.706483, 208.1172241, -3001.930739, 1332.904551], [202.2560565, 413.4962022, 799.7833045, -179.6552377, -1817.784899], [-2994.580353, -9862.899715, 2543.110865, -5679.831865, -2552.349252], [-98.63574955, 2078.317993, -3118.445704, 2420.432714, 5905.315145]])

(1)

map(fnormal, M_LE . M_LE - C):
%[1..5, 1..5];

Matrix([[0., -0., -0., 0., 0.], [-0., 0., 0., 0., 0.], [-0., 0., -0., 0., -0.], [0., 0., -0., 0., -0.], [-0., 0., -0., -0., -0.]])

(2)

 

Download MatrixPower_bug.mw

First 105 106 107 108 109 110 111 Last Page 107 of 2097