When I enter Min[data], I get
Min[2.05875, ] as a result, instead of just the number 2.05875.
This is Mathematica 7.0.1 on Mac OS X.
Why?
How can I get just the number from the result?
TIA
Cheers -- Sjoerd
can you explain what the minimum of a set of
vectors with dimension 248 is ?
Or do you mean Min[Flatten[data]] ?
Regards
Jens
You typed Min[data,] instead of Min[data].
> How can I get just the number from the result?
>
Remove the comma.
I think you have a non-printing character in your matrix.
Min[2,3,4,5,x] reduces to Min[2,x]. But if the "x" was something so
strange that Mathematica did not have a way of printing it, then I think
we would see Min[2,].
If "data" is stored as a list of 17 row, each of which should contain
248 numbers, then look for a row with Length[row] = 249.
--
Christopher J. Henrich
chen...@monmouth.com
http://www.mathinteract.com
"A bad analogy is like a leaky screwdriver." -- Boon
Hi,
It's hard to see exactly what's going wrong because you have not
included the exact code, but at a guess I'd say there may some
invisible wrapper around the list of numbers, which is preventing Min
evaluating properly.
In general, the behaviour should be as follows:
In[290]:= data = RandomReal[10, {17, 248}];
Min[data]
Out[291]= 0.00017248
Cheers,
Peter.
>I have an matrix "data" with 17x248 real numbers.
>When I enter Min[data], I get Min[2.05875, ] as a result, instead
>of just the number 2.05875.
>This is Mathematica 7.0.1 on Mac OS X.
>Why?
There is at least one entry in your matrix that does not have a
numeric value. Quite likely, this is a Null. This can happen
when you read data in from a CSV file using Import and there is
an extra comma somewhere.
You can verify this to be the case by doing
Union[Head/@Flatten[data]]
>How can I get just the number from the result?
Obviously, the best choice would be to fix the problem of a
non-numeric entry. However, the numeric value can be extracted
in a number of ways such as
In[2]:= Cases[List @@ Min[2.05875,], _?NumericQ][[1]]
Out[2]= 2.05875
This will work in such cases:
Min[Cases[data // Flatten, _?NumericQ]]
Thanks to a helpful person that found this solution.
Jens-Peer Kuska wrote:
> Hi,
>
> can you explain what the minimum of a set of
> vectors with dimension 248 is ?
>
> Or do you mean Min[Flatten[data]] ?
>
> Regards
> Jens
>
> dg wrote:
--
Murray Eisenberg mur...@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
min(a,b,c,d,e,f,g,h,i)
Min[{{a, {b, j}, c}, {d, e, f}, {g, h, {i, k}}}]
min(a,b,c,d,e,f,g,h,i,j,k)
Min will flatten its argument.
Attributes[Min]
{Flat,NumericFunction,OneIdentity,Orderless,Protected,ReadProtected}
Bob Hanlon
---- Jens-Peer Kuska <ku...@informatik.uni-leipzig.de> wrote:
=============