# Question:a bug in "physics"? + one question

## Question:a bug in "physics"? + one question

Maple

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:

sum(Ket(Psi,s).Bra(Psi,s),s=-n..n).Ket(Psi,1)

in this case the result would be obviosly Ket(Psi,1) and it's true.

Let's modify it now:

sum(Ket(Psi,s+1).Bra(Psi,s),s=-n..n).Ket(Psi,1)

this string will not be evaluated as Ket(Psi,2) (at least i was not able to find any possible way to do it)

still the correct answer will be given with this line :

sum(Ket(Psi,s+1).Bra(Psi,s),s=-10..10).Ket(Psi,1)

or this lineS:

A:=subs(n=10, sum(Ket(Psi,s+1).Bra(Psi,s),s=-n..n)):

A.Ket(Psi,1)

but not in this case :

subs(n=10, sum(Ket(Psi,s+1).Bra(Psi,s),s=-n..n).Ket(Psi,1))

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: x->f(x) . 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: a[x,y]->a[f(x),y]

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

﻿