MaplePrimes Questions

How to remove the ln(e) in the fianl answer shown in the picture, ( must be Maple 15), thanks

Hi,

I want to solve system of PDE equations by maple and i dont know how can i write it codes that can solve them for me. Can you create the code for the equation

Thank you

restart;
with(geometry):
with(plots):
_EnvHorizontalName = 'x':
_EnvVerticalName = 'y':
point(A, [-2, 7]):
point(B, [-5, -2]):
point(C, [8, -2]):
triangle(ABC, [A, B, C]):
display([draw[A(color = black, symbol = solidcircle, symbolsize = 6), 
               B(color = black, symbol = solidcircle, symbolsize = 6), 
               C(color = black, symbol = solidcircle, symbolsize = 6), 
               ABC(color = blue)], 
         textplot([[coordinates(A)[], "A"], 
              [coordinates(B)[], "B"], 
              [coordinates(C)[], "C"]],
              align = [above, right])], 
              axes = none);
Would you explain to me why this error ? Thank you.
Error, (in plots:-display) expecting plot structures but received: [geometry:-draw[A(color = black, symbol = solidcircle, symbolsize = 6), B(color = black, symbol = solidcircle, symbolsize = 6), C(color = black, symbol = solidcircle, symbolsize = 6), ABC(color = blue)]]

Edits: In fact it is a set partition problem.

 

I have the following subsets: 

s:={"a","b","c","d","e","f"}:

I want to divide the set into 2 groups such that each group has exactly 3 elements. We want to generate all solutions. Note that we treat ({"a", "b", "c"}|{"d", "e", "f"}) and ({"d", "e", "f"}|{"a", "b", "c"}) as the same solution.

So first I used the choose function to generate all 3-subsets and then filtered for duplicate solutions.

with(combinat):
M:=[op(choose({"a","b","c","d","e","f"},3))]:
l:=[ListTools:-Categorize((x,y)-> is(x =`minus`(s, y)),M)]:
seq(l[i][1],i=1..10)

{"a", "b", "c"}, {"a", "b", "d"}, {"a", "b", "e"}, {"a", "b", "f"}, {"a", "c", "d"}, {"a", "c", "e"}, {"a", "c", "f"}, {"a", "d", "e"}, {"a", "d", "f"}, {"a", "e", "f"}

But I feel like the solution is a bit inefficient. In fact, we only need half of all 3-subsets. I wonder if we can only keep one representative member of the same  solutions when generating the 3-subsets. 

gengcuts.mw

 In fact, the problem can be generalized as follows: given a list of n elements, divide it into m groups and generate all solutions. Similarly,  the same solution is generated only once. 

Why there is an error? Is any part missing in the if statement?

restart

rel := w+(1/2)*sqrt(960*c^6*gamma^2*k^2-336*c^4*gamma^2*k^4+64*c^2*gamma^2*k^6-4*gamma^2*k^8+576*alpha*c^6*gamma*k-288*alpha*c^4*gamma*k^3-16*alpha*c^2*gamma*k^5+8*alpha*gamma*k^7-144*alpha^2*c^4*k^2-48*alpha^2*c^2*k^4-4*alpha^2*k^6+128*c^4*gamma*k^2-40*c^2*gamma*k^4+4*gamma*k^6+48*alpha*c^4*k-16*alpha*c^2*k^3-4*alpha*k^5+4*c^2*k^2-k^4)

w+(1/2)*(960*c^6*gamma^2*k^2-336*c^4*gamma^2*k^4+64*c^2*gamma^2*k^6-4*gamma^2*k^8+576*alpha*c^6*gamma*k-288*alpha*c^4*gamma*k^3-16*alpha*c^2*gamma*k^5+8*alpha*gamma*k^7-144*alpha^2*c^4*k^2-48*alpha^2*c^2*k^4-4*alpha^2*k^6+128*c^4*gamma*k^2-40*c^2*gamma*k^4+4*gamma*k^6+48*alpha*c^4*k-16*alpha*c^2*k^3-4*alpha*k^5+4*c^2*k^2-k^4)^(1/2)

