Prev: Recognize path in save dialog for future save dialog boxes
Next: Question on 'solve' function and symlinks
From: Mayi DA on 17 Jul 2010 09:08 Dear all As you know, 1*[] get [], and 1*NaN can get NaN. Let's see what will gain when Nan*[]? The answer that MATLAB gives is []. Can anyone give me an explanation? best regard mayi 2010-07-17
From: Matt J on 17 Jul 2010 09:25 "Mayi DA" <damayi(a)gmail.com> wrote in message <i1s9vj$mn3$1(a)fred.mathworks.com>... > Dear all > As you know, 1*[] get [], and 1*NaN can get NaN. > Let's see what will gain when Nan*[]? The answer that MATLAB gives is []. > Can anyone give me an explanation? ============ All operations with [] give [] because you can't make something from nothing. Why do you think the result should be different? >> []+1 ans = [] >> []+[] ans = [] >> []/[] ans = [] >> []*[] ans = []
From: Mayi DA on 17 Jul 2010 10:41 nan*[] , why not result as nan? ans = NaN >> nan/nan ans = NaN >> nan+1 ans = NaN >> nan*1 ans = NaN "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <i1savh$njf$1(a)fred.mathworks.com>... > "Mayi DA" <damayi(a)gmail.com> wrote in message <i1s9vj$mn3$1(a)fred.mathworks.com>... > > Dear all > > As you know, 1*[] get [], and 1*NaN can get NaN. > > Let's see what will gain when Nan*[]? The answer that MATLAB gives is []. > > Can anyone give me an explanation? > ============ > > All operations with [] give [] because you can't make something from nothing. Why do you think the result should be different? > > > > >> []+1 > > ans = > > [] > > >> []+[] > > ans = > > [] > > >> []/[] > > ans = > > [] > > >> []*[] > > ans = > > []
From: dpb on 17 Jul 2010 10:46 Mayi DA wrote: > nan*[] , why not result as nan? ans = > ....examples of operations (none including [] ) elided for brevity... As noted, none of those examples include [] so to make your proposed operation do so would definitely create non-orthogonal behavior in Matlab _a_very_bad_thing_ (tm).... But, just for argument, what purpose would it serve that can't be accomplished otherwise more consistently? --
From: Jan Simon on 17 Jul 2010 12:38 Dear Mayi, > As you know, 1*[] get [], and 1*NaN can get NaN. > Let's see what will gain when Nan*[]? Although "NaN" means "not a number" it is a scalar DOUBLE and therefore a number. In consequence, the dimensions of "1 * []" and "NaN * []" must be equal and the multiplication must be associative (considering the limited floating point precision): 1 * NaN * [] == (1 * NaN) * [] == 1 * (NaN * []) I'm not really convinced that "1 / []" is an error, because "Matrix dimensions must agree", while "[] / 1" is calculated to be [] without the need for agreeing dimensions. Kind regards, Jan
|
Next
|
Last
Pages: 1 2 Prev: Recognize path in save dialog for future save dialog boxes Next: Question on 'solve' function and symlinks |