Can .mpl type files be combined?...

I have  4 worksheets with derived equations. So I export the equations and  possibly some procedures (but they can be handled seperately if needed)  from each worksheet as a .mpl file.

I want to combine the .mpl files  together without using copy/paste. Then I can open that single file in the VS code editor.
There may be other ways to achieve this so I am open to suggestions.

How do I get this to factor?...

I chased down a problem to factoring a square that has sqrt in the coefficients. All numbers are real,
The code is inside a procedure in a package. Iso I could do with something robust.

expand((sqrt(A+B)*x+sqrt(7-K)*y)^2)
2      2            (1/2)          (1/2)        2      2
A x  + B x  + 2 (A + B)      x (7 - K)      y - K y  + 7 y

factor(%)


Plotting Linear System of Equations...

Hello, everyone,

I am new to Maple and I am trying to get use of it.

I tried to plot the following linear systems in different ways. I realized that the Student Linear Algebra is not as flexible as Linear Algebra. My question is the following. Is there any other way to create a plot without defining the implicit plots?

 >
 >
 (1)
 >
 >
 >
 >
 (2)
 >
 >
 >
 >
 >

Unexpected results from GraphTheory:-WienerIndex? ...

OEIS A034828 and OEIS A000292 (which give the Wiener index for the cycle graph and the path graph respectively) mention that

the Wiener index of the cycle of length 19 is 855 and
the Wiener index of the path with 19 edges is 1330

However,

GraphTheory:-WienerIndex(GraphTheory:-CycleGraph(19));
=
38

GraphTheory:-WienerIndex(GraphTheory:-PathGraph(20));
=
38



So what happened here?

why Maple server crashes when calling StringTools:...

I was attempting to remove part of string using StringTools:-Remove()

But it causes server.exe crash each time.

Any idea why this happens?

Worksheet below

 > interface(version);

 > Physics:-Version();

 > restart;

 > ode:=x*y(x)*diff(y(x), x) = (x + 1)*(y(x) + 1): ode:=diff(y(x), x$2) = (y(x) + 1): the_output:=Student:-ODEs:-ODESteps(ode,y(x)):  > s:=latex(the_output,'output'=string):  > StringTools:-Remove(s,"\\begin{array}{ccc}"); ps. reported to Maplesoft also. why Maple can't find singular solution to first or... Asked by: Maple dsolve fails to find many singular solutions using the option 'singsol'=all. Any idea why that is? Here is one example ode:=diff(y(x),x)=(y(x)-3)^2; dsolve(ode,y(x),'singsol'=all) It returns But we see that y=3 is singular solution which can't be obtained from the above solution for any value of c1 Mathematica finds this singular solution ode=y'[x]==(y[x]-3)^2 DSolve[ode,y[x],x,IncludeSingularSolutions->True] Here is second example. restart; ode:=diff(y(x),x)=2*x*sqrt(1-y(x)^2); dsolve(ode,y(x),'singsol'=all) Gives But it misses the y=1,y=-1 singular solutions. Is there something I am doing wrong? Why does Maple sometimes fail to find singular solutions? ps. reported to Mapesoft also. Update I remembered now a case similar to this. one has to use Lie solver and now Maple gives the singular solution ode:=diff(y(x),x)=(y(x)-3)^2; dsolve(ode,Lie,'singsol'=all) There is no mention of this in help and it is still not clear to me if one has to always use Lie solver to obtain singsol or if this is just a coincidence for this one case. Same for the other case: restart; ode:=diff(y(x),x)=2*x*sqrt(1-y(x)^2); dsolve(ode,'Lie','singsol'=all) gives I think singsol should work all the time and not only when using specific solver. If Lie solver is needed for singsol to work, then help should be clear and say this. Wrong minimal polynomials?... Asked by: Consider the following exact algebraic number  > restart;  > kernelopts('version'):  > Physics:-Version():  >  >  memory used=0.97MiB, alloc change=12.00KiB, cpu time=31.00ms, real time=27.00ms, gc time=0ns  (1)  >  (2)  >  memory used=70.25GiB, alloc change=48.00MiB, cpu time=23.63m, real time=21.81m, gc time=3.18m  (3)  >  (4) Download wrong_minpoly.mw I would like to find its minimal polynomial (without a priori knowledge). According to the documentation, if is an exact algebraic number, and and are not given, then PolynomialTools:-MinimalPolynomial(expr) will call to compute an exact minimal polynomial of . If a name is not specified for the variable , then will be used. Regretfully, it is easy to see that the minimal polynomial of cannot be the returned . And when I invoke directly, the result is still not correct (and this evaluation takes a rather long time). Another help page mentions that the call mp := evala(Minpoly(expr, _X)) computes the monic minimal polynomial of in the variable over the field of rational numbers (or multivariate rational functions); the resulting polynomial will not contain any algebraic numbers or functions. However, as type(mp, polynom(rational, _X)) gives , we know that cannot be the desired minimal polynomial of either. So, what is the proper way to compute the minimal polynomial of in Maple? Code: use alpha=1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345,index=2)-1/2)**2) in expr:=(1+alpha)*sqrt(1-alpha**2)+(3+4*alpha)/12*sqrt(3-4*alpha**2)+2*(1+alpha)/3*sqrt(2*(1+alpha)*(1-2*alpha))+(1+2*alpha)/6*sqrt(2*((1-alpha)**2-3*alpha**2)) end: CodeTools:-Usage(PolynomialTools:-MinimalPolynomial(expr)); Of note, the minimal polynomial of an algebraic number is the unique irreducible monic polynomial of smallest degree with rational coefficients such that and whose leading coefficient is 1 Why does simplify fail to rewrite certain sub-ex... Asked by: As the following worksheet shows,  >  > kernelopts('version');  > Physics:-Version();  > with(RealDomain):  > eval(MTM:-det(< a, b/2, d/2 | b/2, c, e/2 | d/2, e/2, f >), PDETools:-Solve(MTM:-det(< x**2 + y**2, x1**2 + y1**2, x2**2 + y2**2, x3**2 + y3**2 | x, x1, x2, x3 | y, y1, y2, y3 | 1, 1, 1, 1 >) = inner([a, b, c, d, e, f], [x**2, x*y, y**2, x, y, 1]), {f, e, d, c, b, a}, 'independentof' = {y, x}))/MTM:-det(< x1, x2, x3 | y1, y2, y3 | 1, 1, 1 >): simplify(%);  > eval(MTM:-det(< a, b/2, d/2 | b/2, c, e/2 | d/2, e/2, f >), PDETools:-Solve(MTM:-det(< x**2 - y**2, x1**2 - y1**2, x2**2 - y2**2, x3**2 - y3**2, x4**2 - y4**2 | x*y, x1*y1, x2*y2, x3*y3, x4*y4 | x, x1, x2, x3, x4 | y, y1, y2, y3, y4 | 1, 1, 1, 1, 1 >) = inner([a, b, c, d, e, f], [x**2, x*y, y**2, x, y, 1]), {f, e, d, c, b, a}, 'independentof' = {y, x}))/(MTM:-det(< x2, x3, x4 | y2, y3, y4 | 1, 1, 1 >)*MTM:-det(< x3, x4, x1 | y3, y4, y1 | 1, 1, 1 >)*MTM:-det(< x4, x1, x2 | y4, y1, y2 | 1, 1, 1 >)*MTM:-det(< x1, x2, x3 | y1, y2, y3 | 1, 1, 1 >)): simplify(%); Download Why_not_consider_subexpressions?.mw the underlined part is evidently not the simplest. (For instance, shouldn't and be converted into and ?) If I understand correctly, , by default, should try combining every part of an expression with every other to apply a vast range of potential transformations to look at many different forms of it and make progress in picking out the simplest possible one. So, why is simplify unable to touch certain sub-expressions when they are encountered at intermediate stages in a computation? Where is error in solving for constant of integrat... Asked by: Could someone be able to spot why I get different solution when solving for the constant of integration from this Maple dsolve solution manually than when asking Maple to do it directly? This is the ode ode:=x*y(x)*diff(y(x), x) = (x + 1)*(y(x) + 1); ic:=y(1) = 1;  If I ask Maple to solve it with the IC all at once, it gives solution which odetest verifies OK. If I ask Maple to solve it with no IC, then solve the constant myself and plug the constant back into the solution I get solution which does not verify any more. I am not able to find why. Could someone spot the error in this? Please see worksheet below. I suspect the problem is when plugging back the constant of integration into the general solution, but have no idea now what it is. Clearly Maple did something much smarter than what I did by just plugging the constant back into the solution. May be need to specify what branch to use when plugging the constant back? but how do I know which one?  > interface(version);  > Physics:-Version()  > ode:=x*y(x)*diff(y(x), x) = (x + 1)*(y(x) + 1); ic:=y(1) = 1; sol_no_IC:=dsolve(ode);  > sol_with_IC_direct:=dsolve([ode,ic]); odetest(sol_with_IC_direct,[ode,ic]);  > #this verifies Maple found correct constant also:  > solve(rhs(sol_with_IC_direct)=rhs(sol_no_IC),c__1)  > #now solve for constant of integration manually. This gives invalid solution. Why?  > eq:= 1=limit(rhs(sol_no_IC),x=1);  > PDEtools:-Solve(eq,c__1);  > sol_with_ic:=eval(sol_no_IC,%)  > odetest(sol_with_ic,[ode,ic]); Download why_wrong_solution.mw What is the special evaluation rules of "MVshortcu... Asked by: In my view, <x || (1 .. 2); y || (1 .. 2); 1$ 2> should return a Matrix without any error messages; however,

