dharr

Dr. David Harrington

8837 Reputation

22 Badges

21 years, 122 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 retired professor of chemistry at the University of Victoria, BC, Canada. 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

@MaPal93 Some answers:

1) what is exactly Eqn? could you load my solution instead of hard coding expressions?


I definitely did not reenter this by hand! This was extracted from your worksheet by opening a new worksheet with the same Maple engine - try EqN; in your own worksheet to check.

2) is this system indeterminate (infinitely many solutions)?

Yes.

3) would it be preferred if I chose backsubstitute = true?

Probably the answer is too complicated to analyse, and maybe too slow to achieve - but you could try.

4) what happened to my parameters P := indets(MyEqs, name) minus MyVars ? I was hoping to obtain solutions as functions of those.

I just looked at what you were passing to the solver, i.e., EqN. Looks like in the line EqN := ((`~`[((numer@evala)@(:-Norm))@numer])@eval)(MyEqs, `=`~(P, 1)) you set all the parameters to 1. 

5) is this solving approach (a) reliable and (b) preferable to engine=groebner or standard solve()?

I don't see why the answer wouldn't be reliable. It worked for the case I tried at random. I don't know much about different engines; solve probably passes to one or other of these.

6) how to enforce RealDomain?

If you want only real solutions, try RealTriangularize in the RegularChains package, which was a recent suggestion somewhere here on Mapleprimes. But I really don't know much about solving polynomial equations beyond the bivariate case.

@MaPal93 Here's my understanding. You chose backsubstitute=false, so you can carry out the backsubstitution yourself, e.g.

restart

EqN := {-(2*`λ__1`^2*`λ__2`*`λ__3`+2*`λ__1`*`λ__2`^2*`λ__3`+2*`λ__1`*`λ__2`*`λ__3`^2+4*`λ__1`^2*`λ__2`+`λ__1`^2*`λ__3`+4*`λ__1`*`λ__2`^2-6*`λ__1`*`λ__2`*`λ__3`+`λ__1`*`λ__3`^2+`λ__2`^2*`λ__3`+`λ__2`*`λ__3`^2+8*`λ__1`*`λ__2`+2*`λ__1`*`λ__3`+2*`λ__2`*`λ__3`)*(4*`λ__1`^4*`λ__2`^3*`λ__3`^2+8*`λ__1`^3*`λ__2`^4*`λ__3`^2+8*`λ__1`^3*`λ__2`^3*`λ__3`^3+4*`λ__1`^2*`λ__2`^5*`λ__3`^2+8*`λ__1`^2*`λ__2`^4*`λ__3`^3+4*`λ__1`^2*`λ__2`^3*`λ__3`^4+16*`λ__1`^4*`λ__2`^3*`λ__3`+4*`λ__1`^4*`λ__2`^2*`λ__3`^2+32*`λ__1`^3*`λ__2`^4*`λ__3`-4*`λ__1`^3*`λ__2`^3*`λ__3`^2+8*`λ__1`^3*`λ__2`^2*`λ__3`^3+16*`λ__1`^2*`λ__2`^5*`λ__3`-4*`λ__1`^2*`λ__2`^4*`λ__3`^2-16*`λ__1`^2*`λ__2`^3*`λ__3`^3+4*`λ__1`^2*`λ__2`^2*`λ__3`^4+4*`λ__1`*`λ__2`^5*`λ__3`^2+8*`λ__1`*`λ__2`^4*`λ__3`^3+4*`λ__1`*`λ__2`^3*`λ__3`^4+16*`λ__1`^4*`λ__2`^3+8*`λ__1`^4*`λ__2`^2*`λ__3`+9*`λ__1`^4*`λ__2`*`λ__3`^2+32*`λ__1`^3*`λ__2`^4-8*`λ__1`^3*`λ__2`^3*`λ__3`-28*`λ__1`^3*`λ__2`^2*`λ__3`^2+18*`λ__1`^3*`λ__2`*`λ__3`^3+16*`λ__1`^2*`λ__2`^5-8*`λ__1`^2*`λ__2`^4*`λ__3`+126*`λ__1`^2*`λ__2`^3*`λ__3`^2-34*`λ__1`^2*`λ__2`^2*`λ__3`^3+9*`λ__1`^2*`λ__2`*`λ__3`^4+8*`λ__1`*`λ__2`^5*`λ__3`+4*`λ__1`*`λ__2`^4*`λ__3`^2-2*`λ__1`*`λ__2`^3*`λ__3`^3+2*`λ__1`*`λ__2`^2*`λ__3`^4+`λ__2`^5*`λ__3`^2+2*`λ__2`^4*`λ__3`^3+`λ__2`^3*`λ__3`^4+8*`λ__1`^4*`λ__2`*`λ__3`+2*`λ__1`^4*`λ__3`^2+64*`λ__1`^3*`λ__2`^3+16*`λ__1`^3*`λ__2`^2*`λ__3`+18*`λ__1`^3*`λ__2`*`λ__3`^2+4*`λ__1`^3*`λ__3`^3+64*`λ__1`^2*`λ__2`^4-88*`λ__1`^2*`λ__2`^3*`λ__3`+2*`λ__1`^2*`λ__2`^2*`λ__3`^2+12*`λ__1`^2*`λ__2`*`λ__3`^3+2*`λ__1`^2*`λ__3`^4+32*`λ__1`*`λ__2`^4*`λ__3`-10*`λ__1`*`λ__2`^3*`λ__3`^2+4*`λ__1`*`λ__2`^2*`λ__3`^3+2*`λ__1`*`λ__2`*`λ__3`^4+4*`λ__2`^4*`λ__3`^2+4*`λ__2`^3*`λ__3`^3+32*`λ__1`^3*`λ__2`*`λ__3`+8*`λ__1`^3*`λ__3`^2+64*`λ__1`^2*`λ__2`^3+4*`λ__1`^2*`λ__2`*`λ__3`^2+8*`λ__1`^2*`λ__3`^3+32*`λ__1`*`λ__2`^3*`λ__3`+8*`λ__1`*`λ__2`*`λ__3`^3+4*`λ__2`^3*`λ__3`^2+32*`λ__1`^2*`λ__2`*`λ__3`+8*`λ__1`^2*`λ__3`^2+8*`λ__1`*`λ__2`*`λ__3`^2), -(2*`λ__1`^2*`λ__2`*`λ__3`+2*`λ__1`*`λ__2`^2*`λ__3`+2*`λ__1`*`λ__2`*`λ__3`^2+4*`λ__1`^2*`λ__2`+`λ__1`^2*`λ__3`+4*`λ__1`*`λ__2`^2-6*`λ__1`*`λ__2`*`λ__3`+`λ__1`*`λ__3`^2+`λ__2`^2*`λ__3`+`λ__2`*`λ__3`^2+8*`λ__1`*`λ__2`+2*`λ__1`*`λ__3`+2*`λ__2`*`λ__3`)*(4*`λ__1`^5*`λ__2`^2*`λ__3`^2+8*`λ__1`^4*`λ__2`^3*`λ__3`^2+8*`λ__1`^4*`λ__2`^2*`λ__3`^3+4*`λ__1`^3*`λ__2`^4*`λ__3`^2+8*`λ__1`^3*`λ__2`^3*`λ__3`^3+4*`λ__1`^3*`λ__2`^2*`λ__3`^4+16*`λ__1`^5*`λ__2`^2*`λ__3`+4*`λ__1`^5*`λ__2`*`λ__3`^2+32*`λ__1`^4*`λ__2`^3*`λ__3`-4*`λ__1`^4*`λ__2`^2*`λ__3`^2+8*`λ__1`^4*`λ__2`*`λ__3`^3+16*`λ__1`^3*`λ__2`^4*`λ__3`-4*`λ__1`^3*`λ__2`^3*`λ__3`^2-16*`λ__1`^3*`λ__2`^2*`λ__3`^3+4*`λ__1`^3*`λ__2`*`λ__3`^4+4*`λ__1`^2*`λ__2`^4*`λ__3`^2+8*`λ__1`^2*`λ__2`^3*`λ__3`^3+4*`λ__1`^2*`λ__2`^2*`λ__3`^4+16*`λ__1`^5*`λ__2`^2+8*`λ__1`^5*`λ__2`*`λ__3`+`λ__1`^5*`λ__3`^2+32*`λ__1`^4*`λ__2`^3-8*`λ__1`^4*`λ__2`^2*`λ__3`+4*`λ__1`^4*`λ__2`*`λ__3`^2+2*`λ__1`^4*`λ__3`^3+16*`λ__1`^3*`λ__2`^4-8*`λ__1`^3*`λ__2`^3*`λ__3`+126*`λ__1`^3*`λ__2`^2*`λ__3`^2-2*`λ__1`^3*`λ__2`*`λ__3`^3+`λ__1`^3*`λ__3`^4+8*`λ__1`^2*`λ__2`^4*`λ__3`-28*`λ__1`^2*`λ__2`^3*`λ__3`^2-34*`λ__1`^2*`λ__2`^2*`λ__3`^3+2*`λ__1`^2*`λ__2`*`λ__3`^4+9*`λ__1`*`λ__2`^4*`λ__3`^2+18*`λ__1`*`λ__2`^3*`λ__3`^3+9*`λ__1`*`λ__2`^2*`λ__3`^4+64*`λ__1`^4*`λ__2`^2+32*`λ__1`^4*`λ__2`*`λ__3`+4*`λ__1`^4*`λ__3`^2+64*`λ__1`^3*`λ__2`^3-88*`λ__1`^3*`λ__2`^2*`λ__3`-10*`λ__1`^3*`λ__2`*`λ__3`^2+4*`λ__1`^3*`λ__3`^3+16*`λ__1`^2*`λ__2`^3*`λ__3`+2*`λ__1`^2*`λ__2`^2*`λ__3`^2+4*`λ__1`^2*`λ__2`*`λ__3`^3+8*`λ__1`*`λ__2`^4*`λ__3`+18*`λ__1`*`λ__2`^3*`λ__3`^2+12*`λ__1`*`λ__2`^2*`λ__3`^3+2*`λ__1`*`λ__2`*`λ__3`^4+2*`λ__2`^4*`λ__3`^2+4*`λ__2`^3*`λ__3`^3+2*`λ__2`^2*`λ__3`^4+64*`λ__1`^3*`λ__2`^2+32*`λ__1`^3*`λ__2`*`λ__3`+4*`λ__1`^3*`λ__3`^2+32*`λ__1`*`λ__2`^3*`λ__3`+4*`λ__1`*`λ__2`^2*`λ__3`^2+8*`λ__1`*`λ__2`*`λ__3`^3+8*`λ__2`^3*`λ__3`^2+8*`λ__2`^2*`λ__3`^3+32*`λ__1`*`λ__2`^2*`λ__3`+8*`λ__1`*`λ__2`*`λ__3`^2+8*`λ__2`^2*`λ__3`^2), -(2*`λ__1`^2*`λ__2`*`λ__3`+2*`λ__1`*`λ__2`^2*`λ__3`+2*`λ__1`*`λ__2`*`λ__3`^2+4*`λ__1`^2*`λ__2`+`λ__1`^2*`λ__3`+4*`λ__1`*`λ__2`^2-6*`λ__1`*`λ__2`*`λ__3`+`λ__1`*`λ__3`^2+`λ__2`^2*`λ__3`+`λ__2`*`λ__3`^2+8*`λ__1`*`λ__2`+2*`λ__1`*`λ__3`+2*`λ__2`*`λ__3`)*(4*`λ__1`^4*`λ__2`^2*`λ__3`^3+8*`λ__1`^3*`λ__2`^3*`λ__3`^3+8*`λ__1`^3*`λ__2`^2*`λ__3`^4+4*`λ__1`^2*`λ__2`^4*`λ__3`^3+8*`λ__1`^2*`λ__2`^3*`λ__3`^4+4*`λ__1`^2*`λ__2`^2*`λ__3`^5+16*`λ__1`^4*`λ__2`^2*`λ__3`^2+4*`λ__1`^4*`λ__2`*`λ__3`^3+32*`λ__1`^3*`λ__2`^3*`λ__3`^2-4*`λ__1`^3*`λ__2`^2*`λ__3`^3+8*`λ__1`^3*`λ__2`*`λ__3`^4+16*`λ__1`^2*`λ__2`^4*`λ__3`^2-4*`λ__1`^2*`λ__2`^3*`λ__3`^3-16*`λ__1`^2*`λ__2`^2*`λ__3`^4+4*`λ__1`^2*`λ__2`*`λ__3`^5+4*`λ__1`*`λ__2`^4*`λ__3`^3+8*`λ__1`*`λ__2`^3*`λ__3`^4+4*`λ__1`*`λ__2`^2*`λ__3`^5+48*`λ__1`^4*`λ__2`^2*`λ__3`+8*`λ__1`^4*`λ__2`*`λ__3`^2+`λ__1`^4*`λ__3`^3+96*`λ__1`^3*`λ__2`^3*`λ__3`-40*`λ__1`^3*`λ__2`^2*`λ__3`^2+4*`λ__1`^3*`λ__2`*`λ__3`^3+2*`λ__1`^3*`λ__3`^4+48*`λ__1`^2*`λ__2`^4*`λ__3`-40*`λ__1`^2*`λ__2`^3*`λ__3`^2+102*`λ__1`^2*`λ__2`^2*`λ__3`^3-2*`λ__1`^2*`λ__2`*`λ__3`^4+`λ__1`^2*`λ__3`^5+8*`λ__1`*`λ__2`^4*`λ__3`^2+4*`λ__1`*`λ__2`^3*`λ__3`^3-2*`λ__1`*`λ__2`^2*`λ__3`^4+2*`λ__1`*`λ__2`*`λ__3`^5+`λ__2`^4*`λ__3`^3+2*`λ__2`^3*`λ__3`^4+`λ__2`^2*`λ__3`^5+32*`λ__1`^4*`λ__2`^2+8*`λ__1`^4*`λ__2`*`λ__3`+64*`λ__1`^3*`λ__2`^3+88*`λ__1`^3*`λ__2`^2*`λ__3`+32*`λ__1`^3*`λ__2`*`λ__3`^2+4*`λ__1`^3*`λ__3`^3+32*`λ__1`^2*`λ__2`^4+88*`λ__1`^2*`λ__2`^3*`λ__3`-32*`λ__1`^2*`λ__2`^2*`λ__3`^2-12*`λ__1`^2*`λ__2`*`λ__3`^3+4*`λ__1`^2*`λ__3`^4+8*`λ__1`*`λ__2`^4*`λ__3`+32*`λ__1`*`λ__2`^3*`λ__3`^2-12*`λ__1`*`λ__2`^2*`λ__3`^3+8*`λ__1`*`λ__2`*`λ__3`^4+4*`λ__2`^3*`λ__3`^3+4*`λ__2`^2*`λ__3`^4+128*`λ__1`^3*`λ__2`^2+32*`λ__1`^3*`λ__2`*`λ__3`+128*`λ__1`^2*`λ__2`^3+32*`λ__1`^2*`λ__2`*`λ__3`^2+4*`λ__1`^2*`λ__3`^3+32*`λ__1`*`λ__2`^3*`λ__3`+32*`λ__1`*`λ__2`^2*`λ__3`^2+8*`λ__1`*`λ__2`*`λ__3`^3+4*`λ__2`^2*`λ__3`^3+128*`λ__1`^2*`λ__2`^2+32*`λ__1`^2*`λ__2`*`λ__3`+32*`λ__1`*`λ__2`^2*`λ__3`)}

Check out first solution, solve order lambda__3 > lambda__2 > lambda__1

sol1 := [[((2*`&lambda;__1`+1)*`&lambda;__2`+`&lambda;__1`)*`&lambda;__3`^2+((2*`&lambda;__1`+1)*`&lambda;__2`^2+(2*`&lambda;__1`^2-6*`&lambda;__1`+2)*`&lambda;__2`+`&lambda;__1`^2+2*`&lambda;__1`)*`&lambda;__3`+4*`&lambda;__2`^2*`&lambda;__1`+(4*`&lambda;__1`^2+8*`&lambda;__1`)*`&lambda;__2`], {(2*`&lambda;__1`+1)*`&lambda;__2`+`&lambda;__1` <> 0}]

[[((2*lambda__1+1)*lambda__2+lambda__1)*lambda__3^2+((2*lambda__1+1)*lambda__2^2+(2*lambda__1^2-6*lambda__1+2)*lambda__2+lambda__1^2+2*lambda__1)*lambda__3+4*lambda__1*lambda__2^2+(4*lambda__1^2+8*lambda__1)*lambda__2], {(2*lambda__1+1)*lambda__2+lambda__1 <> 0}]

Choose any lambda__1

sol := {`&lambda;__1` = 4}

{lambda__1 = 4}

Lambda_2 is now found from {(2*`&lambda;__1`+1)*`&lambda;__2`+`&lambda;__1` <> 0}

{(2*lambda__1+1)*lambda__2+lambda__1 <> 0}

solve(eval({(2*`&lambda;__1`+1)*`&lambda;__2`+`&lambda;__1` = 0}, sol), `&lambda;__2`)

{lambda__2 = -4/9}

So any value except the above, e.g.,

sol := `union`(sol, {`&lambda;__2` = 2})

{lambda__1 = 4, lambda__2 = 2}

So lambda__3 now found from

sol1[1][]; eval(%, sol); solve(%, `&lambda;__3`); sol := `union`(sol, {`&lambda;__3` = %[1]})

((2*lambda__1+1)*lambda__2+lambda__1)*lambda__3^2+((2*lambda__1+1)*lambda__2^2+(2*lambda__1^2-6*lambda__1+2)*lambda__2+lambda__1^2+2*lambda__1)*lambda__3+4*lambda__1*lambda__2^2+(4*lambda__1^2+8*lambda__1)*lambda__2

22*lambda__3^2+80*lambda__3+256

-20/11+((12/11)*I)*7^(1/2), -20/11-((12/11)*I)*7^(1/2)

{lambda__1 = 4, lambda__2 = 2, lambda__3 = -20/11+((12/11)*I)*7^(1/2)}

Check

simplify(eval(EqN, sol))

{0}

NULL

Download EqNsol.mw

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

restart;

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

sin(x+x^(1/2))/(1+x)

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

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

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

.3233985132

 

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

https://www.maplesoft.com/support/help/Maple/view.aspx?path=updates%2fMaple2023%2fAdvancedMath

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

 

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

Model_Derivation_3.mw

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

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)

false

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.

A.B

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

NULL

Download BlockMatrix.mw

First 53 54 55 56 57 58 59 Last Page 55 of 95