ecterrab

13316 Reputation

24 Badges

18 years, 89 days

MaplePrimes Activity


These are answers submitted by ecterrab

Hi

Revising old posts related to Physics; these examples you posted work fine in Maple 16.02.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Hi

Revising old posts; this problem got fixed, 'diff(Dagger(P(t)), t)' of your post works fine in Maple 16.02.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Hi,

Just revising this old post - the fix got into the system and examples as the one you posted work fine in Maple 16.02.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

I missed a line in your post, "LinearAlgebra[Transpose](map(Dagger, P))". Dagger was using LinearAlgebra:-HermitianTranspose, but you are right, the matrix components may be operators, and in these cases, as the one you posted, LinearAlgebra:-HermitianTranspose will not work as expected.

It's fixed now in the Maple version under development.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Hi

It's attempting dDagger/dP * dP/dt  to then complain that d/dP is not defined for P::noncommutative  - that behavior is bogus.

Now, diff and Dagger do not commute unless the differentiation variable is known to be real. In that case there is still the issue of the normal form: should it return diff@Dagger or Dagger@diff? Note this applies to diff, and the Physics commands d_[mu], D_[mu] and Fundiff. Till Maple 16, when possible (but for this bug you are pointing at) we mapped Dagger into diff constructions, returning as in diff@Dagger, considering that outside a computer Dagger(P) is not a "composite function" - it is just a function as P is.

According to that, the output for diff(Dagger(P(t)), t) would be 'unevaluated' (that is, as you are entering it, without performing any operation). That is what I have in the version of Maple under development after the bug got fixed. Opinions?

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Hi

Things have changed from Maple 15 to Maple 16, but anyway: could you please post the output you expect? Thanks.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Hi
Yes you can use the tensor and Physics packages together, but you have tensors implemented in Physics too, and more appropiatedly for algebraic computations. You have examples of all of this in ?Physics,examples. Regarding KroneckerDelta, your question is answered in its help page ?KroneckerDelta

Edgardo S. Cheb-Terrab
Physics, Maplesoft

So, if you Setup(anticommutativeprefix = theta_): then theta_2 * theta_1 - theta_1 * theta_2 <>0. Alternatively, if you want to use theta as prefix, then theta2 * theta1 - theta1 * theta2 <> 0 (so removing the _ after theta). In both cases, if you use the prefix indexed, say as in theta_[1] for prefix = theta_, or theta[1] for prefix = theta, it also works.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Hi

It is not dsolve that hangs, but int (try interrupting the computation, then entering tracelast to see the computational flow and the hanging point). I see it hanging here:

int:-ModuleApply called with arguments: 1/(_a^n/(a^(-n-1)*(b*(x-s)^(-n/(-1+n)))^(-2*n+1)*(a*b*(x-s)^(-n/(-1+n))*n/((-1+n)*(-x+s)))^n*n^(-n))-_a+1), `_a`

Anyway here are two tips that answer your questions.

1) when apparently dsolve hangs, try the same input with options 'useInt' and 'implicit'. Typically, the hang happens within int or solve, frequently because of simplifying radicals or symbolic powers, not an easy task. The options useInt makes dsolve use Int instead of int, and the option implicit makes dsolve skip the last step that attempts isolating the unknown of the problem after having obtained an implicit solution.

2) to indicate dsolve to use a given method, just pass the method to it, for example as in dsolve(ode, [Chini]). See ?dsolve,details and also ?dsolve,setup; you can actually indicate many methods, in the order you prefer, or change the default choicie of methods used by dsolve if you believe it is more convenient for your work.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Hi

In my post I wrote kernelopt'e's, a typo, it should be without 'e', so kernelopts. If you work with general relativity 'd suggest you Maple 15 were DifferentialGeometry includes a large set of new GR commands (I use it on the mac too). Anyway attached is a Maple 13 mw worksheet (produced in an older windows machine) showing that the display, and copy and paste, work as expected after kernelopts instead of kerneloptes. And yes, if it doesn't work for you let me know again please.

Best

restart; interface(version);

(1)

kernelopts(opaquemodules = false);

(2)

This replaces adjusts a bit an internal subroutine of DifferentialGeometry, and can be entered before or after "with(DifferentialGeometry):

DifferentialGeometry:- labelDataToLabel := proc(t)

local n;

n := nops(t);

if n=1 then

    Local(t[1]);

elif n = 2 then

    if t[2]=[] then

        Local(t[1]);

    else

        Local(t[1])[op(op(t[2]))]

    fi;

else

    error("wrong number of arguments; expected 1 or 2, received: %1", nargs);

fi;

end:

This is a new routine that makes things be displayed properly (via alias) while, at the same time, the copy and paste of the new display also work properly (via a call to assign. (Note this only works in the Standard GUI, not in the old Classic GUI.)

Local := proc(t)

local tmp, T;

option cache;

 

tmp :=         convert(t, '`local`');

if substring(t, 1..1) = "d" and member(substring(t, 2..-1), GreekLetters) then

        T := cat('`d&`', substring(t, 2..-1), '`;`');

        alias(convert(T, '`local`') = tmp);

         assign(T, convert(t, 'name')):

elif substring(t, 1..2) = "D_" and member(substring(t, 3..-1), GreekLetters) then

        T := cat('`D_&`', substring(t, 3..-1), '`;`');

        alias(convert(T, '`local`') = tmp);

         assign(T, convert(t, 'name')):

fi;

tmp;

end:

This is just a list with the greek letters, lower and upper case

GreekLetters := '["alpha", "beta", "gamma", "delta", "zeta", "eta", "theta", "iota", "kappa", "lambda", "mu", "nu", "xi", "omicron", "pi", "rho", "sigma", "tau", "upsilon", "phi", "chi", "psi", "omega", "Alpha", "Beta", "Gamma", "Delta", "Zeta", "Eta", "Theta", "Iota", "Kappa", "Lambda", "Mu", "Nu", "Xi", "Omicron", "Pi", "Rho", "Sigma", "Tau", "Upsilon", "Phi", "Chi", "Psi", "Omega"]':

 

So at this point you do not need to enter any alias, things work automatically as expected, and not just for phi or for dphi but for all greek letters and also for both dphi and D_phi:

with(DifferentialGeometry);

(3)

You see now , and also  , displayed as expected

DGsetup([theta, phi], sphere, verbose);

 

 

 

 

 

 

(4)

Input dphi, you see ; then lprint to be sure that the right object is behind this display

dphi;

(5)
sphere > 

lprint(%);

_DG([["form", sphere, 1], [[[2], 1]]])

 

Now mark that  with the mouse, copy and paste it in the next line: you continue seeing  and lprint tells it is the right object

sphere > 

dφ;

(6)
sphere > 

lprint(%);

_DG([["form", sphere, 1], [[[2], 1]]])

 
sphere > 

 

 

Download DG_greek_letters.mw

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Hi Mark

Sorry, I was making the experiment with the development version and didn't notice. To make this work in your code you need to proceed as follows, more ellaborated.

After "with(DifferentialAlgebra)" enter this block of lines (or you may have them in your .mapleinit file, called maple.ini in the windows platform):

> kerneloptes(opaquemodules = false):

> DifferentialGeometry:- labelDataToLabel := proc(t) 
local n; 
n := nops(t);
if n=1 then Local(t[1]);
elif n = 2 then
if t[2]=[] then
Local(t[1]);
else
Local(t[1])[op(op(t[2]))]
fi;
else
error("wrong number of arguments; expected 1 or 2, received: %1", nargs);
fi;
end:

> Local := proc(t)
local tmp, T;
option cache;

tmp := convert(t, '`local`');
if substring(t, 1..1) = "d" and member(substring(t, 2..-1), GreekLetters) then
T := cat('`d&`', substring(t, 2..-1), '`;`');
alias(convert(T, '`local`') = tmp);
assign(T, convert(t, 'name')):
elif substring(t, 1..2) = "D_" and member(substring(t, 3..-1), GreekLetters) then
T := cat('`D_&`', substring(t, 3..-1), '`;`');
alias(convert(T, '`local`') = tmp);
assign(T, convert(t, 'name')):
fi;
tmp;
end:
 
> GreekLetters := '["alpha", "beta", "gamma", "delta", "zeta", "eta", "theta", "iota", "kappa", "lambda", "mu", "nu", "xi", "omicron", "pi", "rho", "sigma", "tau", "upsilon", "phi", "chi", "psi", "omega", "Alpha", "Beta", "Gamma", "Delta", "Zeta", "Eta", "Theta", "Iota", "Kappa", "Lambda", "Mu", "Nu", "Xi", "Omicron", "Pi", "Rho", "Sigma", "Tau", "Upsilon", "Phi", "Chi", "Psi", "Omega"]':

I tried it now with Maple 15 and rus fine. Please let me know if it also works fine for you.
Have a good weekend.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

I assumed you are working using the Standard GUI (as opposed to the Classic GUI, whiere this workaround does not work). So in the standard GUI, just enter, at the Maple prompt (or in an input region if you are in using the document mode) just enter the command as explained: for dphi use `d&phi` (including the `), and the same for any greek letter. If it doesn't work for you would you please post the input lines or attach a worksheet with them to understand what could be going on.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

For every object like dphi that you want to see displayed with the greek letter, input a corresponding alias as in
> alias(`d&phi;` = dphi);

That will make all the output of DG display the way you want.

This approach may be easy to implement too directly in the DG code for the next release.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Hi I am unable to reproduce your problem - perhaps if you could bring more details on the actual input..? Here is what I see: > restart; with(Physics): # set hermitian operators > Setup(her={a,b,c,R}); * Partial match of 'her' against keyword 'hermitianoperators' [hermitianoperators = {R, a, b, c}] # introduce your constraint > constraint := a + b*c*b = R; a + b c b = R # introduce the Hamiltonian > H := - a - b*c*b; -a - b c b # to 'subs' you need to isolate 'a' first > isolate(constraint, a); a = R - Physics:-*(b, c, b) # so subs works: > subs(%, H); -R # simplify/siderels also works; you request to eliminate 'a' simplify(H, {constraint}, {a}); -R # algsubs works as well > algsubs(constraint, H); -R

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Hi Rob, I am unable to reproduce your 10 min evaluation problem. Perhaps there are some details not mentioned in your post? Here is what I am doing and it takes ~0.8 sec to return expanded. restart; with(Physics); ee := alpha*(a + b)*Ket(E1) + beta*(a - b)*Ket(E2) + beta*(3*a + b)*Ket(E3) + alpha*(a + 4*b)*Ket(E4) + beta*(9*a - 6*b)*Ket(E5) + alpha*(3*a + 6*b)*Ket(E6); Dagger(%)*%; expand(%); time(expand(Dagger(ee).ee)); 0.84 Independent of the above, it is sometimes convenient to split the three operations you are combining, in order to identify where the problem actually is: take the Dagger, then take the `.` product, then expand. So by entering: Dagger(%); %% . %%; expand(%); you (not exactly, but mostly) reproduce your computation and can identify where is that the computation is actually taking the time. Best

Edgardo S. Cheb-Terrab
Physics, Maplesoft

First 51 52 53 54 55 Page 53 of 55