<x || (1 .. 2); y || (1 .. 2); 1 \$ 2>; # Arguments are shielded???
Error, (in Matrix) this entry is too wide or too narrow: 1


If I understand right, each argument of a function is evaluated in turn (unless the modifier is used).
So why is it not equivalent to <x1, x2; y1, y2; 1, 1>

Table entries with indices that have a certain pat...

I am trying to find the minimum values of a table, but not of all of its indices, just some that comply to a certain pattern.

The minimum of the values of a table are found by using min(entries(atable)).

If the indices of atable are "a1", "a2", "b1", "b2", I would like to just have the ones starting with "a".

Can be done by a loop, but is there a easier way?

Seperate Real and Imaginary...

I any trying to seperate the real and imaginary components but they are mixed up inside and outside a square root.

Their seems to be a problem displaying the worksheet.

restart

expand((a+I*b)*(a-I*b))
(a+I*b)+(a-I*b)
# z = x *Iy    I need to seperate out solution to [x,y] & [x,-y]
#https://math.stackexchange.com/questions/44391/foci-of-a-general-conic-equation
eq := T*z^2 - (R + S*I)*z +G-K + H*I
sol:=solve(eq,z)
expand(sol[1]*sol[2])=a^2+b^2
simplify(sol[1]+sol[2]=2*a)
simplify(sol[1]-sol[2]=2*b)


Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/2024-04-20_Q_Seperate_Real_&_Imaginary.mw .

why limit fails when having two limits at once but...

Is it wrong to call limit like this

limit(expr,[y = y0,x=x0]);


vs

limit(expr,y = y0);
limit(%,x=x0);


The first one gives internal Maple error.  Worksheet attached. I would have expected both to work the same.

 > interface(version);

 > Physics:-Version();

 > kernelopts('assertlevel'=2):
 > expr:=3/2*(y-1)^(2/3)-3/2*x^2-c__1 = 0; y0:=-7; x0:=3; limit(expr,[y = y0,x=x0]);

Error, (in limit/multi/ldegree1) assertion failed

 > expr:=3/2*(y-1)^(2/3)-3/2*x^2-c__1 = 0; y0:=-7; x0:=3; limit(expr,y = y0); limit(%,x=x0);

Error, (in anonymous procedure called from depends...

I still see these Maple internal errors in Maple 2024.

Now calling odetest.

The problem is that it is not possible to catch them.

Any suggestion what to do and what causes it?

 > interface(version);

 > Physics:-Version();

 > sol:=y(x) = (exp(RootOf(-sin(x)*tanh(1/2*_Z+1/2*c__1)^2+sin(x)+exp(_Z)))+sin(x))/sin(x); ode:=diff(y(x),x)-cot(x)*(y(x)^(1/2)-y(x)) = 0;

 > try    odetest(sol,ode,y(x)); catch:    print("cought error "); end try;

Error, (in anonymous procedure called from depends) too many levels of recursion

Mma to Maple of Monte Carlo Integration code...

func[x_] := 1/(1 + Sinh[2*x]*(Log[x])^2);
Int = 1/n Total[func[RV]/Distrib[RV, 1, 0.399]]*Integrate[Distrib[x, 1, 0.399], {x, 0.8, 3}]