Frink Sample Programs

Documentation * FAQ * What's New * Download * Frink Applet * Web Interface * Frink Server Pages * Frink on Android * Donate

Below is a collection of sample Frink programs. Another good source for common tasks can be found at Rosetta Code's Frink page.

You can also download all of these sample programs in a single zipfile, FrinkSamples.zip
(zipfile was last modified AD 2026-07-21 PM 01:18:55.840 (Tue) Mountain Daylight Time)

allFactors[text] Calculates all factors of a number (not just prime factors.)
ArbitraryPrecision[text] Calculates some functions (e.g. log and exp) to arbitrary precision.
baseball[text] Calculates trajectory of a baseball.
bert[text] Calculates the probability of two first names appearing in the same movie.
binarySearch[text] Routines for binary-searching an ordered list.
bitcoin[text] Obtain current Bitcoin exchange rates.
ChineseNumbers[text] Formats integers into their Chinese equivalents (formal and casual)
classtest[text] A sample of object-oriented programming; demonstrates writing and using a class specification.
closestFraction[text] Routines for finding the closest fraction to a number. Also see continuedFraction.frink .
commonTransformations[text] Demonstrates Frink's ability to perform symbolic calculations, including solving equations and taking derivatives.
compound[text] Routines for calculating masses of chemical compounds.
continuedFraction[text] Routines for generating continued fraction representations of numbers.
ConvexHull[text] Calculates (and optionally plots) the convex hull of a set of points.
CoordinateConversions[text] Converts latitude and longitude to and from UTM coordinates.
Country[text] Contains polygons for the outlines for all of the countries in the world.
Datum[text] A data structure used to represent the ellipsoidal shape of the earth, used in various navigation routines.
daylight[text] Calculates duration of daylight over the course of a year.
derivatives[text] Transformation rules for finding derivatives of expressions.
DiscreteDistribution[text] Allows you to randomly choose items based on a specified probability distribution.
e[text] Calculates the digits of e, the base of the natural logarithm, to arbitrary precision.
elements[text] A basic periodic table of the elements.
exectest[text] Demonstrates starting external processes using Frink's ability to call Java code.
Fourier[text] Routines for discrete and fast Fourier transforms (FFT) of data.
geometry[text] Functions for planar geometry.
hints[text] Provides hints and help for common errors in Frink calculations.
holeearthfullgradient[text] Calculates time to fall through a hole in the center of the earth with realistic model of densities.
holeearthgradient[text] Calculates time to fall through a hole in the center of the earth with overly-simplistic model of densities.
holeearthuniform[text] Calculates time to fall through a hole in the center of the earth with naïve uniform density model.
homonyms[text] Finds homophones of words.
HTMLUtils[text] Utilities for processing HTML.
JacobiSymbol[text] Functions for calculating the Jacobi symbol and Legendre symbol.
JVMinfo[text] Displays the properties of your Java Virtual Machine. Demonstrates use of Java Introspection.
LogIntegral[text] Calculates the logarithmic integral Li[x].
lottery[text] Routines for calculating lottery odds.
LucasLehmer[text] Implements the Lucas-Lehmer test for proving primality of Mersenne primes.
Maidenhead[text] Converts between lat/long and Maidenhead coordinates.
mandelbrot[text] Draws a Mandelbrot set in plain text.
mandelbrotGraphics[text] Draws a Mandelbrot set as graphics.
mithengecorridor[text] Data for the Infinite Corridor at MIT.
mithengemoon[text] Calculates moon alignments with MIT's Infinite Corridor.
mithengesun[text] Calculates sun alignments in MIT's Infinite Corridor.
navigation[text] A library of high-precision calculations for navigating on the earth.
note[text] Functions for converting frequencies to musical notes.
palindromicNumbers[text] Finds palindromic numbers by the "reverse and add" method.
pi2[text] Calculates π to arbitrary precision.
planets[text] A library to calculate the positions of the the planets to high accuracy using the VSOP87 theory.
pollardP-1[text] An implementation of the Pollard p-1 factoring algorithm.
Processes[text] Contains functions for launching external processes from Frink.
quine[text] A program that prints its own source.
randomDistribution[text] Randomly selects elements from a discrete set with a known distribution.
relativity[text] Functions for various relativistic equations, including black holes and relativistic rockets.
RiemannZeta[text] Calculates values of the Riemann Zeta function.
root[text] Finds roots of numbers to arbitrary precision.
siderealtime[text] Calculates Greenwich Mean Sidereal Time.
sieve[text] Sieve of Eratosthenes to find prime numbers.
simplegraph[text] An simple but interesting program that uses interval arithmetic to plot equations.
solve[text] A simple program that solves a variety of algebraic equations.
solvingTransformations[text] A library of transformation rules to solve algebraic equations.
StandardAtmosphere[text] A class which implements the U.S. Standard Atmosphere of 1976. This allows calculation of pressure, temperature, air density, speed of sound, etc. at varying altitudes.
StandardAtmosphereTest[text] Contains examples of doing standard atmosphere calculations.
statistics[text] Functions for statistics including the forward and inverse error function, the normal distribution, etc.
stellarMagnitude[text] Functions for converting between stellar magnitudes, power fluxes, and total power emitted.
stock[text] Fetches stock prices from the internet.
sun[text] A massive library of astronomical calculations to find positions of the sun, moon, and other calculations.
sunplot[text] Creates data to plot the location of the sun for an entire year.
sunrise[text] Calculates times of sunrise, sunset, and twilights.
timezonediff[text] Calculates the difference between two time zones.
trigram[text] Program to find the most frequent n-letter patterns in words.
water[text] Calculates properties of water and steam to high accuracy using the IAPWS-95 model.
waterVapor[text] Calculates the absolute and relative humidity and partial vapor pressure of water.
webspider[text] Simple program to find all of the links in an HTML page.
wheelgame3[text] Simulator to find optimum play for the big-wheel-spinnin' "Showcase Showdown" game on The Price Is Right
WilliamsPPlus1[text] Factorization using the Williams p+1 factorization method.
xmldump[text] Demonstrates dumping units in an XML format.
ziplocator[text] Locates latitude and longitude of U.S. zip codes (requires data file)

