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

smoothMin and smoothMax documentation addition (see also buildings-issue #3262) #1726

Open
RouvenZ opened this issue Apr 6, 2023 · 0 comments
Assignees

Comments

@RouvenZ
Copy link

RouvenZ commented Apr 6, 2023

Hello all, hello @EttoreZ,

as requested in the buildings-library issue #3262, I opened the issue here as well (a bit belatedly, please excuse!).

As mentioned, for some implementations it is necessary to cap values (say a variable x) smoothly (over an interval dx) and additionally to not have them move out of bounds, especially not above (for smoothMin) or below the cap s (for smoothMax).

The smoothness requirement for regStep introduces an overshooting (for smoothMin) or undershooting behaviour (for smoothMax), making it necessary for the cap and the higher/lower bound for a value to differ. While there is a remark within the docu for Examples.SmoothMin, that this can happen, it is not quantified there.

However, it is possible to quantify exactly at what value x the over-/undershooting happens and to what extent.

For smoothMin, the maximum overshoot happens at $x = s - \frac{1}{2} dx \cdot (1 - \sqrt{3})$ at a function value $f(x) = s + \frac{3}{16} (2 \sqrt{3}-3) \cdot dx \approx s + 0.09 \cdot dx$.
For smoothMax, the maximum overshoot happens at $x = s + \frac{1}{2} dx \cdot (1 - \sqrt{3})$ at a function value $f(x) = s - \frac{3}{16} (2 \sqrt{3}-3) \cdot dx \approx s - 0.09 \cdot dx$.

So I would suggest adding the following text snippets to the docu in order to not overcomplicate things and maintaining a safe distance to machine precision eps:
For smoothMin: If variable x1 is to be capped by its max-value s smoothly and without overshooting, write smoothMin(x1, s-0.1 * deltaX, deltaX).
For smoothMax: If variable x1 is to be capped by its min-value s smoothly and without undershooting, write smoothMin(x1, s+0.1 * deltaX, deltaX).

What do you think?

Thank you all for the amazing work on this library and have a nice day!

Cheers
Rouven

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

No branches or pull requests

2 participants