Factor multiple terms in mathematica

In summary, the conversation is about trying to factor out terms in a long equation using Mathematica 7. The person has tried using the Collect function but it did not work. They also shared an equation in input form for the other person to try and play with. The other person suggested making sure the xy parts have spaces and using the Expand function. The conversation then delves into different methods and code to try and solve the problem.
  • #1
micrain
3
0
Hello, I have a long equation
2hhpsop.jpg
and using Mathematica 7 I want to factor out terms such as x,y,xy, x^2y,xy^2, etc. so that I'll have it in a form similar to
a + b*x + c*y + d*(xy) + e*(x^2y) + f*(xy^2) + ...
I've tried using the Collect by passing {1,x,y,xy,x^2y,x y^2,...} as the terms to be collected but haven't been successful, I'd appreciate any help!

Thanks!
 
Physics news on Phys.org
  • #2
Do you have that equation in Input form so I can play with it?

Also, have you tried just Expand[%]?
 
  • #3
Hepth said:
Do you have that equation in Input form so I can play with it?
Here you go:
{1, x, y, x^2, y^2, xy, x^3, x^2 y, xy^2,
y^3}.{{Subscript[q, 11], Subscript[q, 12], Subscript[q, 13],
Subscript[q, 14], Subscript[q, 15], Subscript[q, 16],
Subscript[q, 17], Subscript[q, 18], Subscript[q, 19],
Subscript[q, 110]},
{Subscript[q, 12], Subscript[q, 22], Subscript[q, 23],
Subscript[q, 24], Subscript[q, 25], Subscript[q, 26],
Subscript[q, 27], Subscript[q, 28], Subscript[q, 29],
Subscript[q, 210]},
{Subscript[q, 13], Subscript[q, 23], Subscript[q, 33],
Subscript[q, 34], Subscript[q, 35], Subscript[q, 36],
Subscript[q, 37], Subscript[q, 38], Subscript[q, 39],
Subscript[q, 310]},
{Subscript[q, 14], Subscript[q, 24], Subscript[q, 34],
Subscript[q, 44], Subscript[q, 45], Subscript[q, 46],
Subscript[q, 47], Subscript[q, 48], Subscript[q, 49],
Subscript[q, 410]},
{Subscript[q, 15], Subscript[q, 25], Subscript[q, 35],
Subscript[q, 45], Subscript[q, 55], Subscript[q, 56],
Subscript[q, 57], Subscript[q, 58], Subscript[q, 59],
Subscript[q, 510]},
{Subscript[q, 16], Subscript[q, 26], Subscript[q, 36],
Subscript[q, 46], Subscript[q, 56], Subscript[q, 66],
Subscript[q, 67], Subscript[q, 68], Subscript[q, 69],
Subscript[q, 610]},
{Subscript[q, 17], Subscript[q, 27], Subscript[q, 37],
Subscript[q, 47], Subscript[q, 57], Subscript[q, 67],
Subscript[q, 77], Subscript[q, 78], Subscript[q, 79],
Subscript[q, 710]},
{Subscript[q, 18], Subscript[q, 28], Subscript[q, 38],
Subscript[q, 48], Subscript[q, 58], Subscript[q, 68],
Subscript[q, 78], Subscript[q, 88], Subscript[q, 89],
Subscript[q, 810]},
{Subscript[q, 19], Subscript[q, 29], Subscript[q, 39],
Subscript[q, 49], Subscript[q, 59], Subscript[q, 69],
Subscript[q, 79], Subscript[q, 89], Subscript[q, 99],
Subscript[q, 910]},
{Subscript[q, 110], Subscript[q, 210], Subscript[q, 310],
Subscript[q, 410], Subscript[q, 510], Subscript[q, 610],
Subscript[q, 710], Subscript[q, 810], Subscript[q, 910],
Subscript[q,
1010]}} .{{1}, {x}, {y}, {x^2}, {y^2}, {xy}, {x^3}, {x^2 y},
{xy^2}, {y^3}}

Hepth said:
Also, have you tried just Expand[%]?
Unfortunately, I've tried it without success.

Thanks for the help!
 
  • #4
Well, #1 your :
{1, x, y, x^2, y^2, xy, x^3, x^2 y, xy^2,
y^3}
the xy parts need to have spaces "xy"-> "x y" or xy is a new variable.

Also, the second vector, why do you have the double {{},{},{},..}

Third, how about :

