From f4b44743d9546dbe42c109b2a25f25a1a51d8bbb Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 23 Jun 2011 16:53:52 +0200 Subject: [PATCH] maxima: Improved version of norm_2(), also rename to mat_norm2(). --- maxima/maxima-init.mac | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/maxima/maxima-init.mac b/maxima/maxima-init.mac index 045a258..f270c10 100644 --- a/maxima/maxima-init.mac +++ b/maxima/maxima-init.mac @@ -5,20 +5,15 @@ */ -/* PACKAGES */ - -/* Provides maxi() and mini() (and more). */ -load (descriptive); - - /* CUSTOM FUNCTIONS */ /* Didn't find any euclid norm in Maxima, so here it is. */ norm(x) := sqrt(transpose(x) . x); -/* Maxima's norm() can't calculate the 2-norm. Only works for non-complex - * matrices. */ -norm_2(x) := sqrt(maxi(eigenvalues(transpose(x) . x)[1])); +/* Maxima's mat_norm() can't calculate the 2-norm. Thanks to Wolfgang Lindner + * (http://www.ma.utexas.edu/pipermail/maxima/2007/006300.html) for an + * improved version. */ +mat_norm2(x) := sqrt(lmax(eigenvalues(transpose(conjugate(x)).x)[1])); /* Shortcut to perform lu factorization. */ lu(x) := block(x : lu_factor(x), get_lu_factors(x)); -- 2.45.2