I think you are looking for pattern matching.
http://docs.sympy.org/dev/modules/core.html#sympy.core.basic.Basic.match

Aaron Meurer

On Fri, Nov 4, 2016 at 5:25 PM, Nathan Thern <[email protected]> wrote:
> I have performed a long series of symbolic calculations to arrive at an
> expression:
>
> (xaa*(-λaa - λab + 1) - xaa + xab*λaa + xac*λab)
> /
> sqrt((-xaa*(-λaa - λab + 1) - xab*λaa - xac*λab + xba*(-λba - λbb + 1) +
> xbb*λba + xbc*λbb)**2 +
>      (-yaa*(-λaa - λab + 1) - yab*λaa - yac*λab + yba*(-λba - λbb + 1) +
> ybb*λba + ybc*λbb)**2 +
>      (-zaa*(-λaa - λab + 1) - zab*λaa - zac*λab + zba*(-λba - λbb + 1) +
> zbb*λba + zbc*λbb)**2)
>
>
> which is of the form
>
> (F*λab + G)/sqrt(A*λab**2 + B*λab + C)
>
> Given the input, how do I assign the right expressions to A,B,C,F & G?
>
> This seems like a common theme for a newbie question, and I'm sorry if it's
> been asked before; but I couldn't find anything in this list that helped me.
> I'd rather have a few hints or pointers to the right place in the manual
> than a complete solution.
>
> thanks,
> NT
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/134c2253-a5a4-4102-993e-2029604b0c09%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6J1%3DiFY28z%2B%3DZX0JZb20eS2gkxf3WHiN-6QBoXd%3DTURsg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to