Code:
f = {1, x, y, x^2, y^2, x y, x^3, x^2 y, x y^2, 
    y^3}.{{Subscript[q, 11], Subscript[q, 12], Subscript[q, 13], 
     Subscript[q, 14], Subscript[q, 15], Subscript[q, 16], 
     Subscript[q, 17], Subscript[q, 18], Subscript[q, 19], 
     Subscript[q, 110]}, {Subscript[q, 12], Subscript[q, 22], 
     Subscript[q, 23], Subscript[q, 24], Subscript[q, 25], 
     Subscript[q, 26], Subscript[q, 27], Subscript[q, 28], 
     Subscript[q, 29], Subscript[q, 210]}, {Subscript[q, 13], 
     Subscript[q, 23], Subscript[q, 33], Subscript[q, 34], 
     Subscript[q, 35], Subscript[q, 36], Subscript[q, 37], 
     Subscript[q, 38], Subscript[q, 39], 
     Subscript[q, 310]}, {Subscript[q, 14], Subscript[q, 24], 
     Subscript[q, 34], Subscript[q, 44], Subscript[q, 45], 
     Subscript[q, 46], Subscript[q, 47], Subscript[q, 48], 
     Subscript[q, 49], Subscript[q, 410]}, {Subscript[q, 15], 
     Subscript[q, 25], Subscript[q, 35], Subscript[q, 45], 
     Subscript[q, 55], Subscript[q, 56], Subscript[q, 57], 
     Subscript[q, 58], Subscript[q, 59], 
     Subscript[q, 510]}, {Subscript[q, 16], Subscript[q, 26], 
     Subscript[q, 36], Subscript[q, 46], Subscript[q, 56], 
     Subscript[q, 66], Subscript[q, 67], Subscript[q, 68], 
     Subscript[q, 69], Subscript[q, 610]}, {Subscript[q, 17], 
     Subscript[q, 27], Subscript[q, 37], Subscript[q, 47], 
     Subscript[q, 57], Subscript[q, 67], Subscript[q, 77], 
     Subscript[q, 78], Subscript[q, 79], 
     Subscript[q, 710]}, {Subscript[q, 18], Subscript[q, 28], 
     Subscript[q, 38], Subscript[q, 48], Subscript[q, 58], 
     Subscript[q, 68], Subscript[q, 78], Subscript[q, 88], 
     Subscript[q, 89], Subscript[q, 810]}, {Subscript[q, 19], 
     Subscript[q, 29], Subscript[q, 39], Subscript[q, 49], 
     Subscript[q, 59], Subscript[q, 69], Subscript[q, 79], 
     Subscript[q, 89], Subscript[q, 99], 
     Subscript[q, 910]}, {Subscript[q, 110], Subscript[q, 210], 
     Subscript[q, 310], Subscript[q, 410], Subscript[q, 510], 
     Subscript[q, 610], Subscript[q, 710], Subscript[q, 810], 
     Subscript[q, 910], Subscript[q, 1010]}}.{1, x, y, x^2, y^2, x y, 
    x^3, x^2 y, x y^2, y^3};
CoefficientList[Expand[f], {x, y}]
F[i_, j_] := CoefficientList[Expand[f], {x, y}][[i+1]][[j+1]];
F[1, 3]

So it makes an array of the coefficients of the powers of x and y. So F[1,3] would be whatever is in front of x y^3.
 
  • #5
Thanks!
 

What is the purpose of factoring multiple terms in Mathematica?

The purpose of factoring multiple terms in Mathematica is to simplify algebraic expressions by breaking them down into smaller, more manageable parts. This can make it easier to perform calculations and solve equations.

How do I factor multiple terms in Mathematica?

To factor multiple terms in Mathematica, you can use the built-in function Factor. Simply input the expression you want to factor and press enter. Mathematica will then display the factored form of the expression.

Can I factor only certain terms in an expression?

Yes, you can specify which terms you want to factor by using the FactorTerms option in the Factor function. This allows you to factor specific terms while leaving others unchanged.

What is the difference between factoring and expanding an expression?

Factoring an expression involves breaking it down into smaller parts, while expanding an expression involves combining smaller parts to form a larger expression. Factoring is the reverse process of expanding, and both techniques are commonly used in algebraic manipulation.

Can I factor expressions with variables and exponents in Mathematica?

Yes, Mathematica can factor expressions with variables and exponents. It uses symbolic manipulation to handle these types of expressions and can factor them just like it would with numerical expressions.

Similar threads

Replies
8
Views
1K
  • Differential Equations
Replies
2
Views
917
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • Calculus and Beyond Homework Help
Replies
3
Views
1K
  • Calculus and Beyond Homework Help
Replies
9
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • Precalculus Mathematics Homework Help
Replies
2
Views
699
  • Advanced Physics Homework Help
Replies
1
Views
698
  • Linear and Abstract Algebra
Replies
4
Views
2K
  • General Math
Replies
3
Views
970
Back
Top