Wolfram ResearchPRODUCTSPURCHASEFOR USERSCOMPANYOUR SITES
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.

Saving the Factorization

Many applications of linear systems involve the same matrix  but different right-hand sides  . Because a significant part of the effort involved in solving the system involves processing  , it is common to save the factorization and use it to solve repeated problems. In Mathematica, this is done by using a one-argument form of LinearSolve; this returns a functional that you can apply to different vectors to obtain each solution.

In[1]:= 

Out[2]=

When you can apply the LinearSolveFunction to a particular right-hand side the solution is obtained.

In[3]:= 

Out[4]=

This solves the matrix equation.

In[5]:= 

Out[5]=

A different right-hand side yields a different solution.

In[6]:= 

Out[7]=

This new solution solves this matrix equation.

In[8]:= 

Out[8]=

The one argument form of LinearSolve works in a completely equivalent way to the two argument form. It works with the same range of input matrices, for example, returning the expected results for symbolic, exact, or sparse matrix input. It also accepts the same options.

One issue with the one argument form is that for certain input matrices the factorization cannot be saved. For example, if the system is overdetermined, the exact solution is not certain to exist. In this case a message is generated that warns you that the factorization will be repeated each time the functional is applied to a particular right-hand side.

In[9]:= 

Out[10]=

For this right-hand side there is a solution, and this is returned.

In[11]:= 

Out[12]=

However, for this right-hand side there is no solution, and an error is encountered.

In[13]:= 

Out[14]=


Any questions about topics on this page? Click here to get an individual response.Buy NowFree TrialMore Information



 © 2009 Wolfram Research, Inc.  Terms of Use  Privacy Policy |
Sign up for our newsletter: