Course:CPSC312-2024/Integral Solver

From UBC Wiki
  • Authors: Parsa, Shih-Wei, Kevin

What is the problem?

We are trying to create an integral solver, such that given a derivative (dy/dx) and an initial condition (y0 = k) it will find both the anti-derivative and the integration constant ("+C"). The solver will support the integration of polynomial derivatives  (c0*x^0 + c1*x1^ + ... + cn*x^n), and we intend to explore the extent to which Prolog can be employed for implementing integration rules as well as the feasibility.

What is the something extra?

  • Colorized console UI using ANSI tags
  • Computation of definite integral: by specifying the expression to integrate, and the start and end of integration, the problem will output the result.
  • Solving initial-value problems: the program will finding a solution to a differential equation given both the derivative and specific initial conditions.

What did we learn from doing this?

  • Regarding the nature and tasks of our project, prolog works well for parsing input, since we aren't constrained to strings the way we would be if using other languages. Its unique type system and variable system lend itself well to simplifying complex input parsing.
  • However, while Prolog can manage symbolic computation efficiently, it requires extra effort in the portion of numerical computation, which is necessary for our something extra. In addition, our team attempted to tackle more complicated rules—e.g., integration by parts and u-substitution—and some of them seemed laborious or perhaps impossible. With more time and resources, nonetheless, these realizations might not necessarily be obstacles that discourage one from using Prolog to implement a more sophisticated integral calculator.
  • Lastly, we also learned how to create and organize a console UI using ANSI tags to color the text in console, which aims to produce a more appealing visual presentation.

Work division

N/A

Links to code etc.

https://github.com/eswlo/integralsolver.git