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