ecterrab

11116 Reputation

24 Badges

16 years, 323 days

MaplePrimes Activity


These are answers submitted by ecterrab

Hi
Note there is a green arrow in the toolbar of the window you use to post. Clicking it you can upload a worksheet with the problem. That helps others help you.

Independent of that, take a look at the help page for "?Physics:-ExteriorDerivative"; from what you show, the Physics command is a simpler approach.

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

Hi
This is an issue of the integrator, apparently in the piecewise handler. I added a workaround to it directly in the subroutine for integrating Dirac functions which is part of the Physics package. That resolves the isue and the change is included in the latest Maplesoft Physics Updates (v.1234) for Maple 2022.

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

To enter the metric use Setup(metric = line_element), check the help page, there is a brief subsection/paragraph for 'metric', scanning and reading only that suffices. The covariant derivative operator is D_; again, see the help page. Then just write those derivatives you mention, as you speak. Depending on the level of details you want, see also ?TensorArray and/or SumOverRepeatedIndices.

By the way In ?Physics (scroll) there is a section called "Brief description of each command" where you can get a quick glance at all the existing Physics functionality and links to the corresponding commands.

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

Check it out, it does precisely what you are asking for. The command admits several options; the help page (enter ?SortProducts) contains good examples.

By the way In ?Physics (scroll) there is a section called "Brief description of each command" where you can get a quick glance at the existing functionality and links to the corresponding commands.

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

The command to use is Library:-SubstituteOperator.

with(Physics); Setup(quantumoperators = {A, B, C})

[quantumoperators = {A, B, C}]

(1)

Setup(algebrarules = {%Commutator(A[m], B[n]) = C[m+n]})

[algebrarules = {%Commutator(A[m], B[n]) = C[m+n]}]

(2)

Library:-SubstituteOperator(A[1]*B[2] = 5, A[1]*B[2]*C[4]+C[3])

5*C[4]+C[3]

(3)

Regarding your use of subs or algsubs, they will work only when the expression being substituted is an operand of the target expression. In your first example, this works

subs(A[1]*B[2] = 5, A[1]*B[2]+C[3])

5+C[3]

(4)

because A[1]*B[2] is an operand of A[1]*B[2]+C[3]. You see that using the op command

A[1]*B[2]+C[3]

Physics:-`*`(A[1], B[2])+C[3]

(5)

op(Physics[`*`](A[1], B[2])+C[3])

Physics:-`*`(A[1], B[2]), C[3]

(6)

You see A[1]*B[2] is the first operand,

op(1, Physics[`*`](A[1], B[2])+C[3])

Physics:-`*`(A[1], B[2])

(7)

NULL


PS: For next questions or posts: note there is a green arrow in the window you write the question, clicking that arrow allows for uploading the worksheet itself, as I am doing now. That helps others reproducing your input without having to retype anything.

Download SubstituteOperator.mw

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

Note first that your equation was and is solved by dsolve in terms of Heun functions :

mplinput := (x^4+4*x^3+10*x^2+4*x+1)*(diff(y(x), []))/(4*x^2*(1+x)^2*(x^2+6*x+1))+(2*(x^2+5*x+2))*(diff(y(x), x))/((1+x)*(x^2+6*x+1))+diff(y(x), x, x) = 0

dsolve(mplinput)

y(x) = _C1*x^(1/2)*HeunG(4*2^(1/2)/(3+2*2^(1/2)), (1+2^(1/2))/((3+2*2^(1/2))^3*(-3+2*2^(1/2))^2), 1, 1, 1/2, 1, (x+3+2*2^(1/2))/(3+2*2^(1/2)))*(x+3-2*2^(1/2))^(1/2)/(1+x)^(1/2)+_C2*x^(1/2)*(x^2+6*x+1)^(1/2)*HeunG(4*2^(1/2)/(3+2*2^(1/2)), (1/4)*(18*2^(1/2)+13)/((3+2*2^(1/2))^3*(-3+2*2^(1/2))^2), 3/2, 3/2, 3/2, 1, (x+3+2*2^(1/2))/(3+2*2^(1/2)))/(1+x)^(1/2)

(1)