(1)

crit_points := solve(diff(rel, k) = 0, k); rel_at_crit := subs(k = crit_points, rel)

"#` determine the maxima and minima by checking the sign of the second derivative at the critical points`  for i from 1 to nops(crit_points) do    if (eval(diff(diff(rel, k), k), k = crit_points[i]) > 0) then      print("Minimum at k = ", crit_points[i], " with value ", rel_at_crit[i]);    else if (eval(diff(diff(rel, k), k), k = crit_points[i]) < 0) then      print("Maximum at k = ", crit_points[i], " with value ", rel_at_crit[i]);    else      print("Saddle point at k = ", crit_points[i], " with value ", rel_at_crit[i]);    end if;  end do; "

Error, invalid if statement termination

"#` determine the maxima and minima by checking the sign of the second derivative at the critical points`  for i from 1 to nops(crit_points) do    if (eval(diff(diff(rel, k), k), k = crit_points[i]) > 0) then   print("Minimum at k = ", crit_points[i], " with value ", rel_at_crit[i]);    else if (eval(diff(diff(rel, k), k), k = crit_points[i]) < 0) then   print("Maximum at k = ", crit_points[i], " with value ", rel_at_crit[i]);    else   print("Saddle point at k = ", crit_points[i], " with value ", rel_at_crit[i]);    end if;  end do; "

 

NULL

Download maxnmin.mw

I input this codes:

latex((4*n-1)/9-7/16*n)

\frac{n}{144}-\frac{1}{9}

This is not the output I expected.  I would like to obtain an expression similar to the one below.

\frac{4 n-1}{9}-\frac{7}{16}n

How can I achieve this, as Maple seems to have processed it internally.

Does maple over-understand the expression.

Good day,
 

1. Please I need your greatest help. Can anyone please help me to run the examples on the attached papers on Maple software?

 2. Also help me to plot the graphs along with the exact solution

 3. If possible with tables

 I tried but did not get the results as expected. I shall be very grateful if I can get assistance from you

 

Thanks
 

How to perform PCR principal component Regression and PLS partial least squares Regression in Maple?

Dear all

have a nice time. 

I have a system of nonlinear differential equation with continuous delay.  I tried to find some books that define a strategy to compute the characteristic equation but unfortunattely the most of papers or books give directly the formula without any proof. 

I tried with maple, but unfortunattely no solution up to now. 

I hope find the strategy how find the characteristic equation of the attached system.

characteristic_equation.mw

thanks 

I have a workflow in which I edit files from a package I develop. These are usually mpl files, and I edit them in an editor (VS Code).

Then I have a worksheet called readFile.mw open in Maple that has two commands:

restart:

read("path/to/an/entry/file/that/includes/all/the/other/files")

and another worksheet actual.mw which is the actual worksheet I am working on, which starts with restart: with(MyPackage): and then contains calls to procedures from the package.

With this workflow, I make a change in the editor, execute readFile.mw and then go to my actual worksheet and restart and then use with(MyPackage), and the updates are available.

This works.

However, in actual.mw I may have a bunch of data that I don't want to wipe out with a restart. 

On the other hand, if I don't restart, a new call to with(MyPackage) does not update the import of the package (because it has already been imported. 

Is there an idiomatic or preferred way to accomplish reimporting the package without having to call restart?

PS I don't remember now the exact reason why I don't have the call to read the file in actual.mw but it had something to do with this issue of not getting the package updated correctly.

I think my question can be answered without necessrily providing any code. 

I have a procedure that takes in many arguments and performs heavy calculations (solves multiple sets of differential equations in parallel using Grid:-Map and then does matrix manipulations with results, etc).

It runs fine in a Maple worksheet. 

Until about half an hour ago, I hadn't used the Maple CLI. I would like to run my procedure from the CLI. I did exactly the steps as I do them in a worksheet.

with(MyPackage):

myProcedure(argsList);

But Maple just echoes the second command back to me. myProcedure is in myPackage. There is a much simpler procedure in that package called myProcedure2 and I can call that just fine from the CLI.

What could be happening?

I would like to write some code to test certain functions in a codebase that has gotten relatively large but has no tests. I recently found a bug caused by copying a line and pasting it five times (was supposed to change a parameter on each line but forgot to). Didn't notice the bug until I refactored that procedure to make the code parallelizable for use with the Grid package.

Hence, I am worried about such unknown calculation mistakes in algorithms that involve a sequence of intermediate steps/calculations.

I found there is an assert command

I would write procedures that would call the procedures to be tested with certain arguments and assert the output.

Are there any other tools available or best practices perhaps from experience?

Is it possible to indent list/bullet items easily?  In other programs, when you tab to indent a bullet item, the bullet moves with you.  In Maple the bullet and/or list item stays fixed to the left of the execution group.

restart;
with(geometry):
with(plots):
_EnvHorizontalName = 'x':
_EnvVerticalName = 'y':
EQ := proc(M, N) 
local eq, sol; 
eq := simplify(expand((y - M[2])/(x - M[1]) - (N[2] - M[2])/(N[1] - M[1]))); 
sol := solve(eq, y); 
RETURN(y = sol); end proc:
_local(D);
point(A, [-2, 7]):
point(B, [-5, -2]):
point(C, [8, -7]):
point(E, [1, 4]):
EQ([-5, -2], [8, -7]):
point(D, [1, subs(x = 1, rhs(%))]):
dsegment(sgAD, [A, D]):
BD := distance(B, D):
DC := distance(C, D):
triangle(ABC, [A, B, C]):
area(ABC):
triangle(ABD, [A, B, D]):
area(ABD):
triangle(ADC, [A, D, C]):
area(ADC):
is(area(ABD)/area(ADC) = BD/DC):
triangle(EBD, [E, B, D]):
area(EBD):
triangle(EDC, [E, D, C]):
area(EDC):
triangle(AEC, [A, E, C]):
area(AEC):
triangle(ABE, [A, B, E]):
area(ABE):
is(area(ABE)/area(AEC) = BD/DC):
display*([draw*[A(color = black, symbol = solidcircle, symbolsize = 6), 
B(color = black, symbol = solidcircle, symbolsize = 6), 
C(color = black, symbol = solidcircle, symbolsize = 6), 
ABC(color = blue)], 
textplot*([[coordinates(A)[], "A"], 
[coordinates(B)[], "B"], 
[coordinates(C)[], "C3"]], 
align = [above, right])], 
axes = none, 
title = "Lemme du Chevron");
The program simply reproduces display...Why; Thank you.
display*([draw*[A(color = black, symbol = solidcircle, symbolsize = 12), B(color = black, symbol = solidcircle, symbolsize = 12), C(color = black, symbol = solidcircle, symbolsize = 12), ABC(color = blue)], textplot*([[-2, 7, "A"], [-5, -2, "B"], [8, -7, "C3"]], align = [above, right])], axes = none, title = "Lemme du Chevron")

 

 

queryequal(expr1, expr2)

queryequal(Int(1/((x__0-x)^(1/2)*(-x^2+1)^(1/2)), x = 0 .. x__0) = 2^(1/2)*EllipticK((1/2)*(2+2*x__0)^(1/2))-2^(1/2)*EllipticF(1/(1+x__0)^(1/2), (1/2)*(2+2*x__0)^(1/2)), 2^(1/2)*EllipticF((1-1/(1+x__0))^(1/2)*2^(1/2), (1/2)*(1+x__0)^(1/2)*2^(1/2)))

(1)

