# Min function returns Min[2.05875,] instead of just 2.05875

Discussion in 'Mathematica' started by dg, Jun 1, 2009.

1. ### dgGuest

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?

How can I get just the number from the result?

TIA

dg, Jun 1, 2009

2. ### dr DanWGuest

This is just a guess, but you may have an invisible character as an
element in your matrix that is being interpreted as a symbol. The
second argument of the Min is in your matrix somewhere. Do a FullForm
on the output to see what the second argument to Min is, then

dr DanW, Jun 2, 2009

3. ### Sjoerd C. de VriesGuest

This is precisely the result you get if one of the matrix entries
contains an empty string (""). I'd check my data for this if I were
you.

Cheers -- Sjoerd

Sjoerd C. de Vries, Jun 2, 2009
4. ### FrancescoGuest

Non numerical entry after the comma.
-Francesco

Francesco, Jun 2, 2009
5. ### Jens-Peer KuskaGuest

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

Jens-Peer Kuska, Jun 2, 2009
6. ### SzabolcsGuest

You typed Min[data,] instead of Min[data].
Remove the comma.

Szabolcs, Jun 2, 2009
7. ### Christopher HenrichGuest

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 Henrich, Jun 2, 2009
8. ### pfalloonGuest

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.

pfalloon, Jun 2, 2009
9. ### dgGuest

Solution: The matrix had missing values.

This will work in such cases:
Min[Cases[data // Flatten, _?NumericQ]]

Thanks to a helpful person that found this solution.

dg, Jun 2, 2009
10. ### Murray EisenbergGuest

Min flattens lists!

--
Murray Eisenberg
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

Murray Eisenberg, Jun 3, 2009