Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #2648

Re: formation of lowering operator and raising operator

From Peter Pein <petsie@dordos.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: formation of lowering operator and raising operator
Date 2011-05-23 10:28 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <irdcta$3t2$1@smc.vnet.net> (permalink)
References <iraq7i$lrm$1@smc.vnet.net>

Show all headers | View raw


Am 22.05.2011 12:57, schrieb Sseziwa Mukasa:
> On May 21, 2011, at 6:44 AM, tarun dutta wrote:
> 
>> thanks bob,peter and mukasa.but there is something wrong in operation
>> such that i do not make you understand.first of all
>> a[0][x_List] := 0 x....this is not right, all elements of vector  will
>> not be zero.
>> here is the right operation...
>> a[i]@{a,b,c,d}...if i=2 then a[i] will be a[2] and now
>> a[2]@{a,b,c,d},,,the result will be Sqrt[b]{a,b-1,c,d} and sqrt[b]
>> will be outside of this vector as display."i" determines the position
>> which element of vector will be decreasing by 1.
>> now if i=0 then a[i] will operate on the element which is in the
>> zeroth position of vector..e.g.
>> a[0]@{a,b,c,d}===result ==Sqrt[a]{a-1,b,c,d}....now if a=0 then this
>> element will remain 0,will not be 0-1and also will be no change in the
>> rest of the element..e.g.
>> a[0]@{a=0,b,c,d}===sqrt[a=0]{a-1,b,c,d}==sqrt[0]{0-1,b,c,d}==sqrt[0]
>> {0,b,c,d}
>> Sqrt[] will not be multiplied with the vector.
>> thanks again for replying.
>> regards,
>> tarun
> 
> I think I understand now.  My suggestion would be to not store the ket in alist, otherwise preventing multiplication is difficult.  Store the ket in an expression with the head ket and use part to operate on the elements.  I'm not sure I understand what you mean by the zeroth position, if the zeroth element of ket[a,b,c,d] is a, then why is the second element b?  At any rate you could start with:
> 
> a[i_][k : ket[e___]] :=
>  If[k[[i]] == 0, k, Sqrt[k[[i]]] ReplacePart[k, i -> k[[i]] - 1]]
> a[i_][k : Sqrt[n_] ket[e___]] :=
>  If[{e}[[i]] == 0, k,
>   Sqrt[{e}[[i]]] Sqrt[n] ket @@ ReplacePart[{e}, i -> {e}[[i]] - 1]]
> 
> which gives:
> 
> In[25]:= a[2][ket[1, 2, 3, 4]]
> a[2][a[2][ket[1, 2, 3, 4]]]
> a[3][a[2][ket[1, 2, 3, 4]]]
> Out[25]= Sqrt[2] ket[1, 1, 3, 4]
> Out[26]= Sqrt[2] ket[1, 0, 3, 4]
> Out[27]= Sqrt[6] ket[1, 1, 2, 4]
> 
> Is that closer to what you are looking for?
> 
> Regards,
> 	Ssezi
> 
> 

This seems to work. Adding

 Format[ket[l___]] := ToString[{l}]

would give an output similar to the OP.


Back to comp.soft-sys.math.mathematica | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: formation of lowering operator and raising operator Sseziwa Mukasa <mukasa@gmail.com> - 2011-05-22 10:57 +0000
  Re: formation of lowering operator and raising operator Peter Pein <petsie@dordos.net> - 2011-05-23 10:28 +0000

csiph-web