That said, when indicating the method hypergeometricsols, it was not working as in previous releases; the problem was not related to find_2F1 but related to a mechanism for choosing between Heun and pFq solutions that prioritizes Heun when pFq is expected to be too complicated. I refined that mechanism now, basically: if you ask for pFq then the algorithm will give you pFq regardless of complexity - that is a more proper design, I think. So now we get

dsolve(mplinput, [hypergeometricsols])

y(x) = _C1*x^(1/2)*hypergeom([1/8, 5/8], [1], -16*x^2/((x^2+6*x+1)*(x-1)^2))/((1+x)^(1/2)*(x-1)^(1/4)*(x^2+6*x+1)^(1/8))+_C2*x^(1/2)*hypergeom([1/8, 5/8], [3/4], (1+x)^4/((x^2+6*x+1)*(x-1)^2))/((1+x)^(1/2)*(x-1)^(1/4)*(x^2+6*x+1)^(1/8))

(2)

So thanks for posting this one. The fix is distributed for everybody within the Maplesoft Physics Updates v.1220 and higher.

NULL


 

Download HeunHypergeometric.mw

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

In ?latex, section on tips, you read: "Also, a copy of the maple.sty file, found in the etc directory of your Maple installation (kernelopts(mapledir)), should be in the same directory where you placed the .tex file". That resolves the issue of the commands you do not recognize, and by opening maple.sty in a text editor you can also see what these commands do.

As for "does not display well": Is that the case with or without the maple.sty file? It would help if you could please upload a picture of what looks wrong (after including maple.sty in the right directory, as said above).

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

Yes you can use differential operators are operands in a product and with the correct meaning . But you realize, then, in those products the operands do not commute. Use then the Physics package and its functionality about differentialoperators of type algebraic (operands in a product).

 

with(Physics)

 

Setup now three differential operators: you indicate them as a list, where the first element is the differential operator and the second element is in turn a list with the differentiation variables of that operator

Setup(differentialoperators = {[Delta__delta, [t]], [Delta__psi__d, [t]], [Delta__psi__q, [t]]})

[differentialoperators = {[Delta__delta, [t]], [Delta__psi__d, [t]], [Delta__psi__q, [t]]}]

(1)

You see they are displayed in a different color, olive, indicating they are noncommutative with respect to products.

Suppose you want to have "`Delta__delta`=f->(∂)/(∂t) f", then "(Delta[psi])[d]=f->1/t ((∂)/(∂t) f)"

Delta__delta := proc (f) options operator, arrow; diff(f, t) end proc

proc (f) options operator, arrow; Physics:-diff(f, t) end proc

(2)

Delta__psi__d := proc (f) options operator, arrow; (diff(f, t))/t end proc

proc (f) options operator, arrow; Physics:-`*`(Physics:-`^`(t, -1), Physics:-diff(f, t)) end proc

(3)

Your equation now, I am changing composite functions by products to illustrate, but you see how it works that is what matters.

EQ := psi__d0*Delta__delta+psi__q0*D*Delta__delta/`ω__0` = p_*Delta__psi__d/`ω__0`-Delta__psi__q

psi__d0*Delta__delta+psi__q0*D*Delta__delta/omega__0 = p_*Delta__psi__d/omega__0-Delta__psi__q

(4)

 

Multiply this EQ by a product of functions of t times a function of x, to see how it works

EQ*f(t)*g(t)*h(x)

h(x)*(D*psi__q0+psi__d0*omega__0)*Physics:-`*`(Delta__delta, f(t), g(t))/omega__0 = h(x)*Physics:-`*`(p_*Delta__psi__d-Delta__psi__q*omega__0, f(t), g(t))/omega__0

(5)

You see that h(x) passed to the left while f(t)*g(t) remains to the right of the differential operators that act on them (that is so because the product operator Physics:-`*` handles noncommutative objects, including in that differential operators).  Note also that the differential operators you set remain multiplied by the mathematical objects that depend on t. And you can keep computing, simplifying expanding, always keeping the ordering correctly and just using multiplication.

 

