Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Using Collect in functions, Mathematica

  1. Oct 27, 2011 #1
    Hello!:

    I want to know if it's possible to use the Collect command in a function. For example, I have this code:


    Subscript[E, 1] = \!\(
    \*SubscriptBox[\(\[PartialD]\),
    SubscriptBox[\(\[Omega]\), \(1\)]]
    \*SubscriptBox[\(\[Pi]\), \(m1\)]\);
    Subscript[E, 2] = \!\(
    \*SubscriptBox[\(\[PartialD]\),
    SubscriptBox[\(\[Omega]\), \(2\)]]
    \*SubscriptBox[\(\[Pi]\), \(m2\)]\);

    osol = Solve[
    Subscript[E, 1] == 0 && Subscript[E, 2] == 0, {Subscript[\[Omega],
    1], Subscript[\[Omega], 2]}];

    (*Solucion*)
    Subscript[\[Omega], 1] = Subscript[\[Omega], 1] /. osol[[1, 1]];
    Subscript[\[Omega], 2] = Subscript[\[Omega], 2] /. osol[[1, 2]];

    And I want [\[Omega], 1] to be factorized by \gamma and \beta, because the expresion that mathematica gives to me it's huge. So I would like to do something like:
    Collect[Subscript[\[Omega], 1] = Subscript[\[Omega], 1] /. osol[[1, 1]];,{β,γ}]

    I apologize for my English. I'm from Chile =)

    Thank you very much.
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted