Display a specific part of an output?

Posted 5 months ago
479 Views
|
5 Replies
|
2 Total Likes
|
 Hello,I have created a code that can expand an expression then groups the output in terms of exponential powers. My code deals with the Homotopy Analysis Method. In this method the goal is to collect secular terms. As my interest is only these terms I am inquiring to see if there is a way to tell Mathematica to display only these terms and not the rest of the expansion. Below is an image of the expansion and collection of terms. I just want the output to display e^(iwt). I've attached the code for reference. Any help is appreciated. Attachments:
5 Replies
Sort By:
Posted 5 months ago
 Perhaps the Cases function would do the job. I haven’t used it myself for this particular application, but I wonder whether something along the lines of Cases[your output expression, e^_ ] might give what you’re looking for? You may have to play around with the pattern to ensure its structure matches the elements of the expression that you’re aiming to extract. I’m not at my computer at the moment so can’t try it out. Hope his helps, IanHave now tried out the above and suggest the following.(1) name your long expression "expression".(2) Use the Cases function to extract all instances of E^Anything. Cases[expression, E^_, Infinity] (3) This gives...Which I think is what you're looking for?
Posted 5 months ago
 very nice Solution! I have treid it and got the same Result.
Posted 5 months ago
 I am looking for Mathematica to display the grouping of E^(iwtau) so the output would be output = e^(iwtau)*(.........................).
 Welcome to Wolfram Community! Please make sure you know the rules: https://wolfr.am/READ-1STThe rules explain how to format your code properly. If you do not format code, it may become corrupted and useless to other members. Please EDIT your post and make sure code blocks start on a new paragraph and look framed and colored like this. int = Integrate[1/(x^3 - 1), x]; Map[Framed, int, Infinity] 
 Is there a way for posters/contributors to show code samples in Standard Form? Reason I ask is that when I tried to copy and paste the original poster's equation into a Code Sample placeholder, it was automatically converted to what looks to me pretty much like FullForm. Which, in this case, isn't terribly easy to degroggle - compare the original poster's screenshot with the equivalent code sample shown below. If we're stuck with code samples only displaying the FullForm of expressions then perhaps for the case of more complex expressions a screenshot works better. Especially if the posting is accompanied by a notebook attachment that contains the expression(s) of interest. Just a thought... \[CapitalOmega]^2 Subscript[u, 1][\[Tau]] + \[CapitalOmega]^2 ( Subscript[u, 1]^\[Prime]\[Prime])[\[Tau]] == {-(1/2) c1 g1 \[Delta] Subscript[ c, 0] - 1/4 c2 E^(-2 I \[Sigma] \[Tau]) g2 \[Delta] A[\[Tau]] Subscript[c, 0] - 1/4 c4 E^(2 I \[Sigma] \[Tau] + 4 I \[Tau] \[Omega]) g4 \[Delta] A[\[Tau]]^3 Subscript[c, 0] - 1/4 c2 E^(2 I \[Sigma] \[Tau]) g2 \[Delta] B[\[Tau]] Subscript[c, 0] - c3 g3 \[Delta] A[\[Tau]] B[\[Tau]] Subscript[c, 0] - 3/4 c4 E^(-2 I \[Sigma] \[Tau]) g4 \[Delta] A[\[Tau]]^2 B[\[Tau]] Subscript[c, 0] - 3/4 c4 E^(2 I \[Sigma] \[Tau]) g4 \[Delta] A[\[Tau]] B[\[Tau]]^2 Subscript[c, 0] - 1/4 c4 E^(-2 I \[Sigma] \[Tau] - 4 I \[Tau] \[Omega]) g4 \[Delta] B[\[Tau]]^3 Subscript[c, 0] + E^(3 I \[Tau] \[Omega]) (-(1/4) c3 E^(2 I \[Sigma] \[Tau]) g3 \[Delta] A[\[Tau]]^2 Subscript[c, 0] - 1/2 c4 g4 \[Delta] A[\[Tau]]^3 Subscript[c, 0]) + E^(2 I \[Tau] \[Omega]) (-(1/4) c2 E^(2 I \[Sigma] \[Tau]) g2 \[Delta] A[\[Tau]] Subscript[c, 0] - 1/2 c3 g3 \[Delta] A[\[Tau]]^2 Subscript[c, 0] - 1/4 c4 E^(-2 I \[Sigma] \[Tau]) g4 \[Delta] A[\[Tau]]^3 Subscript[c, 0] - 3/4 c4 E^(2 I \[Sigma] \[Tau]) g4 \[Delta] A[\[Tau]]^2 B[\[Tau]] Subscript[c, 0]) + E^(-3 I \[Tau] \[Omega]) (-(1/4) c3 E^(-2 I \[Sigma] \[Tau]) g3 \[Delta] B[\[Tau]]^2 Subscript[c, 0] - 1/2 c4 g4 \[Delta] B[\[Tau]]^3 Subscript[c, 0]) + E^(-2 I \[Tau] \[Omega]) (-(1/4) c2 E^(-2 I \[Sigma] \[Tau]) g2 \[Delta] B[\[Tau]] Subscript[c, 0] - 1/2 c3 g3 \[Delta] B[\[Tau]]^2 Subscript[c, 0] - 3/4 c4 E^(-2 I \[Sigma] \[Tau]) g4 \[Delta] A[\[Tau]] B[\[Tau]]^2 Subscript[c, 0] - 1/4 c4 E^(2 I \[Sigma] \[Tau]) g4 \[Delta] B[\[Tau]]^3 Subscript[c, 0]) + E^(I \[Tau] \[Omega]) (-(1/4) c1 E^(2 I \[Sigma] \[Tau]) g1 \[Delta] Subscript[c, 0] - 1/2 c2 g2 \[Delta] A[\[Tau]] Subscript[c, 0] - 1/4 c3 E^(-2 I \[Sigma] \[Tau]) g3 \[Delta] A[\[Tau]]^2 Subscript[c, 0] - 1/2 c3 E^(2 I \[Sigma] \[Tau]) g3 \[Delta] A[\[Tau]] B[\[Tau]] Subscript[c, 0] - 3/2 c4 g4 \[Delta] A[\[Tau]]^2 B[\[Tau]] Subscript[c, 0] + I g2 \[Omega] A[\[Tau]] Subscript[c, 0] SuperStar[b] + 2 I g2 \[Omega] Subscript[c, 0] Derivative[1][A][\[Tau]] + g2 Subscript[c, 0] SuperStar[b] Derivative[1][A][\[Tau]] + g2 Subscript[c, 0] (A^\[Prime]\[Prime])[\[Tau]]) + E^(-I \[Tau] \[Omega]) (-(1/4) c1 E^(-2 I \[Sigma] \[Tau]) g1 \[Delta] Subscript[c, 0] - 1/2 c2 g2 \[Delta] B[\[Tau]] Subscript[c, 0] - 1/2 c3 E^(-2 I \[Sigma] \[Tau]) g3 \[Delta] A[\[Tau]] B[\[Tau]] Subscript[c, 0] - 1/4 c3 E^(2 I \[Sigma] \[Tau]) g3 \[Delta] B[\[Tau]]^2 Subscript[c, 0] - 3/2 c4 g4 \[Delta] A[\[Tau]] B[\[Tau]]^2 Subscript[c, 0] - I g2 \[Omega] B[\[Tau]] Subscript[c, 0] SuperStar[b] - 2 I g2 \[Omega] Subscript[c, 0] Derivative[1][B][\[Tau]] + g2 Subscript[c, 0] SuperStar[b] Derivative[1][B][\[Tau]] + g2 Subscript[c, 0] (B^\[Prime]\[Prime])[\[Tau]])}