Collecting terms in mathematica

In summary, the person is trying to collect terms in their expression that have poles in the denominator, specifically (x-1) and (y-1). They have tried using the Select function in Mathematica to pick out these terms.
  • #1
dimwatt
8
0
I have an integrand with a handful of terms, and some of them have poles in the denominator of the form (x+c) (but not all). There are three poles in total, and I want to collect all the terms according to each pole individually (eg all the terms with (x-1) in the denominator, (x-5), etc.)

How could I do this? I tried using collect just to see if mathematica would make any rearrangements at all, but I'm not having much luck with it.
 
Physics news on Phys.org
  • #2
Without an example of what you have or what you have tried it is difficult to guess what to say.

Is this anything like what you want to do?

In[1]:= Collect[4/(x-g) + (a+b^2)/(x-f) + 2 q/(x-f) - 5/(x-f) - c/(x-g), {1/(x-f), 1/(x-g)}]

Out[1]= (-5 + a + b^2 + 2 q)/(-f + x) + (4 - c)/(-g + x)
 
  • #3
Hi Bill!

Sorry I should have been much more specific. Each term in my expression involves several products in their denominators, and of those terms, some of them have poles like (x-1) and (y-1) and sometimes both, like N/(x+1)(y+1)(x-1)... for example (this is a multi-dimensional integral). I'm a bit new to mathematica so my terminology or descriptions might be a bit weird.. but basically I have the expression in list form, and I found that, e.g.,

Select[expr, MemberQ[#[[2]], (-1 + x)] &]

(the [[2]] is just a detail regarding the arrangement of the list) picks out the terms I was looking for. Thanks!
 

1. What does it mean to "collect terms" in Mathematica?

Collecting terms in Mathematica means grouping together similar terms in an algebraic expression. This can help simplify the expression and make it easier to work with.

2. How do I collect terms in Mathematica?

To collect terms in Mathematica, you can use the Collect[expr,vars] function. This will group together terms that have the same powers of the specified variables.

3. Can I collect terms with different variables in Mathematica?

Yes, you can collect terms with different variables in Mathematica by using the Collect[expr,{vars1,vars2,...}] function. This will group together terms with the same powers of all the specified variables.

4. What if I want to collect terms with a specific coefficient in Mathematica?

If you want to collect terms with a specific coefficient, you can use the Coefficient[expr,vars] function. This will collect all the terms with the specified variables and coefficient.

5. Can I use the collected terms in further calculations?

Yes, the collected terms in Mathematica can be used in further calculations. They can be manipulated and simplified using the various mathematical functions available in Mathematica.

Similar threads

Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
829
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
450
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
Back
Top