Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could AccumBounds use maximum/minimum? #20357

Open
asmeurer opened this issue Oct 29, 2020 · 2 comments
Open

Could AccumBounds use maximum/minimum? #20357

asmeurer opened this issue Oct 29, 2020 · 2 comments
Labels

Comments

@asmeurer
Copy link
Member

We have

>>> limit(sin(x) + cos(x), x, oo)
AccumBounds(-2, 2)

But it is actually limited by +/-sqrt(2). The maximum and minimum functions can compute this:

>>> maximum(sin(x) + cos(x), x)
sqrt(2)
>>> minimum(sin(x) + cos(x), x)
-sqrt(2)

Can we use this in the general case?

Also, sin(oo) + cos(oo) has the same problem, but fixing that would be harder, because it's basically AccumBounds(1, 1) + AccumBounds(1, 1).

@oscarbenjamin
Copy link
Contributor

Perhaps related is a recent SO question asking to be able to merge linear combinations of sin and cos having the same frequency but different amplitude and phase. There doesn't seem to be a sympy function for that:
https://stackoverflow.com/questions/64481861/python-sympy-superposition-of-several-waves

@asmeurer
Copy link
Member Author

minimum and maximum just take the derivative and set it equal to 0. But I guess it fails for more complicated examples, like the one in the SO question. So maybe such a function could be used inside of solve to help it there, if it isn't good enough for such cases already. Or maybe there's a more general way to improve solve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants