mithun218 / GiNaCDE

GiNaC Differential Equation Solver
MIT License
9 stars 1 forks source link

Make `desolve` return a function expression #2

Open peanutfun opened 2 years ago

peanutfun commented 2 years ago

Description

The main feature of GiNaCDE is the desolve function which solves a given differential equation. However, this function does not return the resulting GiNaC expression ex, but only an integer status. The expression is written to a file and discarded. This severely hampers the usability of the GiNaCDE library, as the result of desolve cannot be used within a program for further computations (e.g., evaluating it, integrating it over an interval, ...).

Is there maybe a technical reason why the result is not also returned by the function?

Proposal

Make desolve return the solved expression, or throw an exception if there was an error.

Related issues

openjournals/joss-reviews#3885

mithun218 commented 2 years ago

@peanutfun Thanks for your valuable observations. It is correct that GiNaCDE does not return the results in GiNaC expression ex. But, GiNaCDE returns its results through the variables solutionClt and constraints. One can use the results collected by the variables solutionClt and constraints for further computations within a program. Please let us know, is this enough?

peanutfun commented 2 years ago

I'm sorry, I missed these global return variables on my first go through your program. I think they suffice, but it might be worth considering not to have them as global variables, but only local variables that are returned by the desolve function. This would work well in conjunction with my proposal in #11. With a class encapsulation, you can define all these variables locally. I'll leave the decision up to you, feel free to close this issue!