But at some point you want to apply these operators, that is: transform these products of differential operators times functions into the application of the operators (2) and (3). You do that using Library:-ApplyProductOfDifferentialOperators. We expect `Δ__δ` and `Δ__ψ__d` to distribute as the linear differential operators defined in (2) and (3) while `Δ__ψ__q` only encloses (applies to) f(t)*g(t) and doesn't expand further because its definition is not know:

 

Library:-ApplyProductsOfDifferentialOperators(h(x)*(D*psi__q0+psi__d0*omega__0)*Physics[`*`](Delta__delta, f(t), g(t))/omega__0 = h(x)*Physics[`*`](p_*Delta__psi__d-Delta__psi__q*omega__0, f(t), g(t))/omega__0)

h(x)*(D*psi__q0+psi__d0*omega__0)*((diff(f(t), t))*g(t)+f(t)*(diff(g(t), t)))/omega__0 = -h(x)*(Delta__psi__q(f(t)*g(t))*omega__0*t-(diff(f(t), t))*g(t)*p_-f(t)*(diff(g(t), t))*p_)/(omega__0*t)

(6)

 

Note the factor t appearing in the denominator of the second term. That is due to the definition (3).

Download differential_operators_as_operands_in_products.mw

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

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

You can choose among the three representations used in the literature (standard, chiral or Majorana), but no, you cannot redefine the Dirac matrices (would stop being the Dirac matrices). Their definition is standard in the literature and shown on the help page for Dgamma. The definition is similar to what you show but the two Pauli matrices have opposite signs (not as you indicate).

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

`tools/CartesianProduct`, originally written as `PDEtools/CartesianProduct` is an internal routine used in PDEtools (symmetry methods) that implements Cartesian products recursively, with a few options. Today I'd write it a bit more compactly but, as is, implements the concept pretty well. You can see the program entering showstat(`tools/CartesianProduct`)

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

At the end, you have a link to download the worksheet whose contents follow.

Download: For_mapleprimes_(reviewed).mw

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


There was indeed a weakness in the code: when computing the dot product within a sum, in one place the range of the dummy summation index was not taken into account, resulting in less simplification. The problem is fixed and the fix distributed for everybody using Maple 2022 within the Maplesoft Physics Updates v.1186 and higher. To install it, input Physics:-Version(latest) and follow instructions.

 

This is what we get now

with(Physics)

H := sum(Ket(e, n).Bra(e, n+1)+Ket(e, n+1).Bra(e, n), n = 1 .. d)

sum(Physics:-`*`(Physics:-Ket(e, n), Physics:-Bra(e, n+1))+Physics:-`*`(Physics:-Ket(e, n+1), Physics:-Bra(e, n)), n = 1 .. d)

(1)

H.H

sum(sum(Physics:-KroneckerDelta[n, n__1+1]*Physics:-`*`(Physics:-Ket(e, n__1), Physics:-Bra(e, n+1))+Physics:-KroneckerDelta[n__1, n+1]*Physics:-`*`(Physics:-Ket(e, n__1+1), Physics:-Bra(e, n)), n = 1 .. d)+Physics:-`*`(Physics:-Ket(e, n__1+1), Physics:-Bra(e, n__1+1))+Physics:-`*`(Physics:-Ket(e, n__1), Physics:-Bra(e, n__1)), n__1 = 1 .. d)

(2)

Note that the inner sum does not span all terms: the last two, with no KroneckerDelta are out of it. Expand this sum to understand this result better

expand(sum(sum(Physics[KroneckerDelta][n, n__1+1]*Physics[`*`](Physics[Ket](e, n__1), Physics[Bra](e, n+1))+Physics[KroneckerDelta][n__1, n+1]*Physics[`*`](Physics[Ket](e, n__1+1), Physics[Bra](e, n)), n = 1 .. d)+Physics[`*`](Physics[Ket](e, n__1+1), Physics[Bra](e, n__1+1))+Physics[`*`](Physics[Ket](e, n__1), Physics[Bra](e, n__1)), n__1 = 1 .. d))

