# [Maxima] Strange Frobenius norm of a certain matrix

Paul Smith phhs80 at gmail.com
Mon Sep 24 05:13:31 CDT 2007

```On 9/24/07, Barton Willis <willisb at unk.edu> wrote:
> Yes, the code for the Frobenius norm is missing a square root.
> I'll fix this; till then use

Thanks, Barton.

Paul

> mat_norm(m, p) := block([listarith : true, d],
>   require_matrix(m,"first","mat_norm"),
>   if blockmatrixp(m) then m : mat_fullunblocker(m),
>   if p = 1 then mat_norm(transpose(m), 'inf)
>   else if p = 'inf then (
>     d : 0,
>     for ri in m do (
>       d : max(d, tree_reduce("+", map('cabs, ri)))),
>     d)
>   else if p = 'frobenius then sqrt(tree_reduce("+", lreduce('append,
>   args(cabs(m)^2))))
>   else error("Not able to compute the ",p," norm"));
>
> Thanks for the report.
>
> BW
>
> -----maxima-bounces at math.utexas.edu wrote: -----
>
> >To: maxima at math.utexas.edu
> >From: "Paul Smith" <phhs80 at gmail.com>
> >Sent by: maxima-bounces at math.utexas.edu
> >Date: 09/23/2007 03:54PM
> >Subject: [Maxima] Strange Frobenius norm of a certain matrix
> >
> >Dear All,
> >
> >Consider the following code:
> >
> >(%i1) A:matrix([1,1],[1,1]);
> >                                   [ 1  1 ]
> >(%o1)                              [      ]
> >                                   [ 1  1 ]
> >(%i2) mat_norm(A,frobenius);
> >(%o2)                                  4
> >(%i3)
> >
> >Should not the Frobenius norm of this matrix be equal to 2?
> >