The first things that come to mind are to see if e.extract_additively(s) or
factor(e).extract_multiplicatively(s). There was some discussion about
unification of expression at
https://groups.google.com/forum/#!searchin/sympy/smichr/sympy/wNJ8gZJv4Yo/slYc5XbnhJUJ,
too.
On Friday, August 22, 2014 6:38:36 PM UTC-5, Ondřej Čertík wrote:
>
> Hi,
>
> We have the following problem: given a (complicated) expression "e",
> and a set of known expressions s1, s2, s3, ..., we would like to
> rewrite "e", so that it can be written in terms of any subset of s1,
> s2, s3, ..... Some examples:
>
> e = x^2+2*x*y+z^2
> s1 = x+y
>
> then we would like to get e == s1^2. Or:
>
> e = a*x+a*y
> s1 = x+y
>
> then e == a*s1.
>
> Actually, what we really need is given an integral, like this (much
> more complicated in practice):
>
> e = c*Integral(x**2, (x, a, b))
> s1 = Integral(y**2, (y, a, b))
>
> then it would give me e==c*s1. Notice the different dummy variable.
> Here is another example, it would be able to recognize variable
> substitutions:
>
> e = c*Integral(x**2, (x, a, b))
> s1 = Integral(sin(y)**2, (y, asin(a), asin(b)))
> # I hope I substituted correctly
>
> The goal is to have a large database of known expressions s1, s2, s3,
> ... s10000, and then if given a new expression, SymPy would be able to
> figure out a way to write it in terms of them (I understand that it
> might not always succeed).
>
> This came up when discussing a particular application with Wang-Kong,
> a colleague of mine at LANL. It would be used in condensed matter
> physics, regarding conductivity calculations, that it would be nice to
> write expressions for new materials ("e") in terms of known ones ("s1,
> s2, ...").
>
> Ondrej
>
--
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 http://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/69954a61-c1c2-43ce-a4fa-9cd753f6ef53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.