Descriptions of the following programs will be added later:

100doors 16Animali 16AnimaliBox 16Pesci
16PesciBox 99bottles 99bottles2 9billionnames
abundantNumbers accelerationSolver AgencyInitiation AhlsBenchmark
airfoil airfoilExtrudeTest airfoilExtrudeTestNew airfoilPoster
allColors allColors2 allFactors2 allTransforms
almostPrime altAzimuthToXYZTest Amazon amicableNumbers
anagramchallenge anagramlog anagramQuandary anamorph
animate animateJupiterMoons arbitrarySqrt ArchimedeanSpiral
ArcTest argmin ArmillarySphere army
ArnaultTest AudioSystemTest autumnEquinoxPlot average
babbage BallBearing ballgame ballistics2D
barcode base32Test baseconv baseConversionTest
baseConversionTiming baseConversionTuner basetiming BBP
Beaufort benchmark1 BenfordsLaw BernoulliNumbers
biathlon bigcoord BinarySplitting BinarySplittingExp
BinarySplittingFactorial BinarySplittingPi BinaryWriter BingoCard
birdhouse Boggle boilingPointByElevation boilingPointTest
BooleanTransformations BoulderArtsAndMaths27 boxIllusion boxIllusion2
boyGirlPuzzle Braille BrailleTest breaktest
Brix BruteForce BullsAndCows CacheFreeGDMII
caltrops cambridgetemp cambridgetempFourier candleHolder
cantorOrdering cap3D CarTalkPuzzle CarTalkPuzzle2
chainGuide ChineseMarch ChineseRemainderTheorem chopsticks
Cipolla circleTest circularOrbit classRedefinitionTest
ClipTest ClipTestPolygon codeBlocks collatorTest
collectTransformations colorboxes colorillusion colorspace
colorsPuzzle cometCap commaify commentTest
constraintAllDifferent constraintNQueens constraintSorter constraintSudoku
constraintSudokuTest consttest convergatron convergatron2
convergatronMoon ConwaysLife CoordinateTransformerTest CoriolisBall
CoriolisKick CornbreadCache correlation correlationTest
countryHeatMap CrackTheCode crossstitch cryptoAES256
cryptoCircuitPuzzle cryptoProviders cryptotest crystalradio
CSV cubeRotations currencySymbols curvefit
curveFit curveFitTest cycleDetect cylindricalEmbossGrayTest
cylindricalEmbossTest DeadDrop deBruijn decheckerboard
decipherbible decipherrabbit decodeBuilt decrypt
Deducer deltat Derby derbyDraw
derbytrack derbytrack2 descriptorsFogus DigitalPerfection
DigitalPerfection2 digitalSundial diophantinePrimes diophantinePrimesGradient
diophantinePrimesTest DivideAndConquer dnfsize dollarConvert
DonutCutter drawCountries drawDymaxion drawJupiterSaturn
drawMarsJupiter drawMD5 drawPlanets drawSaturn
drawSolarSystem drawVenus dreidel dreidelShaft
DriveYaNuts dropperHolder dumpExpression dumpUnits
DuncanDecode DurinsDay Dymaxion earthdisttest
EarthTemperature eBinarySplitting eclipse ECM
ellipsoidTest ellipticIntegral embossBirdcage embossCap
embossEgg embossEggMoon EmilysFourthHour emirp
encoding encodings epochClock epochClockBinary
EqualEarthProjection error EstesRocket Ethanol
euclidean exactSeasons exponentialSpiral exponentialSpiralIn
exponentialSpiralOut extrudeTest factor factor2
factorableWords factorFactorial factorsOf10 FeatureGraphic
fermatWrong fetchweather fibonacci fibonacciSpiral
fireworks fitConicSection fitPlutoOrbit flag
floatingPointBase floatTiming FloatVector floodFillTest
FloydSteinbergDither fontDetails fontList fontsWithGlyphs
fontsWithGlyphsGrid FontWidthEstimatorBuilder forensicSeismology formatEquation
formatterTest formatTest fortest fortest2
fortest3 Fourier2d FourierImage FourierImageTest
fourierLaser fourierTemp fouriertest FourierUtils
FresnelZonePlate frinklog FrinkRulesAmbigram fryer
FTPUpload functionUtils functionUtilsTest GaiaTest
GaiaTestColumns GaiaTestGalactic GalileoJupiterMoons Game
GEBCube GEBCube2 GEBText GelfandsQuestion
GeneralPathClipTest GeneralPathExample GeneralPathExamples generalPathMatch
GeneralPathTest geocaching GeometricMedian GeometricMedianTest
glob GoogleEarth GoogleTranslate gradingProblem
Graph graph3D graphemesTest graphicalSieve
graphicsAddTest GraphicsGrid GraphicsGridTest GraphicsGridTest2
graphicsTest graphpaper graphRiemannZeta GraphTest
gravityAssist GrayCodes grayscaleBars greatCircleMap
GreatPyramid Grid gripper groupBy
guitoolstest gyrojet gzipMemory harvest
harvest2 hashColor hemispheres hexaflexagon
hexaflexagonImage hinttest HTTPHeaders HubbleUDF
humanBodySurface hyperoperation hypersphere iau1980
IEEE754 iftest ikeaBowlHolder imageMath
impossibleSphere increasingPuzzle IndianAstronomy inertialNav
inputtest integrals interfacetest IntervalIntegrate
IntervalSolve intervaltest inverseSinusoidal ioioThermalTest
isometricProjection jennyMoonVenus jigglyNumberPuzzle jotto
JoyDivision JoyDivisionAnimated juliaGraphics JupiterMoons
JupiterSaturnConvergence KaplinskyPuzzle KaplinskyPuzzleSmall karatsuba
karatsubaTest kittyHockeyPuck knapsack KnapsackBounded
knapsackTest koodipuzzle lambda LambertW
LaplaceTransform largestTweetablePrime latitudeComparison latitudeComparison2
LatLongToUTM launchdrag LeafPrimes LeastSquares
LeastSquaresFitAlc LeastSquaresTest lefthand leftTruncatablePrimes
letterFrequency letterGraph lettergrid LiarLiarII
lineWrapper linkFAQ listCountries listFonts
listFunctions listUnits lncheck longestWord
LoraTrainer lowestFactor lsim L-system
L-system-animated madplot makeCountries makeUT1
MandMdistribution MandMdistributionCounter manhattanhengemoon manhattanhengesun
mapDymaxion mapStates mapStatesSinusoidal mapTest
mapTimeTest mapTimezones MarsAtmosphere MarsAtmosphereFull
MarsAtmosphereOld MarsAtmospherePlot MarsJupiterConvergence MarsMeteor
MarsOccultation mastermind mastermindDeducer mastermindGeogebra
MathML Matrix MatrixInvert MatrixLUTest
MatrixQRTest matrixSolveTest matrixSolveUnitsTest maximize
McKellarPuzzle MD5crack medievalPlanets meeus33a
meeus47a meeus47b MercuryTransit mersenne
mersennetest mersennetiming meteorCrater MicroRevengeCache
midisynth MischaOrnament mithengefoner mithengeplanets
mithengereverse mithengereverse2 mithengereverse3 mithengereverse4
mithengereverse8 mithengeSirius mnemonics mnemonicsMajor
modTest modtimetest modtimetest2 MollweideProjection
MomTetrahedron MonthWithoutAFullMoon moon3D moon3DSolid
moonangle mooncomparison moonDrawingTest moonPlanetPlot
moonPositionAngle moonsize moonsizecut MoonVsJupiter
mooreslaw mugCap multifortest multifortest2
multifortest3 multiline multinexttest MultiplicationFrustration
musicalscale NamedColors namefreq NancyDrewDogsPuzzle
nerdleDeducer NewtonDivision NewtonsMethod nextLargestPrime
nextPrimeTest nonterm normalCurve normalCurve2
normalCurve3 normalCurve4 nozeroes numberCheckerboard
NumericalIntegration NumericalIntegrationArbitrary NumericalIntegrationArbitraryTest NumericalIntegrationTest
Odds OneRingEmboss oonapuzzle optimumLaunch
orbit orbitalBurn OrderedList organisms
Othello outputtest paintAlongHullTest paniqPuzzle
parachuteHat parametric3D parametric3DTest parseIntTest
partitions PascalsTriangle passportpic pegGame
pegGameAnalyzer PerfectionPiece perihelion PetersProjection
pi piChudnovsky piChudnovskyNew piPoster
piRamanujan pixelAveragingTest planarEmbossTest planarSundial
planckify planetDistance planetLocations Plot2D
Plot3D plotBinomial plotCambridgeTemp plotConvergence
plotStudentT Pluto Pochhammer pokerhands
polygonTest ponderThis201004 ponderThis201004b powerTransformations
predictSequence previousPrimeTest PrimeAndPrejudice primebits
primechain primechain2 primechain3 primeCountTest
primelist primeQuadruples primeQuadruplets primesInPi
primetest primetest2 primetest3 primorial
printerResolutionTest printPi PriorityQueueTest proctest
properDivisors pseudoprimes PSLQ pumpHolder
punctuationCipher pushclasstest pushtest qrcode
QRCodeEgg qrcodeembroider quadtree randomprime
ReadASpecificLine Recaman RecursiveParseString RecursiveParseStringNative
redballs regression RelativisticKineticEnergyTest repeatingDigits
returnTest reversePhonemes rewriteImage Richter
RiemannPrime RightStuff risesetchart rollForIntelligence
rootGUITest RosettaCodeUnimplemented rosettaify rot13
rotate roundedCubeTest RSA Rump
safePrimes SaturnChristmas saturnRingAngle scarfquine
scarfquine1 scarfquinetest screwThreads screwThreadsTest
screwThreadsTest3Start screwThreadsTestRing secant shebangTest
showFonts shuffleTest SierpinskiCarpet signetRing
similarUnits simplegraph2 simplegraph3 simplegraph4
simplegraph5 simulatedOverload sizesort SlideRule
Sneaky1 Sneaky2 socatprime SolarCooker
SolarCooker2 solarSystemGravity Solver SolverTest
solveTest solveTest2 solveTrigonometric sorttest
sousvide sousvideTy spheresProblem spheresProblem2
sphericalEmbossGrayTest sphericalEmbossTest spiral springEquinoxPlot
sqrtNearestIntegerTest sqrtWayne squarePuzzle squeezy
squeezy2 StarTram stirling Stirling
StirlingCoefficients stocktest strangePrimes strongPseudoprimeTest
strongPsuedoprimeTest StudentT Sudoku SudokuSmooth
sumdigits summerSolsticePlot sumTo100 sunCoordinates
suntest suntimetest supertoroidTest systemSolver
systemSolver2 systemSolver3 systemSolverDemo systemSolverTest
systemSolverTest2 T9 TAIMinusUTC TAK
TangentNumbers taperTest TaylorSeries TelescopeViewfinder
TelescopeViewfinder2 temperatureFrequency testBaseConversions tetrahedron
textAlignTest textAlignTest2 textcenter textcenter3
textcenterfixed thermalTest thermocouple2 thermocouple3
thermocouple4 thermodynamics TicTacToe TierraEstella
timeFullMoon timefunc Tire titlecase
TLE tns tnsmap toArbitrary
toiletScrew tongs tongsRounded TopHat3D
torusTest toStringTest TowersOfHanoi transit
transit2 transit3 transitTwain TravellersDilemma
Tree treehouseRollingPin TreeTest trs80ify
tryTest Tupper TupperGen tvaspect
TysonTweet undocumentedFunctions Unicode unicodeGraphics
unicodeGraphics2 UnitMathHelper unittable universeNote
use usehttp useparent UT1
UTMtest VacuumNozzle vaporize2 vd
vectest vectorTiming VenusApparent venusPositionAngle
verifySSH VINChecker VoxelArrayTest VoxelPolygonTest
VoxelRotatedPolygonTest VoxelRotateTest VoxelSolidOfRotation VoxelStrokePolygonTest
VoxelTaperedPolygonTest VoxelXYZRotateTest vsop87 Water1984
water2unicode waterold waterUnicode wheelgame
windchill winterSolsticePlot WordFrequency wordleDeducer
WordleWordsSortedGenerator Words wordTransform worldcities
Writer WWIICache wynnhenge wynnhengemoon
X-15 xkcd287 XtotheX XtotheXbetter
YCbCr YentzenPuzzle ZehnGray zipcodesInOrder
ZipFile

Alan Eliasen was born 20790 days, 4 hours, 25 minutes ago.

Back to Frink Documentation