Collecting denominators together with Mathematica

  • Mathematica
  • Thread starter anthony2005
  • Start date
  • Tags
    Mathematica
In summary, the conversation discusses a method for simplifying a long sum of rational functions into a desired form. The suggested method involves using the Mathematica software and using the functions "Together" and "Select" to group the terms by their denominators. This approach is more efficient and reliable compared to using the "Factor" or "Simplify" functions. The conversation concludes with the acknowledgement that there may be other methods, such as using "Collect," to achieve the same result.
  • #1
anthony2005
25
0
Hi all,
I have a very simple issue, but can't get round of it.

I have a long sum of rational functions, which is in the form for example

[itex]\frac{n_{1}}{d_{1}}+\frac{n_{2}}{d_{1}}+\frac{n_{3}}{d_{1}}+\frac{n_{4}}{d_{1}}+\frac{n_{5}}{d_{2}}+\frac{n_{6}}{d_{2}}+\frac{n_{7}}{d_{1}\cdot d_{2}}+\frac{n_{8}}{d_{1}\cdot d_{2}}+\frac{n_{9}}{d_{1}\cdot d_{2}} [/itex]

and I would like to put it in the form

[itex]\frac{n_{1}+n_{2}+n_{3}+n_{4}}{d_{1}}+\frac{n_{5}+n_{6}}{d_{2}}+\frac{n_{7}+n_{8}+n_{9}}{d_{1}\cdot d_{2}} [/itex]

If I use Factor or Simplify it would just put all over one single denominator [itex]d_{1}\cdot d_{2} [/itex], taking also so much time since my expression is huge.

Any help?
Thanks
 
Physics news on Phys.org
  • #2
Figuring out how and why this works will be an educational experience.

In[1]:= f=n1/d1+n2/d1+n3/d1+n4/d1+n5/d2+n6/d2+n7/(d1 d2)+n8/(d1 d2)+n9/(d1 d2);

In[2]:= Plus@@Map[Together[Select[f,Function[x, Denominator[x]==#]]]&,Union[Map[ Denominator,List@@f]]]

Out[2]= (n1 + n2 + n3 + n4)/d1 + (n5 + n6)/d2 + (n7 + n8 + n9)/(d1*d2)

Be careful with that, just in case some oddball input breaks it.
 
  • #3
Wow, it worked. Miracles are hidden in mathematica, but I'll figure out why it worked.
Thanks a lot.
 
  • #4
I always find ways to use Collect and get it to look right myself.

Collect[f /. {1/(d1*d2) -> 1/d1d2}, {d1, d2, d1d2}] /. d1d2 -> d1 d2

but the way above with mapping is much better and more robust.
 
  • #5


Dear fellow scientist,

Thank you for reaching out with your question. It sounds like you are trying to collect the denominators in a long sum of rational functions using Mathematica. This can be a tricky task, especially if your expression is large. Fortunately, there are a few strategies you can use to simplify the process and get the desired result.

One approach is to use the Collect function in Mathematica. This function allows you to collect terms with the same denominator and group them together. You can specify which variables you want to collect, in this case the denominators d_{1} and d_{2}. This will help simplify your expression and put it in the desired form.

Another option is to use the Together function, which will combine terms with common factors in the numerator and denominator. This can help reduce the number of terms in your expression and make it easier to manipulate.

I would also recommend breaking down your expression into smaller chunks and using the aforementioned functions on each chunk individually. This can help prevent Mathematica from taking a long time to process the entire expression at once.

I hope these suggestions help you achieve your desired result. Best of luck with your research!

Sincerely,
 

Related to Collecting denominators together with Mathematica

What is the purpose of collecting denominators together with Mathematica?

The purpose of collecting denominators together with Mathematica is to simplify and manipulate algebraic expressions involving fractions. This process can make the expressions easier to understand and work with, and can also help identify any potential errors or inconsistencies in the original expression.

How does Mathematica collect denominators together?

Mathematica uses its built-in algorithm and computational power to identify and collect common denominators in a given expression. It does this by finding the greatest common factor of the denominators and factoring it out of each term in the expression.

Can Mathematica collect denominators together in complex expressions?

Yes, Mathematica is capable of collecting denominators in both simple and complex expressions. It can handle expressions with multiple variables, exponents, and other mathematical operations.

Does collecting denominators together affect the accuracy of the expression?

No, collecting denominators together does not change the accuracy of the expression. It only simplifies the expression by reducing the number of terms and making it easier to work with.

Are there any limitations to collecting denominators together with Mathematica?

While Mathematica is a powerful tool for collecting denominators, it may not be able to simplify all expressions. Some expressions may be too complex or involve special cases that the algorithm cannot handle. In these cases, it is best to manually simplify the expression or seek assistance from a mathematician or expert in using Mathematica.

Similar threads

  • Calculus and Beyond Homework Help
Replies
6
Views
803
  • Precalculus Mathematics Homework Help
Replies
1
Views
1K
  • Precalculus Mathematics Homework Help
Replies
3
Views
2K
  • Precalculus Mathematics Homework Help
Replies
14
Views
1K
  • Precalculus Mathematics Homework Help
Replies
4
Views
1K
  • Precalculus Mathematics Homework Help
Replies
3
Views
1K
Replies
6
Views
1K
Replies
7
Views
1K
  • Precalculus Mathematics Homework Help
Replies
3
Views
2K
Replies
2
Views
472
Back
Top