This is a substitution. `subs` will replace symbols in an expression with 
different expressions. The syntax is `expr.subs(old, new)` or 
`expr.subs({oldi: newi})` or `expr.subs([(old1, new1), (old2, new2), 
...])`. You can read about the different forms with `help(Expr.subs)`.

    >>> eqs = Eq(a, x + y), Eq(b, x*y)

Examples of converting eqs to dict or list for subs

    >>> dict([i.args for i in eqs])
    {a: x + y, b: x*y}
    >>> [i.args for i in eqs]
    [(a, x + y), (b, x*y)]

Using one of those forms to do the substitution:

    >>> (a*b).subs(_)
    x*y*(x + y)



On Monday, July 8, 2019 at 9:11:37 PM UTC-5, Gary Pajer wrote:
>
> I'm sure I'm not the first person having trouble getting started.  If 
> there is a good tutorial, more detailed than the sympy docs tutorial, 
> please point me to it!
>
> I want to display the product of two expressions.  Suppose I have
>
> a, b, x, y = symbols('a b x y')
> ex1 = Eq(a, x + y)
> ex2 = Eq(b, x * y)
>
> How do I display a * b in terms of x and y?
>
> Thainks.
>

-- 
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 sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
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/90c195f4-6cde-4d19-b389-df16d2dee15d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to