Modelica.Math.Special.{der(erf), der(erfc)}#4753
Open
AHaumer wants to merge 1 commit intomodelica:masterfrom
Open
Modelica.Math.Special.{der(erf), der(erfc)}#4753AHaumer wants to merge 1 commit intomodelica:masterfrom
AHaumer wants to merge 1 commit intomodelica:masterfrom
Conversation
casella
reviewed
Mar 2, 2026
Contributor
casella
left a comment
There was a problem hiding this comment.
@AHaumer, in the testing, we need to prove that the derivatives provided by the derivative annotation are very precise. Reference signals are not good for that, because CSV-compare if rather tolerant.
I would suggest to remove the comparison signals entirely, and instead
- select a much tighter tolerance, e.g 1e-9, for the simulation of TestErf
- add two asserts in the equation section of the TestErf such as
assert(abs(y1i - y1) < 1e-7, "The derivative function for erf is not correct");
assert(abs(y2i - y2) < 1e-7, "The derivative function for erfc is not correct");If the test model runs successfully, then by construction it means the derivative is computed with high accuracy.
Contributor
|
And also add |
Contributor
Author
|
@casella @HansOlsson I integrated your recommendations, but I kept 2 comparison signals. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I noticed that the derivatives of erf and erfc are missing but can be easily defined.
Important if using erf in model equations or for index reduction, since erf is non-trivial.
Although it's a bug if one needs the derivative this is an enhancement.