(This question has its origin here).
Plotting the difference of rhs - lhs seems to indicate equality over the range [0..1)

difference := rhs(op(queryequal(Int(1/((x__0-x)^(1/2)*(-x^2+1)^(1/2)), x = 0 .. x__0) = 2^(1/2)*EllipticK((1/2)*(2+2*x__0)^(1/2))-2^(1/2)*EllipticF(1/(1+x__0)^(1/2), (1/2)*(2+2*x__0)^(1/2)), 2^(1/2)*EllipticF((1-1/(1+x__0))^(1/2)*2^(1/2), (1/2)*(1+x__0)^(1/2)*2^(1/2))))[1])-op(queryequal(Int(1/((x__0-x)^(1/2)*(-x^2+1)^(1/2)), x = 0 .. x__0) = 2^(1/2)*EllipticK((1/2)*(2+2*x__0)^(1/2))-2^(1/2)*EllipticF(1/(1+x__0)^(1/2), (1/2)*(2+2*x__0)^(1/2)), 2^(1/2)*EllipticF((1-1/(1+x__0))^(1/2)*2^(1/2), (1/2)*(1+x__0)^(1/2)*2^(1/2))))[2]; plot(difference, x__0 = 0 .. 1, title = 'difference', color = RED)

 

Try simplify

`assuming`([simplify(difference)], [0 < x__0 and x__0 < 1])

(EllipticK((1/2)*(2+2*x__0)^(1/2))-EllipticF(x__0^(1/2)*2^(1/2)/(1+x__0)^(1/2), (1/2)*(1+x__0)^(1/2)*2^(1/2))-EllipticF(1/(1+x__0)^(1/2), (1/2)*(1+x__0)^(1/2)*2^(1/2)))*2^(1/2)

(2)

Try combine

`assuming`([combine(difference)], [0 < x__0 and x__0 < 1])

-2^(1/2)*EllipticF((x__0/(1+x__0))^(1/2)*2^(1/2), (1/2)*(2+2*x__0)^(1/2))-2^(1/2)*EllipticF(1/(1+x__0)^(1/2), (1/2)*(2+2*x__0)^(1/2))+2^(1/2)*EllipticK((1/2)*(2+2*x__0)^(1/2))

(3)

Try conversion to integral form

convert(difference, Int)

2^(1/2)*(Int(2/((-_alpha1^2+1)^(1/2)*(-2*_alpha1^2*x__0-2*_alpha1^2+4)^(1/2)), _alpha1 = 0 .. 1))-2^(1/2)*(Int(2/((-_alpha1^2+1)^(1/2)*(-2*_alpha1^2*x__0-2*_alpha1^2+4)^(1/2)), _alpha1 = 0 .. 1/(1+x__0)^(1/2)))-2^(1/2)*(Int(2/((-_alpha1^2+1)^(1/2)*(-2*_alpha1^2*x__0-2*_alpha1^2+4)^(1/2)), _alpha1 = 0 .. (1-1/(1+x__0))^(1/2)*2^(1/2)))

(4)

`assuming`([simplify(%)], [0 < x__0 and x__0 < 1])

-2*2^(1/2)*(Int(1/((-_alpha1^2+1)^(1/2)*(4+(-2*x__0-2)*_alpha1^2)^(1/2)), _alpha1 = 0 .. 1/(1+x__0)^(1/2))-(Int(1/((-_alpha1^2+1)^(1/2)*(4+(-2*x__0-2)*_alpha1^2)^(1/2)), _alpha1 = x__0^(1/2)*2^(1/2)/(1+x__0)^(1/2) .. 1)))

(5)

plot(-2*2^(1/2)*(Int(1/((-_alpha1^2+1)^(1/2)*(4+(-2*x__0-2)*_alpha1^2)^(1/2)), _alpha1 = 0 .. 1/(1+x__0)^(1/2))-(Int(1/((-_alpha1^2+1)^(1/2)*(4+(-2*x__0-2)*_alpha1^2)^(1/2)), _alpha1 = x__0^(1/2)*2^(1/2)/(1+x__0)^(1/2) .. 1))), x__0 = .999 .. 1, color = RED)

 

evalf(eval(-2*2^(1/2)*(Int(1/((-_alpha1^2+1)^(1/2)*(4+(-2*x__0-2)*_alpha1^2)^(1/2)), _alpha1 = 0 .. 1/(1+x__0)^(1/2))-(Int(1/((-_alpha1^2+1)^(1/2)*(4+(-2*x__0-2)*_alpha1^2)^(1/2)), _alpha1 = x__0^(1/2)*2^(1/2)/(1+x__0)^(1/2) .. 1))), x__0 = 1), 40); evalf(eval(-2*2^(1/2)*(Int(1/((-_alpha1^2+1)^(1/2)*(4+(-2*x__0-2)*_alpha1^2)^(1/2)), _alpha1 = 0 .. 1/(1+x__0)^(1/2))-(Int(1/((-_alpha1^2+1)^(1/2)*(4+(-2*x__0-2)*_alpha1^2)^(1/2)), _alpha1 = x__0^(1/2)*2^(1/2)/(1+x__0)^(1/2) .. 1))), x__0 = .9999999999), 40)

-0.8716953127866940896552122384831392143938e-30

(6)

There seems to be a finite difference at x__0 = 1

``

Try an addition theorem from DLMF

Since all elliptic expression have the same modulus k, the following addition theorem could be applied under the condition that the corresponding case is fulfilled https://dlmf.nist.gov/19.11#E7

Check if the following case applies (i.e. is ψ=π/2?)

 

NULL

NULL

queryequal(Int(1/((x__0-x)^(1/2)*(-x^2+1)^(1/2)), x = 0 .. x__0) = 2^(1/2)*EllipticK((1/2)*(2+2*x__0)^(1/2))-2^(1/2)*EllipticF(1/(1+x__0)^(1/2), (1/2)*(2+2*x__0)^(1/2)), 2^(1/2)*EllipticF((1-1/(1+x__0))^(1/2)*2^(1/2), (1/2)*(1+x__0)^(1/2)*2^(1/2)))

queryequal(Int(1/((x__0-x)^(1/2)*(-x^2+1)^(1/2)), x = 0 .. x__0) = 2^(1/2)*EllipticK((1/2)*(2+2*x__0)^(1/2))-2^(1/2)*EllipticF(1/(1+x__0)^(1/2), (1/2)*(2+2*x__0)^(1/2)), 2^(1/2)*EllipticF((1-1/(1+x__0))^(1/2)*2^(1/2), (1/2)*(1+x__0)^(1/2)*2^(1/2)))

(7)

theta = 1/sqrt(1+x__0), `&varphi;` = sqrt(1-1/(1+x__0))*sqrt(2)

theta = 1/(x__0+1)^(1/2), varphi = (1-1/(x__0+1))^(1/2)*2^(1/2)

(8)

k = (1/2)*sqrt(1+x__0)*sqrt(2)

k = (1/2)*(x__0+1)^(1/2)*2^(1/2)

(9)

tan((1/2)*psi) = (sin(theta)*Delta(`&varphi;`)+sin(`&varphi;`)*Delta(theta))/(cos(theta)+cos(`&varphi;`))

tan((1/2)*psi) = (sin(theta)*Delta(varphi)+sin(varphi)*Delta(theta))/(cos(theta)+cos(varphi))

(10)

Delta(theta) = sqrt(1-k^2*sin(theta)^2)

Delta(theta) = (1-k^2*sin(theta)^2)^(1/2)

(11)

subs(theta = `&varphi;`, Delta(theta) = (1-k^2*sin(theta)^2)^(1/2))

Delta(varphi) = (1-k^2*sin(varphi)^2)^(1/2)

(12)

subs(Delta(theta) = (1-k^2*sin(theta)^2)^(1/2), Delta(varphi) = (1-k^2*sin(varphi)^2)^(1/2), k = (1/2)*(1+x__0)^(1/2)*2^(1/2), theta = 1/(1+x__0)^(1/2), varphi = (1-1/(1+x__0))^(1/2)*2^(1/2), tan((1/2)*psi) = (sin(theta)*Delta(varphi)+sin(varphi)*Delta(theta))/(cos(theta)+cos(varphi)))

tan((1/2)*psi) = (sin(1/(x__0+1)^(1/2))*(1-(1/2)*(x__0+1)*sin((1-1/(x__0+1))^(1/2)*2^(1/2))^2)^(1/2)+sin((1-1/(x__0+1))^(1/2)*2^(1/2))*(1-(1/2)*(x__0+1)*sin(1/(x__0+1)^(1/2))^2)^(1/2))/(cos(1/(x__0+1)^(1/2))+cos((1-1/(x__0+1))^(1/2)*2^(1/2)))

(13)

`assuming`([simplify(subs(psi = (1/2)*Pi, tan((1/2)*psi) = (sin(1/(1+x__0)^(1/2))*(1-(1/2)*(1+x__0)*sin((1-1/(1+x__0))^(1/2)*2^(1/2))^2)^(1/2)+sin((1-1/(1+x__0))^(1/2)*2^(1/2))*(1-(1/2)*(1+x__0)*sin(1/(1+x__0)^(1/2))^2)^(1/2))/(cos(1/(1+x__0)^(1/2))+cos((1-1/(1+x__0))^(1/2)*2^(1/2)))))], [0 < x__0 and x__0 < 1])

1 = (sin(1/(x__0+1)^(1/2))*((2+2*x__0)*cos(x__0^(1/2)*2^(1/2)/(x__0+1)^(1/2))^2+2-2*x__0)^(1/2)+sin(x__0^(1/2)*2^(1/2)/(x__0+1)^(1/2))*((2+2*x__0)*cos(1/(x__0+1)^(1/2))^2+2-2*x__0)^(1/2))/(2*cos(1/(x__0+1)^(1/2))+2*cos(x__0^(1/2)*2^(1/2)/(x__0+1)^(1/2)))

(14)

plot([lhs(1 = (sin(1/(1+x__0)^(1/2))*((2+2*x__0)*cos(x__0^(1/2)*2^(1/2)/(1+x__0)^(1/2))^2+2-2*x__0)^(1/2)+sin(x__0^(1/2)*2^(1/2)/(1+x__0)^(1/2))*((2+2*x__0)*cos(1/(1+x__0)^(1/2))^2+2-2*x__0)^(1/2))/(2*cos(1/(1+x__0)^(1/2))+2*cos(x__0^(1/2)*2^(1/2)/(1+x__0)^(1/2)))), rhs(1 = (sin(1/(1+x__0)^(1/2))*((2+2*x__0)*cos(x__0^(1/2)*2^(1/2)/(1+x__0)^(1/2))^2+2-2*x__0)^(1/2)+sin(x__0^(1/2)*2^(1/2)/(1+x__0)^(1/2))*((2+2*x__0)*cos(1/(1+x__0)^(1/2))^2+2-2*x__0)^(1/2))/(2*cos(1/(1+x__0)^(1/2))+2*cos(x__0^(1/2)*2^(1/2)/(1+x__0)^(1/2))))], x__0 = 0 .. 1, legend = [lhs, rhs])

 

lhs and rhs are not equal -> Case psi = (1/2)*Pi does not apply (provided that the formulas have been applied correctly).
Perhaps this is why Maple does not simply the difference to zero.  NULL


Anything else that could be tried in Maple (maybe with other formulas)?

Download Equality_of_Elliptic_expressions.mw

First 114 115 116 117 118 119 120 Last Page 116 of 2308