]> ruderich.org/simon Gitweb - config/dotfiles.git/blob - misc/maxima/maxima-init.mac
psql: add vim modeline
[config/dotfiles.git] / misc / maxima / maxima-init.mac
1 /*
2  * Maxima (computer algebra system) configuration file, Maxima part.
3  *
4  * Also have a look at maxima/maxima-init.lisp.
5  *
6  * Notes:
7  *
8  * Solve Ax = b, thanks to Florian.
9  *
10  * A : matrix([1,2,0],[0,2,3],[0,0,4])$
11  * b : matrix([1],[3],[5])$
12  * linsolve_by_lu(A,b);
13  */
14
15 /*
16  * Copyright (C) 2011-2012  Simon Ruderich
17  *
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.
22  *
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.
27  *
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/>.
30  */
31
32
33 /* CUSTOM FUNCTIONS */
34
35 /* Didn't find any euclid norm in Maxima, so here it is. */
36 norm(x) := sqrt(transpose(x) . x);
37
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]));
42
43 /* Shortcut to perform lu factorization. */
44 lu(x) := block(x : lu_factor(x), get_lu_factors(x));
45
46 /* vim: ft=maxima */