sum(sum(Physics:-KroneckerDelta[n, n__1+1]*Physics:-`*`(Physics:-Ket(e, n__1), Physics:-Bra(e, n+1)), n = 1 .. d), n__1 = 1 .. d)+sum(Physics:-`*`(Physics:-Ket(e, n__1), Physics:-Bra(e, n__1)), n__1 = 1 .. d)+sum(sum(Physics:-KroneckerDelta[n__1, n+1]*Physics:-`*`(Physics:-Ket(e, n__1+1), Physics:-Bra(e, n)), n = 1 .. d), n__1 = 1 .. d)+sum(Physics:-`*`(Physics:-Ket(e, n__1+1), Physics:-Bra(e, n__1+1)), n__1 = 1 .. d)

(3)

Take the first sum

op(1, sum(sum(Physics[KroneckerDelta][n, n__1+1]*Physics[`*`](Physics[Ket](e, n__1), Physics[Bra](e, n+1)), n = 1 .. d), n__1 = 1 .. d)+sum(Physics[`*`](Physics[Ket](e, n__1), Physics[Bra](e, n__1)), n__1 = 1 .. d)+sum(sum(Physics[KroneckerDelta][n__1, n+1]*Physics[`*`](Physics[Ket](e, n__1+1), Physics[Bra](e, n)), n = 1 .. d), n__1 = 1 .. d)+sum(Physics[`*`](Physics[Ket](e, n__1+1), Physics[Bra](e, n__1+1)), n__1 = 1 .. d))

sum(sum(Physics:-KroneckerDelta[n, n__1+1]*Physics:-`*`(Physics:-Ket(e, n__1), Physics:-Bra(e, n+1)), n = 1 .. d), n__1 = 1 .. d)

(4)

Simplify(sum(sum(Physics[KroneckerDelta][n, n__1+1]*Physics[`*`](Physics[Ket](e, n__1), Physics[Bra](e, n+1)), n = 1 .. d), n__1 = 1 .. d))

sum(sum(Physics:-KroneckerDelta[n, n__1+1]*Physics:-`*`(Physics:-Ket(e, n__1), Physics:-Bra(e, n+1)), n = 1 .. d), n__1 = 1 .. d)

(5)

Why is this KroneckerDelta not simplified? Because for n__1 = d, we have that delta[n, n__1+1] = 0, since n <= d cannot be equal to `#msub(mi("n"),mi("1"))`+1 = d+1. So, we cannot remove the sum over n making delta[n, n__1+1]*Bra(e, n+1) = Bra(e, n+2)

 We can still do the simplification of delta[n, n__1+1] and one sum if the upper summation limit of the other sum is d-1, that is: split the external sum "(&sum;)=(&sum;)+ term with `n__1`=d", where the later is equal to zero because delta[n, d+1] = 0, so just replacing "(&sum;)=(&sum;)" is correct. Doing that here, manually, we get

Physics:-KroneckerDelta[n, n__1+1]

(6)

subsop([2, 2, 2] = d-1, sum(sum(Physics[KroneckerDelta][n, n__1+1]*Physics[`*`](Physics[Ket](e, n__1), Physics[Bra](e, n+1)), n = 1 .. d), n__1 = 1 .. d))

sum(sum(Physics:-KroneckerDelta[n, n__1+1]*Physics:-`*`(Physics:-Ket(e, n__1), Physics:-Bra(e, n+1)), n = 1 .. d), n__1 = 1 .. d-1)

(7)

Simplify(sum(sum(Physics[KroneckerDelta][n, n__1+1]*Physics[`*`](Physics[Ket](e, n__1), Physics[Bra](e, n+1)), n = 1 .. d), n__1 = 1 .. d-1))

sum(Physics:-`*`(Physics:-Ket(e, n__1), Physics:-Bra(e, n__1+2)), n__1 = 1 .. d-1)

(8)

The same applies to the other double sum in (3),

op(3, sum(sum(Physics[KroneckerDelta][n, n__1+1]*Physics[`*`](Physics[Ket](e, n__1), Physics[Bra](e, n+1)), n = 1 .. d), n__1 = 1 .. d)+sum(Physics[`*`](Physics[Ket](e, n__1), Physics[Bra](e, n__1)), n__1 = 1 .. d)+sum(sum(Physics[KroneckerDelta][n__1, n+1]*Physics[`*`](Physics[Ket](e, n__1+1), Physics[Bra](e, n)), n = 1 .. d), n__1 = 1 .. d)+sum(Physics[`*`](Physics[Ket](e, n__1+1), Physics[Bra](e, n__1+1)), n__1 = 1 .. d))

