Jekejeke Prolog 1.2.2 (sum of square roots datatype)
Jan Burse, created Jun 26. 2017, modified Jun 27. 2017
We have just uploaded the new release of Jekejeke Prolog. We have added new modules for a sum of square roots datatype.
- Status Bar:
We did some improvement in the Swing console. The runtime library has received a new status bar that shows a scroll lock icon, and we have rearrange the file and run menus. The development environment has received some new accelerator keys.
- Module radical:
It is said that float numbers are a can of worms. Finding cases where we can do something exact on the computer arent simple either. Our packages for computer algebra in Prolog already features rational numbers that are exact. We have added a further datatype that consists of sums of square roots. That datatype is capable of exact arithmetic and can already be used in matrix inversion and polynomial GCD:
% 22 consults and 0 unloads in 781 ms.
?- X is [[1,sqrt(2)],[sqrt(2),1-sqrt(2)]], Y is X^(-1).
X is [[1,sqrt(2)],[sqrt(2),1-sqrt(2)]],
Y is [[3-sqrt(8),2-sqrt(2)],[2-sqrt(2),1-sqrt(2)]]
?- X is (5*A^2-1)/(sqrt(5)*A-1).
X is 1+sqrt(5)*A
- Module ordered:
The new radical datatype is recursive in that the radicands can be sums of square roots again. Deeper nesting incures higher computation times. Besides the basic arithmetic, we have also implemented automatic denesting of recursive radicals, comparison of recursive radicals and truncation of recursive radicals. For the arithmetic we have implemented 20 test cases from literature, which all pass.
?- X is sqrt(3+sqrt(8)).
X is 1+sqrt(2)
?- 15/10000 < sqrt(100000)-sqrt(99999).
?- X is floor((sqrt(100000)-sqrt(99999))*10000).
X is 15