2 * Maxima (computer algebra system) configuration file, Maxima part.
4 * Also have a look at maxima/maxima-init.lisp.
8 * Solve Ax = b, thanks to Florian.
10 * A : matrix([1,2,0],[0,2,3],[0,0,4])$
11 * b : matrix([1],[3],[5])$
12 * linsolve_by_lu(A,b);
16 * Copyright (C) 2011-2012 Simon Ruderich
18 * This file is free software: you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation, either version 3 of the License, or
21 * (at your option) any later version.
23 * This file is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
28 * You should have received a copy of the GNU General Public License
29 * along with this file. If not, see <http://www.gnu.org/licenses/>.
33 /* CUSTOM FUNCTIONS */
35 /* Didn't find any euclid norm in Maxima, so here it is. */
36 norm(x) := sqrt(transpose(x) . x);
38 /* Maxima's mat_norm() can't calculate the 2-norm. Thanks to Wolfgang Lindner
39 * (http://www.ma.utexas.edu/pipermail/maxima/2007/006300.html) for an
40 * improved version. */
41 mat_norm2(x) := sqrt(lmax(eigenvalues(transpose(conjugate(x)) . x)[1]));
43 /* Shortcut to perform lu factorization. */
44 lu(x) := block(x : lu_factor(x), get_lu_factors(x));