sum(sum(Physics:-KroneckerDelta[n__1, n+1]*Physics:-`*`(Physics:-Ket(e, n__1+1), Physics:-Bra(e, n)), n = 1 .. d), n__1 = 1 .. d)

(9)

Simplify(%)

sum(sum(Physics:-KroneckerDelta[n__1, n+1]*Physics:-`*`(Physics:-Ket(e, n__1+1), Physics:-Bra(e, n)), n = 1 .. d), n__1 = 1 .. d)

(10)

subsop([1, 2, 2, 2] = d-1, sum(sum(Physics[KroneckerDelta][n__1, n+1]*Physics[`*`](Physics[Ket](e, n__1+1), Physics[Bra](e, n)), n = 1 .. d), n__1 = 1 .. d))

sum(sum(Physics:-KroneckerDelta[n__1, n+1]*Physics:-`*`(Physics:-Ket(e, n__1+1), Physics:-Bra(e, n)), n = 1 .. d-1), n__1 = 1 .. d)

(11)

Simplify(%)

sum(Physics:-`*`(Physics:-Ket(e, n+2), Physics:-Bra(e, n)), n = 1 .. d-1)

(12)

``

NULL


Download hopping_(reviewed).mw

Edgardo S. Cheb-Terrab

Physics, Differential Equations and Mathematical Functions, Maplesoft

Hi

For a couple of days, there are Maple 2021 and Maple 2022. The corresponding Maplesoft Physics Updates are not the same

  • If you try to install the Updates for Maple 2022 in Maple 2021, it won't work as expected: the Updates for Maple 2022 do not contain the fixes for Maple 2021 because they are already in the Maple library 2022. More critical: the Physics Updates for Maple 2022 rely on things that only exist in Maple 2022.

So, each Maple release has its window of versions of the Physics Updates. How do you know about these windows?

  • By visiting the official Maplesoft Physics Updates webpage. There you read that the latest version for Maple 2021 is v.1181. And that for Maple 2022, we are already in v.1183.
  • By opening the distributed file Physics Updates.mla itself, where you read the same information, going back to the window of Updates for Maple 2018.

With the above in mind, now on your post, @michalkvasnicka. What @tomleslie says is correct:

  • In Maple 2022, Physics:-Version(latest) installs the latest version for Maple 2022. Good.
  • In a previous Maple release, the Physics Updates.mla says that to install the latest for that release you need to enter Physics:-Version(n), where n for each Maple release is shown there on the webpage.

So everything is working as expected. The MapleCloud installer refuses to install the Physics Updates of Maple 2022 in Maple 2021. Your expectation of installing the Updates for Maple 2022 in Maple 2021 - although natural to some point - is not correct.

From this conversation, what can be improved? 

It would be better if, in a previous Maple release (e.g., 2021), when you input Physics:-Version(latest) it installs the latest for that previous Maple release instead of attempting to install "the absolute latest", which is always programmed for the current - not a previous - Maple release. I am coding this improvement now, but it won't work retroactively, only from here on to the subsequent releases.

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

Solving an ODE involves a myriad of different computational steps. Think of them as bricks of a wall. You immediately realize that many of those bricks are useful to solve other ODEs, or even the same one again.

There is a significant amount of code in dsolve that aims at "remembering" those bricks of computations, so that they can be reused without wasting time. That approach is a mimicry of what you do with paper and pencil and is a fantastic thing within dsolve. That also explains the obvious: the second time you tackle the same ODE, dsolve is much faster.

Now how about you want to "not save computational time". Instead, you prefer to recompute again every single thing. As the author of dsolve, I can tell you I definitely not recommend that. Why waste time recomputing again every step if you can remember the result you got the first time? Your answer seems to be "to see again user information about the steps performed to tackle the ODE".

If that is what you want, here is a solution: input PDEtools:-Library:-Forget( ) before "calling dsolve or pdsolve again" and the results for the most relevant previously computed steps are discarded; you will see again the previous user level information.

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

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