MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: formation of lowering operator and raising operator

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119172] Re: formation of lowering operator and raising operator
  • From: Peter Pein <petsie at dordos.net>
  • Date: Mon, 23 May 2011 06:29:06 -0400 (EDT)
  • References: <iraq7i$lrm$1@smc.vnet.net>

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.




  • Prev by Date: Re: Very (very very) slow typing for Mathematica in large cells.
  • Next by Date: Re: get a, b from numbers in the form a+b Pi
  • Previous by thread: Re: formation of lowering operator and raising operator
  • Next by thread: How To Break Long List to m-by-n MatrixForm