let me show a little problem i've found in physics package (if it really is the problem in package), and especially in Bra, Ket, and in product operators
first
lets calculate a product of a projector and a Ket:

in this case the result would be obviosly
and it's true.
Let's modify it now:

this string will not be evaluated as
(at least i was not able to find any possible way to do it)
still the correct answer will be given with this line :

or this lineS:


but not in this case :

The main difference is that in "wrong" cases (which do not give correct result) the 'dot product' operator is automatically substituted by a '* product' (both of them are taken from physics package, and not the default).
In case of normal product, the bracket is not defined, so the expression is not simplified.
can anyone suggest how to avoid this automatic substitution (or how can i define a BraKet with normal product operator? or is this really a bug, which will be corrected (it's present in Maple11 and in Maple12) someday?
and another question.
the -> operator "creates" a function: . is there any possibility to put on the left side of this expression NOT ONLY variables, but any more complex structure? for example something similar to this:
It can be done easily for example with Wolfram Matematica, but I can't do in with Maple =(
Thanks in anvance and sorry for my english
Composition operator
<p>Using the composition operator @, or @@ the repeated composition operator, you can use/build more complex structure, if I don't misunderstand your second question.</p>
more complex structure
There is some support for pattern matching in Maple, eg:
applyrule(a(u::symbol,v::symbol)=a(f(u),v),sin(a(x,y))); sin(a(f(x), y))2nd question
That can be done, for example, as
F:=a->applyop(f,1,a); F(a[x,y]); a[f(x), y]or
G:=curry(applyop,f,1); G(a[x,y]); a[f(x), y]Alec
Re: a bug in "physics"? + one question
Hi,
The fact that
is not evaluated to
is a weakness to be fixed. The replacement of the dot operator
by the non-commutative
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
, 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
. When you use
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 (
) 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]](http://mapleoracles.maplesoft.com:8080)
you can use
(A::a[anything, anything]) -> a[f(op(1, A)), op(2, A)]
Edgardo S. Cheb-Terrab
Physics, Maplesoft
Thanks a lot for your
Thanks a lot for your answers! I'll try suggested ways!
GL&HF!