Why do quotes in norm for infinity norm sometimes work

1 Ansicht (letzte 30 Tage)
Michael Gustafson
Michael Gustafson am 9 Dez. 2013
Kommentiert: dpb am 9 Dez. 2013
I'm just curious as to why, for some matrix A, you can calculate the infinity norm with
  • norm(A, inf)
  • norm(A, Inf)
  • norm(A, 'inf')but not
  • norm(A, 'Inf')
especially when
>> inf
ans =
Inf
Seems strange to have included 'inf' -- and the command itself doesn't indicate that 'inf' is a valid input either:
>> norm(A, 'Inf')
Error using norm
The only matrix norms available are 1, 2, inf, and 'fro'.

Akzeptierte Antwort

dpb
dpb am 9 Dez. 2013
"Because" :)
It appears the author of norm did go as far as to do a string comparison of the inputs but didn't bother to [upper/lower]case the input string before making the comparison internally.
The same case-sensitive comparison fails in the same fashion with 'Fro' as opposed to 'fro'
  2 Kommentare
Michael Gustafson
Michael Gustafson am 9 Dez. 2013
I thought it might be that :) I seem to remember at some point in the past, 'inf' wasn't accepted either... At least, that's how I graded things, but a student this semester pointed out that the lower case version in quotes did work (and now I don't have any old enough MATLAB installations to check The Good Old Days)
dpb
dpb am 9 Dez. 2013
It works same way as far back as R12; I don't have anything earlier installed.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by