4121 Reputation

17 Badges

8 years, 64 days

MaplePrimes Activity

These are questions asked by nm

For entering system of linear ode's, from textbook, such as this example

I can either use x[1],x[2]  or x__1 and x__2.

Maple dsolve works with both. The Latex generated is also exactly the same Which is x_{1} and x_{2}.

The only minor difference I see is on the screen in the worksheet (I only use 1D), where the subscript looks a little nicer in the case of x[1] vs. x__1

The subscript in the case of x[1] is upright while the one in x__1 is italic. I like the first one more.

Other than this cosmetic difference, Are there are subtle sematic differences between the two forms in terms of computation? I know x[1] create table x. OK.  While x__1 is a separate symbol. No table is created.,

Which would be  a safer/better option to use in this case?   Or is it just a matter of choice?

sys:=[ diff(x[1](t),t)=x[1](t)+x[2](t),diff(x[2](t),t)=x[1](t)+3*x[2](t)];
sys:=[ diff(x__1(t),t)=x__1(t)+x__2(t),diff(x__2(t),t)=x__1(t)+3*x__2(t)];

In some way, using x__1(t) might be a little easier to read on the eye than x[1](t) since there is only one type of paranthesis involved.

ps. I tried to search for __ in Maple help to read more about it, but ?__ do not show it. I am sure __ is in the help under some other name.

For display only purposes, to get the Latex looking better, I replace the constant of integrations Maple using which is _C1, _C2., etc... to c[1],c[2],..... 

This is something I do at the very end of computation, just before I get the Latex of the expression.

The way I do this now, is not good. .And I am asking if there is a better way to do this replacement. In Mathematica, I can do this using a patterm where I tell it to replace  C?  by c[?] where ? means anything.

Is it possible to do something like this in Maple? Here is an example

sol:=dsolve(diff(x(t),t$3) = x(t));

This gives solution as

And just before ask for the Latex of this, I change it to 

This is done using a function. Please see worksheet below.

The problem with the current solution is that I do not know how many _C there are, so I assumed 10 as worst case, which works for my case. But I prefer a more general solution, may be using pattern in the subs command?



local n,N,c;
local new_expr;
local max_count :=10; #worst case, since do not know how many

    for n from 1 to max_count do
        new_expr:=subs( :-parse(cat("_C",N))=:-parse(cat("c[",N,"]")),new_expr);
    return new_expr;
end proc:

sol:=dsolve(diff(x(t),t$3) = x(t));

x(t) = _C1*exp(t)+_C2*exp(-(1/2)*t)*sin((1/2)*3^(1/2)*t)+_C3*exp(-(1/2)*t)*cos((1/2)*3^(1/2)*t)

x(t) = c[1]*exp(t)+c[2]*exp(-(1/2)*t)*sin((1/2)*3^(1/2)*t)+c[3]*exp(-(1/2)*t)*cos((1/2)*3^(1/2)*t)



Download q.mw

And now I get the latex of tmp in the above, instead of sol which looks better.



When a real matrix have repeated eigenvalue (i.e. multiplicity >1) and the matrix is not the identity matrix, then it is called defective eigenvalue. 

For example if the eigenvalue is repeated 2 times, there will be only one eigevector associated with it.

There is an algorithm to generate another (linearly independent) eigenvector from this same eigenvalue called the defective eigenvalue method.

My question is: Does Maple have support for finding such additional eigenvectors?  The standard Eigenvectors does not seem to do this. Here is an example.

A :=Matrix([[1,-2],[2,5]]);
(eigen_values, eigen_vectors) := LinearAlgebra:-Eigenvectors(A);

By hand, using the defective eigenvalue method it is possible find second eigenvector for this eigenvalue, which is linearly independent of the one returned by Maple. Such as 

The method to find these additional eigenvector is described in number of places such as 


And the pdf at the bottom show a more detailed example.

I can code this method by hand to find complete set of L.I. eigenvectors for this defective eigenvalue.  

But before doing that, I thought to ask if Maple have buildin support for this, such as a single command to do this or some package.

I looked at help for LinearAlgebra and I am still not able to see anything, It only says this:

With an eigenvalue of multiplicity  k>1 , there may be fewer than  k linearly independent eigenvectors. In this case, the matrix is called defective.  By design, the returned matrix always has full column dimension.  Therefore, in the defective case, some of the columns that are returned are zero.  Thus, they are not eigenvectors.  With the option, output=list, only eigenvectors are returned.  For more information, see LinearAlgebra[JordanForm] and LinearAlgebra[SchurForm].

This PDF also describes using Maple, how to do it for one example


This PDF also describes how to do it by hand without using Maple, starting at end of page 3


It is not too hard to code this method in Maple. But if Maple allready can do it, using some command, it will be better ofcourse.


Using latest Physics, I found case where it is not giving the Latex.

Please see attached worksheet.  This is on windows 10, Maple 2020.1.1




`Standard Worksheet Interface, Maple 2020.1, Windows 10, July 30 2020 Build ID 1482634`


`The "Physics Updates" version in the MapleCloud is 804 and is the same as the version installed in this computer, created 2020, September 7, 12:31 hours Pacific Time.`

ode:=diff(y(t),t) = -2*arctan(y(t))/(1+y(t)^2);

diff(y(t), t) = -2*arctan(y(t))/(1+y(t)^2)


t+Intat((1/2)*(_a^2+1)/arctan(_a), _a = y(t))+_C1 = 0


Error, (in unknown) invalid range for string subscript


t+\int ^{y \left( t \right) }\!{\frac {{{\it \_a}}^{2}+1}{2\,\arctan
 \left( {\it \_a} \right) }}{d{\it \_a}}+{\it \_C1}=0


By trial and error, I found that the error was introduced in Physics 797. Since in Physics 796 it did work.

Here is screen shot

Download latex_issue_11.mw

When I give symgen a HINT, using functional form f(x),g(x)*y it does not generate the infinitesimals of the Lie group for this ODE.

But from the answer given using way=abaco1 it is clear they have this form, where f(x)=-1/x and g(x)=1/x^2

From help, it says

HINT=[e1,e2], indicates to the solver that it should take e1 and e2 as the infinitesimals, where e1 and e2 can contain a maximum of two indeterminate functions. The solver tries to determine the infinitesimals to solve the problem.

And I am using only two indeterminate functions. These are f(x) and g(x)

Am I making a mistake somewhere? Please see worksheet below.




`Standard Worksheet Interface, Maple 2020.1, Windows 10, July 30 2020 Build ID 1482634`


`The "Physics Updates" version in the MapleCloud is 801 and is the same as the version installed in this computer, created 2020, September 7, 14:32 hours Pacific Time.`

#why this below do not give result?

diff(y(x), x) = (1-y(x)^2)/(x*y(x))+1


[_xi = -1/x, _eta = y/x^2]

#it works for this though. May be the two functions
#can  not be both functions of x at same time?
#one function must be function of x and the other of y?
#But help does not say that.

ode :=diff(y(x),x)=(x+cos(exp(-x)*(1+x)+exp(y(x))))/(exp(x+y(x)));

diff(y(x), x) = (x+cos(exp(-x)*(1+x)+exp(y(x))))/exp(x+y(x))

[_xi = exp(x), _eta = x*exp(-y)]



Download symgen_issue_2.mw

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