Download or view tvaspect.frink in plain text format
/** If a television has an aspect ratio of 16:9, and a diagonal size of
55 inches, how wide is it?
*/
use systemSolver2.frink
symbolicMode[true]
showApproximations[false]
showDimensionName[false]
// Create a system of simultaneous equations and let Frink rearrange
// and solve it.
tv = new System[[width / height === aspect ,
diagonal^2 === height^2 + width^2], // Pythagorean theorem (in natural form!)
[]]
// Show all solutions to show off
//println[join["\n",tv.solveAll[]]]
tv.solveAll[]
// Plug in exact numbers and solve for the wall's cross section.
println["Solutions:"]
values = [["aspect", 16/9],
["diagonal", 65 in]]
dsols = tv.solveForValues["width", values]
//println["dsols is $dsols"]
println[positive[eval[dsols]]->"in"]
Download or view tvaspect.frink in plain text format
This is a program written in the programming language Frink.
For more information, view the Frink
Documentation or see More Sample Frink Programs.
Alan Eliasen was born 20203 days, 11 hours, 6 minutes ago.