LinearSolveFunction[dimensions,data]
represents a function for providing solutions to a matrix equation.
LinearSolveFunction
LinearSolveFunction[dimensions,data]
represents a function for providing solutions to a matrix equation.
Details
- LinearSolveFunction[…] is generated by LinearSolve[m].
- LinearSolveFunction works like Function.
- LinearSolveFunction[…][b] finds the solution to the matrix equation
for the specific vector or matrix
. - dimensions specifies the dimensions of the matrix m from which the LinearSolveFunction was constructed.
Examples
open all close allBasic Examples (1)
Scope (3)
Do computations using exact arithmetic:
f = LinearSolve[HilbertMatrix[6]]f[{1, 1, 1, 1, 1, 1}]Do computations using machine‐number arithmetic:
f = LinearSolve[N[HilbertMatrix[6]]]f[{1, 1, 1, 1, 1, 1}]Do computations using 24‐digit arithmetic:
f = LinearSolve[N[HilbertMatrix[6], 24]]f[{1, 1, 1, 1, 1, 1}]Generalizations & Extensions (1)
Get a factorization for a large sparse matrix:
n = 10000;h = 2.Pi / n;s = SparseArray[{{i_, i_} -> 1. - 2 / h ^ 2, {i_, j_} /; Abs[i - j] == 1 -> 1 / h ^ 2}, {n - 1, n - 1}];
lsf = LinearSolve[s]grid = h Range[n - 1];
b = 1 - Cos[grid];
ListPlot[Transpose[{grid, lsf[1 - Cos[grid]]}]]Applications (2)
Find the eigenvector associated with the smallest eigenvalue:
n = 1000;h = 2. Pi / n; s = SparseArray[{{i_, i_} -> 1. - 2 / h ^ 2, {i_, j_} /; Abs[i - j] == 1 -> 1 / h ^ 2}, {n - 1, n - 1}];
lsf = LinearSolve[s];
ListPlot[v = FixedPoint[Normalize[lsf[#]]&, RandomReal[{0, 1}, n - 1], 1000, SameTest -> (Norm[#1 - #2] < 10 ^ -10&)]]Approximate value of the eigenvalue:
(s.v)[[1]] / v[[1]]Expressions for a finite difference approximation to the Laplacian in 2 dimensions:
n = 50;Short[lexp = Flatten[ListCorrelate[n ^ 2{{0, 1, 0}, {1, -4, 1}, {0, 1, 0}}, Array[u, {n - 1, n - 1}], {2, 2}, 0]], 5]A matrix approximating the Laplacian operator:
m = N[CoefficientArrays[lexp, Flatten[Array[u, {n - 1, n - 1}]]][[2]]]A linear solve function for the matrix:
f = LinearSolve[m]An approximate solution for the Poisson equation
on the unit rectangle:
ArrayPlot[Partition[f[Flatten[Table[Sin[Pi i / n]Cos[3Pi j / n], {i, n - 1}, {j, n - 1}]]], n - 1], ColorFunction -> Hue]An approximate solution for the Poisson equation
on the unit rectangle:
ArrayPlot[Partition[f[Flatten[Table[Exp[-10((2 i / n - 1) ^ 2 + (2 j / n - 1) ^ 2)], {i, n - 1}, {j, n - 1}]]], n - 1], ColorFunction -> Hue]Properties & Relations (2)
A LinearSolveFunction is effectively like a matrix inverse. A large sparse matrix:
n = 4000;h = 2 Pi / n;s = SparseArray[{{i_, j_} /; Abs[i - j] ≤ 1 -> (3Abs[i - j] - 2.) / h ^ 2 + 1.}, {n - 1, n - 1}]Time to compute and memory used by the linear solve function:
AbsoluteTiming[ByteCount[f = LinearSolve[s]]]Time to compute and memory used by the inverse matrix:
AbsoluteTiming[ByteCount[inv = Inverse[s]]]Comparison of f and the inverse matrix for a random vector b:
b = RandomReal[{0, 1}, n - 1];
Max[Abs[f[b] - inv.b]]Create a LinearSolveFunction for a simple matrix:
f = LinearSolve[{{1, 2}, {3, 4}}]Compute the inverse matrix from f:
f[IdentityMatrix[2]]Compute the inverse matrix using Inverse:
Inverse[{{1, 2}, {3, 4}}]Related Guides
History
Introduced in 2003 (5.0)
Text
Wolfram Research (2003), LinearSolveFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/LinearSolveFunction.html.
CMS
Wolfram Language. 2003. "LinearSolveFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/LinearSolveFunction.html.
APA
Wolfram Language. (2003). LinearSolveFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LinearSolveFunction.html
BibTeX
@misc{reference.wolfram_2026_linearsolvefunction, author="Wolfram Research", title="{LinearSolveFunction}", year="2003", howpublished="\url{https://reference.wolfram.com/language/ref/LinearSolveFunction.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_linearsolvefunction, organization={Wolfram Research}, title={LinearSolveFunction}, year={2003}, url={https://reference.wolfram.com/language/ref/LinearSolveFunction.html}, note=[Accessed: 13-June-2026]}