Message Boards Message Boards

0
|
7489 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Is it possible to remove terms dependent on a specific variable?

Posted 10 years ago

Hello, my name is inkwan.

I'm so glad to find here since I just started to learn how to use Mathematica.

I'm trying to separate terms in an expression to two parts based on dependency on a specific variable. When the expression was short, it was possible for me to pick terms by hand. However, the expression is getting even complicated and impossible for me to pick terms I want to get.

What I want to do is to remove terms explicitly dependent on 'f' in an attached expression. For instance, I'd like to remove terms such as " (constant)*Cos[3f+4g]."

Here is an example which I've met. Could anyone give me some help to solve this problem?

    (8 (-1 + 5 c^2) (3 Cos[ 2 (g + f)] + (3 Cos[2 g + f] + Cos[2 g + 3 f]) e) s^2 [Eta]^5 
+ 1/e 2 (1 + Cos[f] e)^4 (-4 s^2 Sin[2 (g + f)] 
+ e (2 Sin[f] - 6 c^2 Sin[f] + s^2 (Sin[2 g + f] - 5 Sin[2 g + 3 f]))) (-4 Sin[f] + 12 Cos[2 (g + f)] s^2 Sin[f] 
+ 2 Cos[f]^2 e^2 (-1 + 3 Cos[2 (g + f)] s^2) Sin[f] + 3 e (-1 + 3 Cos[2 (g + f)] s^2) Sin[2 f] - 2 Sin[f] [Eta]^2 + 3 s^2 Sin[2 g 
+ f] [Eta]^2 + s^2 Sin[2 g + 3 f] [Eta]^2 + 6 c^2 Sin[f] (2 + 3 Cos[f] e + Cos[f]^2 e^2 + [Eta]^2)) 
+ 8 (-1 + 3 c^2) [Eta]^3 (-1 + 3 Cos[2 (g + f)] s^2 + 3 Cos[f] e (-1 + 3 Cos[2 (g + f)] s^2) + 3 Cos[f]^2 e^2 (-1 + 3 Cos[2 (g + f)] s^2) 
+ Cos[f]^3 e^3 (-1 + 3 Cos[2 (g + f)] s^2) + [Eta]^3 + 3 c^2 (1 + 3 Cos[f] e + 3 Cos[f]^2 e^2 + Cos[f]^3 e^3 - [Eta]^3)) 
+ 1/e 8 (1 + Cos[f] e)^2 (2 e Sin[ f] (-Sin[f] + 3 c^2 Sin[f] + 3 s^2 Sin[2 g + 3 f]) + 1/4 e^2 Sin[ 2 f] (-2 Sin[f] + 6 c^2 Sin[f] 
+ s^2 (-Sin[2 g + f] + 5 Sin[2 g + 3 f])) + (1 - 3 c^2) Cos[ f] [Eta]^2 + s^2 (4 Sin[f] Sin[2 (g + f)] 
- 3 Cos[f] Cos[2 (g + f)] [Eta]^2)) (-1 + 3 Cos[2 (g + f)] s^2 + 3 Cos[f] e (-1 + 3 Cos[2 (g + f)] s^2) 
+ 3 Cos[f]^2 e^2 (-1 + 3 Cos[2 (g + f)] s^2) + Cos[f]^3 e^3 (-1 + 3 Cos[2 (g + f)] s^2) + [Eta]^3 + 3 c^2 (1 + 3 Cos[f] e 
+ 3 Cos[f]^2 e^2 + Cos[f]^3 e^3 - [Eta]^3)) + 1/e (1 + Cos[f] e)^2 (3 Cos[ 2 (g + f)] + (3 Cos[2 g + f] 
+ Cos[2 g + 3 f]) e) s^2 [Eta]^2 (2 Cos[ f] e^2 (-2 (3 + Cos[2 f]) + c^2 (26 + 6 Cos[2 f] - 8 Cos[2 (g + f)]) 
+ (Cos[2 g] + 18 Cos[2 (g + f)] + 5 Cos[2 (g + 2 f)]) s^2) + 8 e (c^2 (5 + 3 Cos[2 f] - 2 Cos[2 (g + f)]) 
- 2 Cos[f] (Cos[f] - 3 Cos[2 g + 3 f] s^2)) + 4 (2 (-1 + 3 c^2) Cos[f] [Eta]^2 + s^2 (-8 Sin[f] Sin[2 (g + f)] 
+ 6 Cos[f] Cos[2 (g + f)] [Eta]^2))) + 1/e 2 (1 + Cos[f] e)^3 s^2 Sin[ 2 (g + f)] [Eta]^2 (-6 e (-4 l + 4 f 
+ 3 s^2 Sin[2 g] + 2 Sin[2 f] - 6 s^2 Sin[2 (g + f)] + c^2 (20 l - 20 f - 6 Sin[2 f] + 4 Sin[2 (g + f)]) - 3 s^2 Sin[2 (g + 2 f)]) 
+ e^2 (-2 (13 Sin[f] + Sin[3 f] + c^2 (-63 Sin[f] - 3 Sin[3 f] + 12 Sin[2 g + f] + 4 Sin[2 g + 3 f])) + 3 s^2 (-Sin[2 g - f] 
+ 11 Sin[2 g + f] + 5 Sin[2 g + 3 f] + Sin[2 g + 5 f])) + 4 (-2 Sin[f] (2 + [Eta]^2) + 6 c^2 Sin[f] (2 + [Eta]^2) 
+ s^2 (12 Cos[2 (g + f)] Sin[ f] + (3 Sin[2 g + f] + Sin[2 g + 3 f]) [Eta]^2))))

Thank you very much and have a wonderful month!!

:: Inkwan

POSTED BY: inkwan Park
2 Replies
Posted 10 years ago

Hello, Alexei. I appreciate your help. It works perfectly, I can completely remove terms depend on "f."

Have a wonderful month and take care!

Best regards,

:: Inkwan

POSTED BY: inkwan Park

Hi, Inkwan, Your expression contains a syntax error. It is not possible to use the expressions like [Eta], [Eta]^2 etc., since the square brackets are reserved to only be used for arguments of functions. So I did not use you whole example, but a part of it to which I added two f-independent terms:

expr = 8 (-1 + 
     5 c^2) (3 Cos[
       2 (g + f)] + (3 Cos[2 g + f] + Cos[2 g + 3 f]) e) s^2 Eta^5 + 
  Sin[g] + Cos[c]

Now, try this:

 Select[(expr // Expand), FreeQ[#, f] &]

(*    Cos[c] + Sin[g]  *)

Have fun!

POSTED BY: Alexei Boulbitch
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract