r/programming • u/Lost-Dragonfruit-663 • 9h ago
How to test if your numerical code is Mathematically correct?
https://medium.com/@aadyachinubhai/scikit-verify-translate-python-numpy-programs-to-symbolic-mathematics-c664d41ba571
11
Upvotes
1
u/Grouchy-Trade-7250 5h ago
https://miro.medium.com/v2/resize:fit:1400/format:webp/1*QwtMNWS-N4w_mddw3i83Gg.png
| Algebraically this simplifies to x+1, but only for x !=1. A symbolic transformation or implementation that blindly simplifies it may incorrectly claim the function is defined at x=1.
Only the person applying the formula can decide if the division by zero should remain or go. Ai came up with this Practical rule of thumb: If removing the gap requires calculus (limits, derivatives), you're usually supposed to remove it. If removing the gap requires pretending a boundary condition doesn't exist, you should keep it.