I think you meant to do this:

expr = ....
com_sub_exprs, simplified_expr = cse(expr)
new_expr = do_operations_on(simplified_expr)
com_sub_exprs, simpflied_new_expr = cse(new_expr.subs(dict(com_sub_exprs))

If so, seems like you have to cse the same set of sub expressions twice.

moorepants.info
+01 530-601-9791


On Wed, Nov 4, 2020 at 9:47 PM Aaron Meurer <[email protected]> wrote:

> I'm not clear, what work would it have to do twice?
>
> Aaron Meurer
>
> On Wed, Nov 4, 2020 at 1:45 PM Jason Moore <[email protected]> wrote:
> >
> > I could do that, but for very long expressions this means cse has to do
> the work twice. This can be time consuming for long expressions.
> >
> > Jason
> > moorepants.info
> > +01 530-601-9791
> >
> >
> > On Wed, Nov 4, 2020 at 9:33 PM Aaron Meurer <[email protected]> wrote:
> >>
> >> Is it just a question of replacing the old cse symbols in the new
> >> expression before calling cse, then merging the results? I think that
> >> wouldn't be hard, though probably complicated enough that direct
> >> support could be added.
> >>
> >>
> >> Aaron Meurer
> >>
> >> On Wed, Nov 4, 2020 at 11:40 AM Jason Moore <[email protected]>
> wrote:
> >> >
> >> > Hi,
> >> >
> >> > I'd like to be able to do something like this:
> >> >
> >> > expr = ....
> >> > com_sub_exprs, simplified_expr = cse(expr)
> >> > new_expr = do_operations_on(simplified_expr)
> >> > com_sub_exprs, simpflied_new_expr = cse(new_expr,
> start_with=com_sub_exprs)
> >> >
> >> > This would let the cse() of new_expr use the existing set of sub
> expressions as the starting set and add more as needed, as those
> subexpression may exist in new_expr.
> >> >
> >> > Is there a way to do this with existing functionality or would I need
> to add this "start_with" piece to cse() as a new feature?
> >> >
> >> > Thanks,
> >> >
> >> > Jason
> >> > moorepants.info
> >> > +01 530-601-9791
> >> >
> >> > --
> >> > 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/CAP7f1AgCh2yqarPodb-EhZ8X_Gp7SxuscDo57jSkLt371y9swQ%40mail.gmail.com
> .
> >>
> >> --
> >> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/CAKgW%3D6J3mtqLU%3DG6y%2BzrAX_oq8DLTqPfTj%2Bp3_cP36Ub_qk8%3DA%40mail.gmail.com
> .
> >
> > --
> > 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/CAP7f1AjH4ncRALDnK2c%3DZW%2BTGeXcQDHa1M-XDSHur3QqvTDV2A%40mail.gmail.com
> .
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/CAKgW%3D6LSobhOPTxEZWjrknJ%3DwXe7ggRBb50MN6epJvOOSNFkog%40mail.gmail.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAP7f1Ah4dWVcQyWuscnXkb0H6MC51MReGR-OBpPmUODS_AdDPA%40mail.gmail.com.

Reply via email to