## 13633 Reputation

18 years, 322 days

## Expected output?...

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

## See ?Physics,examples...

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

## In your example, the prefix is theta_, n...

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

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`

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

## a typo...

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 >

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## i see now...

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

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

## Workaround for greek leters (dphi) in Di...

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

## unable to reproduce ......

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

## unable to reproduce ......

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

## Re: Physics Package...

Hi,

The extra documentation is the reference at the bottom of the page, Bogoliubov's book on quantum fields. The S(cattering) matrix described in the help page is the standard Scattering matrix of perturbative quantum field theory -- see in particular pag. 154 "The axiomatix S-Matrix". The expansion computed by the Maple command is exactly the one shown in page 158, formulas (14) to (17). The output of Physics:-FeynmanDiagrams takes into account Wick's theorems and thus consists of sums of normal products with pairings (see pag 161). All this is explained in the help page. In brief: the output of Physics:-FeynmanDiagrams is the analytic representation of the traditional sequence of Feynman graphs.

The project includes returning also the pictorial representation of these graphs - this is not ready yet, we are working on that and enhancing the rest of the package in general.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## Re: a bug in "physics"? + one question...

Hi,

The fact that Sum(Ket(Psi, s+1) . Bra(Psi,s),s=-n..n) . Ket(Psi,1); is not evaluated to Ket(Psi,2) is a weakness to be fixed. The replacement of the dot operator Physics:-`.` by the non-commutative Physics:-`*` is a bug to be fixed - the fix may be in place in the first dot release. It is not visible in your post but you use sum, not Sum. Using sum, when you take s = -10..10, the sum is expanded and so the dot product works over one term at a time, receiving zero for all of them but for one that returns Ket(Psi,2). When you use subs(n = 10, `....`) the substitution is performed but the sum is not executed, so you fall in that situation (weakness) where the operation is not performed. To have the substitution and the operation evaluated use eval instead of subs. Regarding this other example where you first substitute and in the next line you perform the dot product, as you show (A . Ket(Psi,1)) the sum is performed not when you substitute but when you execute the `.` product in the second line, so that also works. By the way these computations are expected to return the same result with Sum or sum.

Regarding your question: no, in Maple you cannot define a mapping where the parameters are not of type symbol (what you call more complex structures). You can of course obtain the same behavior with the appropriate `->` mapping but it doesn't look as nice nor it can be entered so easily. For example, for your a[x,y] -> a[f(x), y] you can use (A::a[anything, anything]) -> a[f(op(1, A)), op(2, A)]

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## RE How to do abstract algebraic equation...

Hi, In Maple 11, using the Standard Interface, enter ?Physics,examples and the fourth example in the Mechanics section is all about intertia tensor, abstract vector equations, matrices, etc. Most probably this is the info you are looking for .. Edgardo S. Cheb-Terrab Ph.D Theoretical Physics, Research Fellow, Maplesoft

## RE Maple 11 Physics Package: Indicial No...

Hi, You have found a bug in the program - it fix is planned for the next Maple release. Edgardo S. Cheb-Terrab Research Fellow, Maplesoft

## RE Maple for Physics 101 homework...

Hi, In Maple 11 there is a new Physics package. In the Standard GUI (the new worksheet interface), if you enter ?Physics,examples you will see a number of basic and also some more advanced undergraduate Physics problems tackled using the package. These solved problems can be refurbished with ease to cover problems in different aread (frequently similar math). Edgardo S. Cheb-Terrab Research Fellow, Maplesoft Editor for Computer Algebra, Computer Physics Communications
 First 53 54 55 56 Page 55 of 56
﻿