Dr. David Harrington

5804 Reputation

21 Badges

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

Social Networks and Content at Maplesoft.com

Maple Application Center
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.

MaplePrimes Activity

These are replies submitted by dharr

@occipitalbaker Thanks.

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?

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


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


x*BesselJ(0, x^2)/(1+x)

int(i2, x = 0 .. infinity);

(1/4)*MeijerG([[1/4, 3/4, 1], []], [[1, 3/4, 1/2, 1/2, 1/4], []], 1/4)/Pi^3



Download int.mw

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

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


@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)

  local evs,evals,evecs,U,i,j,k,g,Lambda;
  uses LinearAlgebra;
  for i in evs do
    if i[2] = 1 then
      for k to i[2] do
      end do;
    end if;
  end do;
end proc:


@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(expr,elementary) is intended to convert hypergeoms etc to elementary functions, but doesn't seem to work on these cases. 

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

@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.


@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, `Ω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.

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.)

@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.

restart; with(Physics)

Setup(quantumoperators = {A, B, a, b, c, d})

[quantumoperators = {A, B, a, b, c, d}]

Block matrices

A := matrix(2, 2, [[a, b], [c, d]]); B := matrix(2, 2, [[b, b], [-a, a]])

A := Matrix(2, 2, {(1, 1) = a, (1, 2) = b, (2, 1) = c, (2, 2) = d})

array( 1 .. 2, 1 .. 2, [( 1, 2 ) = (b), ( 2, 2 ) = (a), ( 2, 1 ) = (-a), ( 1, 1 ) = (b)  ] )

Library:-Commute(a, b)


a.b-b.a; a.b+b.a

Physics:-`*`(a, b)-Physics:-`*`(b, a)

Physics:-`*`(a, b)+Physics:-`*`(b, a)

But in the following, a and b are commuting.


array( 1 .. 2, 1 .. 2, [( 1, 2 ) = (2*a*b), ( 2, 2 ) = (a*d+b*c), ( 2, 1 ) = (-a*d+b*c), ( 1, 1 ) = (0)  ] )


Download BlockMatrix.mw

See https://www.mapleprimes.com/questions/229829-How-I-Can-Download-The-ONEOptimal-Package

(and there are also other Mapleprimes responses if you put ONEOptimal in the MaplePrimes search box).

@zenterix My reply was in response to @PeterTang's, question, which seems to be simpler and not involve .mpl files.

First 18 19 20 21 22 23 24 Last Page 20 of 59