## dharr

Dr. David Harrington

## 5804 Reputation

19 years, 241 days
University of Victoria
Professor or university staff

## Social Networks and Content at Maplesoft.com

I am a professor of chemistry at the University of Victoria, BC, Canada, where my research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

## Thanks....

@occipitalbaker Thanks.

## length or walk?...

I did something similar before here but for the case where the walk had to start and end at a particular vertex. (Perhaps that is the same problem?) There is a significant difference between just finding the length and finding the walk itself. Are you OK with just the length?

## 2nd without changing variables...

@Axel Vogt Vote up. The second one can be done without a change of variable.

 > restart;
 > i1:=(sin(x + sqrt(x)))/(1 + x); i2:=(x*BesselJ(0, x^2))/(1 + x);

 > int(i2, x = 0 .. infinity); int2:=evalf(%);

 >

## conversion...

@rockyicer You're welcome. If you want to convert the .lib file to .mla, you can use the LibraryTools:-ConvertVersion command.

## development...

Yes, development is always going on - new integration methods were added in the latest (2023) version, see

## wrong sqrt...

@mmcdara If you try Eigenvalues(SQRT),Eigenvalues(Q_L); you will see that two of the eigenvalues are negative of what they should be, i.e., the method has effectively chosen the wrong sqrt. I'm guessing that can be solved by a different starting guess, but not sure how exactly that could be done. Note that for the Eigenvalue method, you can work completely in reals (and more efficiently) by telling it C is symmetric:

LEC := proc(C)
local L, E;
L, E := LinearAlgebra:-Eigenvectors(Matrix(evalf(C),shape=symmetric)):
E . DiagonalMatrix(sqrt~(L)) . E^(-1)
end proc:

But if you use a numerical version of my routine above (with shape = symmetric) then you can avoid the numerical inverse (just a transpose now) and it might be more efficient (but the normalization will slow it down)

Msqrtf:=proc(A::Matrix(square,datatype=float))
local evs,evals,evecs,U,i,j,k,g,Lambda;
uses LinearAlgebra;
evs:=Eigenvectors(Matrix(A,shape=symmetric),output='list');
evals:=table();evecs:=table();
j:=0;
for i in evs do
if i[2] = 1 then
j:=j+1;
evals[j]:=i[1];
evecs[j]:=Normalize(i[3][],'Euclidean');
else
g:=GramSchmidt(i[3],conjugate=false,normalized=true);
for k to i[2] do
j:=j+1;
evals[j]:=i[1];
evecs[j]:=g[k];
end do;
end if;
end do;
Lambda:=DiagonalMatrix(map(sqrt,convert(evals,list)));
U:=convert(convert(evecs,list),Matrix);
U.Lambda.U^%T;
end proc:

## comment...

@sand15 Thanks - I remembered that and had a quick look for it but didn't find it. The emphasis there was on the numerical case, but here on symbolic. For symbolic use, the method here requires that the exact eigenvalues can be found. Here even though the matrices are large, the eigenvalues and eigenvectors are easily found (for M1..M3, the eigenvalues are actually integers). The method here avoids finding a matrix inverse, or more accurately the inverse is just the hermitian transpose so is easy to compute.

My recollection is that Maple's method can suceed in more cases, at the expense of being slow. The solution is presumably for MatrixPower and/or MatrixFunction to do more preselection of different algorithms depending on the matrix type.

## convert, elementary...

convert(expr,elementary) is intended to convert hypergeoms etc to elementary functions, but doesn't seem to work on these cases.

## non-isomorphic triangulations...

@lcz Isomorphic triangulations don't necessarily correspond to isomorphic binary trees, so I think a different approach is needed.

## simplifications...

@OtherAlloyMonkey I left all the equations in terms of beta, and made all the constants exact. Then it is easy to see that the 5th and 6th rows of the matrix are identical, and therefore the determinant must be zero.

Model_Derivation_3.mw

## 1-D math...

@MaPal93 b2 appears in the assignment to Var_Omega_S. I see many places your subscripts or superscripts or Greek letters are parts of atomic variables, which I suppose is OK, but not the b2. This is a very strange way to use Maple. For example the line

looks like 1-D math but has Omega in. When converted from the right-click menu 2-D math-convert to 1-D math then we get the real 1-D math Omega := subs(repl, `&Omega;inst`); If I convert that to 2-Math input I get

So you are using 2-D math and formatting it as 1-D math? I guess in that context the b2 is OK, but not sure why you would do this.

I only answered the title part of your question, and do not understand what you are trying to do, which is why I replied to rather than answered your question. Hope someone else can help you with that.

## unexpected Matrix...

Your Var_Omega_S has a (scalar) expression added to a Matrix, which doesn't make sense. This is manipulated and eventually passed to solve, which probably generates the error messages. (Also your 1-D math inputs have superscripts and subscripts, which seem strange - for example b2 instead of b^2.)

## block matrices...

@Diasaur @Pascal4QM @ecterrab I think your requirement was for block matrices, and my first attempt below was not successful, but I'm new using the Physics package so I may have missed something here. There have been requests for this capability over the years, and the Physics package is perhaps the best setting for it, but there are other ways of approaching it.

What capabilities are required? What properties should the blocks have? Some are obvious: non-commutative, (a.b)^(-1) = b^(-1).a^(-1), same with transpose, associative, etc, but do you need conformability checks, where the blocks have specific dimensions? - that would add considerable complexity.

 >
 >

Block matrices

 >

 >

 >

But in the following, a and b are commuting.

 >

 >