On Wed, Feb 28, 2024 at 2:23 PM Chris Smith wrote:
>
> > I might not be following
>
> Say a current test is `assert ans == 2*x + 2*y`. That isn't going to pass
> when distribution is off. I was imagining that there was some way you could
> write a decorator that would be able to convert that
> I might not be following
Say a current test is `assert ans == 2*x + 2*y`. That isn't going to pass
when distribution is off. I was imagining that there was some way you could
write a decorator that would be able to convert that to `assert f(ans) ==
f(2*x+2*y)` where `f` is something like
On Mon, Feb 26, 2024 at 1:54 PM Chris Smith wrote:
>
> It seems that the tests could be marked as passing for both forms to see
> where tests fail because a routine is broken. Broken routines could be fixed
> (as necessary) so they are not assuming distribution. Would the decorator
> need to
It seems that the tests could be marked as passing for both forms to see
where tests fail because a routine is broken. Broken routines could be
fixed (as necessary) so they are not assuming distribution. Would the
decorator need to be taken off routines once everything was passing?
Except for
I don't think we need to try to check the code for everywhere a
multiplication happens. We can rely on the tests sufficiently covering
the code.
So what you would do is set the global distribute flag to False, run
the tests, and see what fails. Then as you fix certain tests that are
broken, add a
In order to solve the issue incrementally, it seems like we would need to
identify every line where multiplication is used (on arguments that could
possibly be Number and Add) and have them call `Mul` with a
`distribute=True` option.
How to identify where the multiplication lines are located?
On Wed, Feb 21, 2024 at 4:09 PM Chris Smith wrote:
>
> > There is a distribute() context manager
>
> I had forgotten about that, thanks for the reminder!
We probably shouldn't advertise it too widely. Like I said, it's not
as bad as the evaluate() context manager, but it has some of the same
> There is a distribute() context manager
I had forgotten about that, thanks for the reminder!
/c
On Wednesday, February 21, 2024 at 4:39:22 PM UTC-6 Aaron Meurer wrote:
> There is a distribute() context manager which lets you disable
> automatic distribution, though it's not pretty:
>
> >>>
There is a distribute() context manager which lets you disable
automatic distribution, though it's not pretty:
>>> from sympy.core.parameters import distribute
>>> with distribute(False):
... print(expr.diff(t))
3*a*(t - t0)**2 + 2*b*(t - t0)
While this is less dangerous than the similar