ecterrab

14727 Reputation

24 Badges

20 years, 330 days

MaplePrimes Activity


These are replies submitted by ecterrab

@mistel 

My comments appear below in italic while your original text is non-italic. I also transformed your Maple "document" into a Maple "worksheet", really easier to edit and work with. You can always set "worksheet" as your default mode in the Maple preferences.

 

Below, any few changes to your input lines are mentioned explicitly. As usual to reproduce the input/output you see please verify that you have installed the latest Maplesoft Physics Updates, version 268 or higher.

 

Physics:-Version()[2]

`2018, December 27, 10:45 hours, version in the MapleCloud: 268, version installed in this computer: 268`

(1)

with(Physics)

 

If H is an operator that acts on the same space as C, then indicate that from the beginning. I am then including H in hilbertspaces in your input:

Setup(redo, hermitianoperators = {H}, hilbertspaces = {{A, C, H}, {B, C, H}}, quantumbasisdimension = {A = 1 .. Na, B = 1 .. Nb, C[1] = 1 .. Na, C[2] = 1 .. Nb}, quantumdiscretebasis = {A, B, C}, bracketrules = {%Bracket(Bra(A, i), Ket(C, j, k)) = delta[i, j]*Ket(B, k), %Bracket(Bra(B, i), Ket(C, j, k)) = delta[i, k]*Ket(A, j), %Bracket(Bra(C, i, j), H, Ket(C, k, l)) = H[i, j, k, l]})

[bracketrules = {%Bracket(%Bra(A, i), %Ket(C, j, k)) = Physics:-KroneckerDelta[i, j]*Physics:-Ket(B, k), %Bracket(%Bra(B, i), %Ket(C, j, k)) = Physics:-KroneckerDelta[i, k]*Physics:-Ket(A, j), %Bracket(%Bra(C, i, j), H, %Ket(C, k, l)) = H[i, j, k, l]}, disjointedspaces = {{A, C, H}, {B, C, H}}, hermitianoperators = {H}, quantumbasisdimension = {A = 1 .. Na, B = 1 .. Nb, C[1] = 1 .. Na, C[2] = 1 .. Nb}, quantumdiscretebasis = {A, B, C}]

(2)

Ket(C, k, l) = Ket(A, k).Ket(B, l)

Physics:-Ket(C, k, l) = Physics:-`*`(Physics:-Ket(A, k), Physics:-Ket(B, l))

(3)

Bra(C, i, j) = Bra(A, i).Bra(B, j)

Physics:-Bra(C, i, j) = Physics:-`*`(Physics:-Bra(A, i), Physics:-Bra(B, j))

(4)

This works

Bra(C, i, j).H.Ket(C, k, l)

H[i, j, k, l]

(5)

Bra(A, i).Bra(B, j).Ket(A, k).Ket(B, l)

Physics:-KroneckerDelta[i, k]*Physics:-KroneckerDelta[j, l]

(6)

This does not work``

Bra(A, i).Bra(B, j).H.Ket(A, k).Ket(B, l)

Physics:-`*`(Physics:-Bra(A, i), Physics:-Bracket(Physics:-Bra(B, j), H, Physics:-Ket(A, k)), Physics:-Ket(B, l))

(7)

Bracket(Bra(A, i).Bra(B, j), H, Ket(A, k).Ket(B, l))

Physics:-`*`(Physics:-Bra(A, i), Physics:-Bra(B, j), Physics:-`.`(H, Physics:-Ket(A, k)), Physics:-Ket(B, l))

(8)

What I want

Bra(A, i)*Bra(B, j)*H*Ket(A, k)*Ket(B, l) = Bra(C, i, j)*H*Ket(C, k, l)

Physics:-`*`(Physics:-Bra(A, i), Physics:-Bra(B, j), H, Physics:-Ket(A, k), Physics:-Ket(B, l)) = Physics:-`*`(Physics:-Bra(C, i, j), H, Physics:-Ket(C, k, l))

(9)

Bra(C, i, j)*H*Ket(C, k, l) = Bra(C, i, j).H.Ket(C, k, l)

Physics:-`*`(Physics:-Bra(C, i, j), H, Physics:-Ket(C, k, l)) = H[i, j, k, l]

(10)


I see. You have a couple of issues here:

 

1. 

The right-hand side of (10) is an operator while, normally, it would be a real scalar. Solution: you can always substitute H by some scalar, say H at the end.

2. 

Since Hbelongs to a tensor product of spaces, it can be an entangled operator, i.e. one that you cannot represent as a product of "A[i]  times B[j]" , so how would you represent, for example Bra(B, j)*H*Ket(A, k)? That is relevant since you want to compute `⊗`(Bra(A, i), Bra(B, j))*H*`⊗`(Ket(A, k), Ket(B, l)) and if you intend to do that all with algebra rules you need a computational representation for Bra(B, j)*H*Ket(A, k)that is not just itself.

 

Because of 2. I don't think what you want is possible by only using algebra rules in some natural way. The best approach in a case like this one is to take advantage of the possibility of defining the action of a quantum operator over a Ket. I.e.define Has a procedure.

 

Basically, what you want is:
 

"if H is applied to a Ket then

    if H itself is indexed then
        return H accumulating its indices, followed by the index of the Ket
    else

        return H indexed by the index of the Ket;
otherwise
    return the dot product operation uncomputed, unevaluated

"

 

In Maple language that is written as

 

 
"H := K ->   if K::Ket then      if procname::'indexed' then         H[op(procname), op(2, K)]     else          H[op(2, K)]     fi  else      'H . K'  fi:"

 

Let's see this definition  in action. Start by erasing all Physics performance remember tables, that remember results like (7) computed before the definition of H

Library:-Forget()

 

Then you have

H.Ket(A, k)

H[k]

(11)

Bra(B, j).H

H[j]

(12)

Bra(B, j).H.Ket(A, k)

H[j, k]

(13)

and this is already what you wanted to compute:

Bra(A, i).Bra(B, j).H.Ket(A, k).Ket(B, l)

H[i, j, k, l]

(14)

Bracket(Bra(A, i).Bra(B, j), H, Ket(A, k).Ket(B, l))

H[i, j, k, l]

(15)

``


 

Download algebra_rules_(reviewed_II).mw

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

@Rouben Rostamian  

It was a genuine question, I do not use rhetorical flourish or irony - I don't believe in that as valuable communication tools, I think rather the opposite. My question was targeting the kind of answer you gave, to improve the paragraphs of this help page. I will make explicit that "all differentiation variables" refer to differentiation variables in general, also for functions that were not declared, and that by differentiation variables I mean their display in derivatives, ie. that all derivatives are displayed indexed after you turn this ON.

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

@tomleslie 

Yes, this was a typo in the Example 8 of the previous post on PDE & BC. It was, however, a fortunate typo :) Example 8, after correcting the typo, is also solvable, and the no solution you observed actually pointed to a place in the new routines where an extra tweak was necessary. Example 8 (without the typo) is now solvable after installing the Maplesoft Physics Updates version 266 or higher.

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

@Preben Alsholm 

Your observations make sense to me. Here is some info regarding Physics:-Version() that may help to determine what is going on with nm's Maple installation. The output of Physics:-Version() is as follows:

  • The MapleCloud version reported is the one reported by PackageTools:-GetProperty(5137472255164416, "X-CloudVersion")
  • The library reported, from where Physics is being loaded, is the first library in the list returned by LibraryTools:-FindLibrary('Physics')
  • The timestamp is the one returned by LibraryTools:-Timestamp(P)[1]
  • The version reported as "installed in your computer" is the one returned by PackageTools:-IsPackageInstalled("Physics Updates", ':-output = :-version')

From what you say, somehow, PackageTools:-IsPackageInstalled("Physics Updates", ':-output = :-version') is telling that version 264 is there. So it found Physics Updates (the whole or portions of it) in the toolbox\2018 directory. I would remove everything below toolsbox\2018, entirely, then check what is being reported. Likewise, if I were to re-install Maple, I would first uninstall Maple, using its unistaller, then remove, manually, all the Maple directory, using the File Manager, then re-install it.

Finally, suppose you have Maple working fine again. If the problem in your computer happens only when you use PackageTools:-Install, I can't imagine what could that be (support@maplesoft.com can) but I can suggest a workaround. In your maple.ini (in mac it is called .mapleinit) you can set the value of libname. Set it as in

libname := "the directory you prefer", libname:
 
Then, libraries (.mla or .maple) found in "the directory you prefer" will be scanned before those found in the (default directories of) libname. All this is explained in ?libname. Then download any package (not using PackageTools:-Install, just downloading them), and place the downloaded .maple file in "the directory you prefer". Then open Maple and everything found in "the directory you prefer" will be loaded from there instead of from the default directories of libname. That is a way to install the package manually, without using PackageTools:-Install. The drawback of this approach is that you need to manually install/uninstall every time, 

BTW another question: what is the value of libname for you? It should contain the toolbox directory.

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

@nm 

You mentioned many things. Let me see if I can help you with this not-understood problem you are having.

  • Physics:-Version tells you mainly three things: the directory from where Physics is being loaded (it could be present in many places but it is always loaded only from one place), the version in the MapleCloud and the version installed in your computer.
  • Physics comes with Maple, installed within the Maple library (for Maple 2018.2, that is updates.mla).  The "Physics Updates" library, however, is always found in ".../maple/toolbox/2018/Physics Updates", where "..." represents your particular configuration. From what you posted, apparently, "..." is "C:\Users\me"
  • There is no relevance in whether you use \ or /, the Maple system handle both path separators in equal footing.
  • After you Package:-Install or PackageUninstall something, you always need to restart (in your worksheet and cmaple session, apparently, you didn't restart).
  • You can also install the package manually:
    • Open your File Manager, go to C:\Users\me\maple\toolbox\2018, and delete the Physics Updates directory.
    • Go the Maplesoft R&D Physics webpage and download the "Physics Updates" package (apparently, you already have it downloaded)
    • Open cmaple and enter PackageTools:-Install("the full path of the file Physics+Updates.mla"). In my case, that reads PackageTools:-Install("/Users/ecterrab/Downloads/Physics+Updates.maple"); the package installs fine. Or otherwise there is a permission problem (more at the end)
    • Open the worksheet I posted in this thread, Update_v.264.mw, and execute it: the two PDE problems should get solved.

Now, independent of resolving the problem manually, from all the information you gave, I'd imagine there is indeed a problem in your computer regarding permissions, The error in cmaple you show is "permission denied when trying to copy to C:\Users\me\maple\toolbox/2018/Physics Updates/lib/UpdatesPhysics2018.help". I use Macintosh but note that other people using windows (e.g. tomleslie) are not having this permission problem. There is for sure a way to adjust the rights so that you, as an administrator of your computer, can allow Maple to copy a file from one place to another.

Hope this time it fixes the problem ... Best

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft.

@nm

I already uploaded v.264, then installed it in my copy of Maple, it worked fine. Version 264 has several refinements that make the code find a solution for some more difficult examples. These are two of them:
 

Articolo's textbook example 7.9.1

pde[1] := diff(u(r, theta, t), t, t) = (diff(u(r, theta, t), r)+r*(diff(u(r, theta, t), r, r))+(diff(u(r, theta, t), theta, theta))/r)/(4*r)

iv[1] := u(1, theta, t) = 0, u(r, 0, t) = 0, u(r, (1/2)*Pi, t) = 0, u(r, theta, 0) = (-r^4+r^2)*sin(2*theta), (D[3](u))(r, theta, 0) = 0

pdsolve([pde[1], iv[1]])

u(r, theta, t) = `casesplit/ans`(Sum(-(1/6)*sin(2*theta)*(BesselJ(0, lambda[n]*r)*lambda[n]*r-2*BesselJ(1, lambda[n]*r))*cos((1/2)*lambda[n]*t)*hypergeom([], [5], -(1/4)*lambda[n]^2)/((hypergeom([2, 5/2], [3, 3, 4], -lambda[n]^2)*lambda[n]-hypergeom([3/2, 2, 2], [1, 3, 3, 3], -lambda[n]^2)*lambda[n])*r), n = 1 .. infinity), {And(lambda[n] = BesselJZeros(2, n), 0 <= lambda[n])})

(1)


Articolo's Exercise 7.15, with 6 BC/IV, two for each variable

pde[2] := diff(u(x, y, t), t, t) = 1/4*(diff(u(x, y, t), x, x)+diff(u(x, y, t), y, y))-(1/10)*(diff(u(x, y, t), t))

iv[2] := (D[1](u))(0, y, t) = 0, (D[1](u))(1, y, t)+u(1, y, t) = 0, (D[2](u))(x, 0, t)-u(x, 0, t) = 0, (D[2](u))(x, 1, t) = 0, u(x, y, 0) = (1-(1/3)*x^2)*(1-(1/3)*(y-1)^2), (D[3](u))(x, y, 0) = 0

 

This problem is tricky ... There are three independent variables, therefore two eigenvalues (constants that appear separating variables by product) in the Sturm-Liouville problem. But after solving the separated system and also for the eigenvalues, the second eigenvalue is equal to the first one, and in addition cannot be expressed in terms of known functions, because the equation it solves cannot be inverted.

 

The solution to the problem is now computable in v.264

 

pdsolve([pde[2], iv[2]])

u(x, y, t) = `casesplit/ans`(Sum((1/6)*(exp((1/10)*t*(-200*lambda[n]^2+1)^(1/2))*(-200*lambda[n]^2+1)^(1/2)+exp((1/10)*t*(-200*lambda[n]^2+1)^(1/2))+(-200*lambda[n]^2+1)^(1/2)-1)*(cos(lambda[n]*y)*lambda[n]+sin(lambda[n]*y))*exp(-(1/20)*t*((-200*lambda[n]^2+1)^(1/2)+1))*(6*lambda[n]^2*cos(lambda[n])^2+cos(lambda[n])^2-5*lambda[n]^2-1)*cos(lambda[n]*x)*(lambda[n]^2*sin(lambda[n])-lambda[n]*cos(lambda[n])+sin(lambda[n]))/((-200*lambda[n]^2+1)^(1/2)*(-cos(lambda[n])^4+(sin(lambda[n])*lambda[n]-1)*cos(lambda[n])^3+(lambda[n]^2+sin(lambda[n])*lambda[n]+1)*cos(lambda[n])^2+(lambda[n]^2+2*sin(lambda[n])*lambda[n]+1)*cos(lambda[n])+lambda[n]*(lambda[n]+sin(lambda[n])))*(cos(lambda[n])-1)*lambda[n]^4), n = 0 .. infinity), {And(tan(lambda[n])*lambda[n]-1 = 0, 0 <= lambda[n])})

(2)

``


 

Download Update_v.264.mw

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions.

@Preben Alsholm 

You missed solve's option 'allsolutions' (one could argue it should be used by default, that is another story). With it, you have:

@Preben Alsholm 

I saw this comment by you only today. The distrubuted Maplesoft Physics Updates got updated with the _libraryversion number of Maple 2018.2.1 a week or so ago. Since then, the Warning message you saw is not displayed.

In regards to your comment, there is the "why" and the "what message".

The "why": as you know the Maplesoft Physics Updates pack not just updates to Physics but also to the Differential Equations and Mathematical Functions code, and bug fixes not in those three areas but necessary for them to work properly, some of these mentioned in previous Mapleprimes posts.

Now, Maple is a very interconnected set of software routines. If you use an adjustment in the code written for Maple 2018.2 with a different library, e.g. 2018.1, or the other way around, I cannot assure you that all the things will work as intended. That is the "why" of the message, that includes a sentence (not shown in your comment) that indicates from where you can download an update for the version of Maple you have.

I imagine you know the "why" above but didn't find the message appropriate anyway, So, what message would you find more appropriate for this situation?

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

@John Fredsted 

The current Maplesoft Physics Updates will not work well in previous Maple releases. Many of its features depend on things that only exist in Maple 2018, and several fixes only work as expected with the library of Maple 2018. I'd suggest you to install the latest Maplesoft Physics Updates for Maple 2017, but it does not include the change I did yesterday regarding this issue you mentioned.

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

@lucenalex 

I'm a bit overloaded today and tomorrow but will try to find time to show how to formulate the problem - hopefully before a couple of days from today.

Best

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

@Sofi 

The Maplesoft Physics Updates with code for solving the PDE & BC you posted only works for Maple 2018. Regarding the math (your other question), give a look at  this other Mapleprimes post where it is all explained.

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

@Mariusz Iwaniuk 

Note that the solution you posted, using new routines described in this other Mapleprimes post, actually shows two equations for lambda[n], one of which is sort of redundant (due to an intermediate call to simplify that split the single equation into two). This is adjusted in version 200 or higher of the Maplesoft Physics Updates, so that now the output has one single equation defining lambda[n].

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

@Rouben Rostamian

 

Just trying your worksheet today (version 195 of the Updates). I see that the other two issues you mentioned are also resolved.

pde := diff(u(x, y), x, x)+diff(u(x, y), y, y) = 0

bc1 := u(0, y) = 0, u(Pi, y) = 0, u(x, 0) = 0, u(x, Pi) = 0

 

Check the method that resolves the problem

infolevel[pdsolve] := 2

2

(1)

pdsolve({bc1, pde})

* trying method "_Fn" for 2nd order PDEs
   -> trying "linear_in_xt"
   -> trying "BC_equal_0"
* trying method "_Cn_cn" for 2nd order PDEs
   -> trying _Cn_cn
* trying method "Wave" for 2nd order PDEs
   -> trying "Cauchy"
   -> trying "SemiInfiniteDomain"
   -> trying "WithSourceTerm"
* trying method "Heat" for 2nd order PDEs
   -> trying "SemiInfiniteDomain"
   -> trying "WithSourceTerm"
* trying method "Series" for 2nd order PDEs
   -> trying "ThreeBCsincos"
   -> trying "FourBC"

   -> trying "ThreeBC"
   -> trying "ThreeBCPeriodic"
   -> trying "WithSourceTerm"
   -> trying "ThreeVars"
* trying method "Laplace" for 2nd order PDEs
   -> trying a Laplace transformation
* trying method "Fourier" for 2nd order PDEs
   -> trying a fourier transformation

   <- fourier transformation successful
<- method "Fourier" for 2nd order PDEs successful

 

u(x, y) = 0

(2)

By the way note (not documente yet) that since some versions of the Updates you can specify the method

pdsolve({bc1, pde}, method = Fourier)

* trying method "Fourier" for 2nd order PDEs
   -> trying a fourier transformation
   <- fourier transformation successful
<- method "Fourier" for 2nd order PDEs successful

 

u(x, y) = 0

(3)

On the methods:

indices(`pdsolve/BC/methods`)

[1], [2], [2, "Series"], [3], ["high_order"], [2, "_Fn"], [2, "Wave"], ["system"], [2, "Heat"]

(4)

These typically have submethods that in turn may more of that. For example

`pdsolve/BC/methods`[2]

["_Fn", "_Cn_cn", "Wave", "Heat", "Series", "Laplace", "Fourier", "Generic", "PolynomialSolutions", "Linear_diff_op"]

(5)

If the optional argument (method or methods) is a list, then only those methods and in the order you specify will be tried.

 

Some of the names you see today in these lists of methods will change to something more understandable.

 

The other problem you mentioned

bc2 := u(0, y) = 0, u(Pi, y) = sinh(Pi)*cos(y), u(x, 0) = 0, u(x, Pi) = 0

pdsolve({bc2, pde})

* trying method "_Fn" for 2nd order PDEs
   -> trying "linear_in_xt"
   -> trying "BC_equal_0"
* trying method "_Cn_cn" for 2nd order PDEs
* trying method "Wave" for 2nd order PDEs
   -> trying "Cauchy"
   -> trying "SemiInfiniteDomain"
   -> trying "WithSourceTerm"
* trying method "Heat" for 2nd order PDEs
   -> trying "SemiInfiniteDomain"
   -> trying "WithSourceTerm"
* trying method "Series" for 2nd order PDEs
   -> trying "ThreeBCsincos"
   -> trying "FourBC"

   <- trying "FourBC" successful
<- method "Series" for 2nd order PDEs successful

 

u(x, y) = Sum(2*sin(n*y)*exp(Pi*n)*n*sinh(Pi)*((-1)^n+1)*(exp(n*x)-exp(-n*x))/(Pi*(exp(2*Pi*n)-1)*(n^2-1)), n = 2 .. infinity)

(6)

The sum starts at n = 2.

NULL


Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

Download The_other_two_issues.mw

 

 

@Mariusz Iwaniuk 

Thanks, version 194 includes also a fix to factor, but the advanced version of that fix got by accident into the code for 2018.2. It is corrected now in version 195 of the Maplesoft Physics Updates.

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

@Rouben Rostamian  

First of all, nice reply yours. It is exciting when the level of the discussion goes higher and at the same time stays respectful of other's (sometimes different) opinions.

On the contents: you are right in the distinction about classical and weak solutions; mainly: the solution could be discontinuous at the boundary conditions (e.g. in the example posted). So yes, I goofed here, prematurely discarding the problem because of the inconsistency of the boundary conditions posted.

On the other issues that resulted from this post: Maple's pdsolve does compute weak solutions, examples of that were posted, but the one of this post is not solved when it could - for instance, you show how - and the method (skipping details) is systematic. To cover this example and a family of related cases more work is necessary. We are working on that in this moment, among other things. I will post here again when it is ready.

First 29 30 31 32 33 34 35 Last Page 31 of 65