Download or view matrixSolveUnitsTest.frink in plain text format
/** This tests solving systems of linear equations with units of measure
using Matrix.frink. This solves a x = b for x.
*/
use Matrix.frink
a = new Matrix[[[1 m, 10 cm], [2 m/s, 11/10 m/s]]]
println[formatTable[[["a = ", a.formatMatrix[]]]]]
b = Matrix.makeColumn[[3 m/s, 5 m/s^2]]
println[formatTable[[["b = ", b.formatMatrix[]]]]]
println["\nSolution: "]
x = a.solveToMatrix[b]
println[formatTable[[["x=", x.formatMatrix[]]]]]
println["\nVerifying (should equal b):"]
println[a.multiply[x].formatMatrix[]]
Download or view matrixSolveUnitsTest.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, eliasen@mindspring.com