Prev: export to file with a specific precision
Next: Relationship between vertices and indices with GraphDistanceMatrix
From: KFUPM on 3 Aug 2010 06:39 Dear All I have the expression E^(I km Subscript[X, 0] + I \[Lambda] Subscript[X, 0]) (-(1/2) I kz^2 Am[Subscript[X, 1]] Coss[(m \[Pi] y)/B] - 1/2 I km \[Lambda] Am[Subscript[X, 1]] Coss[(m \[Pi] y)/B]) + E^(I km Subscript[X, 0] - I \[Lambda] Subscript[X, 0]) (1/2 I kz^2 Am[Subscript[X, 1]] Coss[(m \[Pi] y)/B] - 1/2 I km \[Lambda] Am[Subscript[X, 1]] Coss[(m \[Pi] y)/B]) + E^(I kn Subscript[X, 0] + I \[Lambda] Subscript[X, 0]) (-(1/2) I kz^2 An[Subscript[X, 1]] Coss[(n \[Pi] y)/B] - 1/2 I kn \[Lambda] An[Subscript[X, 1]] Coss[(n \[Pi] y)/B]) + E^(I kn Subscript[X, 0] - I \[Lambda] Subscript[X, 0]) (1/2 I kz^2 An[Subscript[X, 1]] Coss[(n \[Pi] y)/B] - 1/2 I kn \[Lambda] An[Subscript[X, 1]] Coss[(n \[Pi] y)/B]) + E^(I km Subscript[X, 0]) Coss[(m \[Pi] y)/B] \!\(\*SuperscriptBox["Bm", "\[Prime]", MultilineFunction->None]\)[0] + E^(I kn Subscript[X, 0]) Coss[(n \[Pi] y)/B] \!\(\*SuperscriptBox["Bn", "\[Prime]", MultilineFunction->None]\)[0] I want to extract terms that contain E^(I km Subscript[X, 0]) only and I need this to be done automatically. I appreciate any help in this regard. HMQ
From: Peter Pein on 4 Aug 2010 07:34
Am Tue, 3 Aug 2010 10:39:00 +0000 (UTC) schrieb KFUPM <hussain.alqahtani(a)gmail.com>: > Dear All > > I have the expression > > E^(I km Subscript[X, 0] + > I \[Lambda] Subscript[X, > 0]) (-(1/2) I kz^2 Am[Subscript[X, 1]] Coss[(m \[Pi] y)/B] - > 1/2 I km \[Lambda] Am[Subscript[X, 1]] Coss[(m \[Pi] y)/B]) + > E^(I km Subscript[X, 0] - > I \[Lambda] Subscript[X, > 0]) (1/2 I kz^2 Am[Subscript[X, 1]] Coss[(m \[Pi] y)/B] - > 1/2 I km \[Lambda] Am[Subscript[X, 1]] Coss[(m \[Pi] y)/B]) + > E^(I kn Subscript[X, 0] + > I \[Lambda] Subscript[X, > 0]) (-(1/2) I kz^2 An[Subscript[X, 1]] Coss[(n \[Pi] y)/B] - > 1/2 I kn \[Lambda] An[Subscript[X, 1]] Coss[(n \[Pi] y)/B]) + > E^(I kn Subscript[X, 0] - > I \[Lambda] Subscript[X, > 0]) (1/2 I kz^2 An[Subscript[X, 1]] Coss[(n \[Pi] y)/B] - > 1/2 I kn \[Lambda] An[Subscript[X, 1]] Coss[(n \[Pi] y)/B]) + > E^(I km Subscript[X, 0]) Coss[(m \[Pi] y)/B] > \!\(\*SuperscriptBox["Bm", "\[Prime]", > MultilineFunction->None]\)[0] + > E^(I kn Subscript[X, 0]) Coss[(n \[Pi] y)/B] > \!\(\*SuperscriptBox["Bn", "\[Prime]", > MultilineFunction->None]\)[0] > > I want to extract terms that contain E^(I km Subscript[X, 0]) only and > I need this to be done automatically. I appreciate any help in this > regard. > > > HMQ > Hi, say the variable "expr" holds your expression; then Cases[ExpandAll[expr /. E^(s_Plus) :> Times[Exp /@ s]], c_.*E^(I*km*Subscript[X, 0])] gives you a list: { E^(I*km*Subscript[X,0])*Coss[(m*Pi*y)/B], (-I)*E^(I*km*Subscript[X, 0])*km*\[Lambda]* Am[Subscript[X, 1]]*Coss[(m*Pi*y)/B] } Peter |