This project stemmed from a mathematics project in year 9 - the task was to find all of the Pythagorean triads. The QuickBASIC program written to solve this rapidly grew into a full-blown VisualBasic project.
Purpose
This program calculates Pythagorean triads (the integer solutions to the equation x^2 + y^2 = z^2, or the integer values to the sides of a right-angled triangle).
The Program
Pythagorean triads are calculated using two expressions, both of which iterate through values of the variable and use the iteration as the base for finding the triads.
The two expressions used are:
- n , 0.5(n^2 - 1) , 0.5(n^2 + 1)
- l^2 - k^2 , 2kl , l^2 + k^2
Where n, k and l are the iterated values. The final equation is able to caluclate the full set of triads whereas the first only calculates a subset of these. This program is an implementation of the two equations above from Progress in Mathematics 3E (L. Murray, 1989).
Initially, a DOS-based program was written in Microsoft® QuickBASIC 4.5 to iterate through values of the variables and to calculate the triads. This basic code was then incorporated into the current program built in Microsoft® VisualBasic 6.0.
Features include:
- Calculates triads using both equations.
- Automatically sorts the base triads (those not multiple of others) from the results.
- Can export results to a CSV (ASCII Comma Separated Value) file.
- Can open the results in any text editor/spreadsheet application.
Screenshots
Screenshots are available via links below. They will open in external windows. The screenshots are in PNG format (which any sensible browser should be able to open). Please note that all screenshots are ©Copyright 2005 D Wilkins unless otherwise stated.Download
N.B. Downloads for the projects on this site are provided in their current state with no warranty what-so-ever, without even the implied warranty of merchantability or fitness for a particular purpose. They are available in the hope that they may be useful (even if it is just to waste half an hour on a rainy afternoon) to someone and no responsibility is accepted for any damage caused to computer systems whether directly or indirectly. In short, you use them at your own risk!
Source Code
The source for this project is for Microsoft Visual Basic 6.0.
The source code is released under the GNU General Public Licence, in accordance with which the program may be modified and/or redistributed.
Download triCalc 2004 Source Code (ZIP)