-
Notifications
You must be signed in to change notification settings - Fork 1
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
Make tests actually check the computation results #3
Comments
@peanutfun Thanks for opening this issue. I have implemented it here. |
@mithun218 thanks for implementing the |
@peanutfun thanks for your quick response. However, in the README file, we have explained the procedure for verifying the solutions. Here we have been told to check the solutions manually using Finally, to check all the solutions successfully, we recommend to use Maple or Mathematica software instead of using the |
This is alright. However, a test that does not perform any checks is not a test. As I initially mentioned, it is not required to have a universal function that is able to check all GiNaCDE solutions. For the test cases where Also, this is independent from adding the new test cases that include the |
@mithun218, thank you for implementing my proposals. I did not realize you already finished working on it. I just checked out the latest #include <GiNaCDE.h>
int main()
{
const string DE = "Diff(u,x,2)+u^3*b+u*Diff(u,x,1)*a";
// Original solution (works)
string algebraic_solutions = "{g_0==0,a_01==0,a_00==0,b==-1/2*(a+g_1)*g_1,a_02==1/2*a+1/2*g_1}";
string solutions = "u = 2*(2*C_+(a+g_1)*x)^(-1)";
// Wrong solutions that still work
string solutions_2 = "u = 2*(2*C_+(a+g_1)*x)^(-2)"; // Wrong exponent
string solutions_3 = "u = 1 + 2*(2*C_+(a+g_1)*x)^(-2)"; // Additional summand
std::vector<string> solution_vec({solutions, solutions_2, solutions_3});
for (auto sol : solution_vec) {
ex ret = checkSolu(DE, sol, algebraic_solutions);
if(ret!=_ex0)
{
// We never end up here!
return -1;
}
}
return 0;
} |
@peanutfun Many many thanks for detecting this problem of the |
Very good, |
Description
The tests in this repository contain source files that solve certain differential equations and write the results into a file. However, the results themselves are not checked. As such, the tests only check if the differential equations can be solved without throwing an error, but this does not verify the the results are correct.
As stated in the
README.md
, the GiNaC library might not return the exact same output of an expression due to some unpredictable internal ordering of symbols. So it is unsafe to check the output file contents. However, one could evaluate the resulting expressions within the code. This would either require that the expressions are returned bydesolve
(see #2) or that a file reader is added, which reads the output files of GiNaCDE and returns a GiNaC expression that can be evaluated.Proposal
The tests should evaluate and this verify the results of
desolve
at least for few known values. This requires a way of retrieving the result as expressionex
.In the documentation of GiNaC I did not find a way to compare two expressions
ex
. However, one can numerically evaluate them withex::evalf
. If one knows the correct result of a differential equation, one could check for specific values like its roots.Related issues
desolve
result is not returned: Makedesolve
return a function expression #2The text was updated successfully, but these errors were encountered: