# Tag Info

0

$PrePrint = NumberForm[#, ExponentFunction -> (Null&)] &$PrePrint is a function that is applied to every expression before display; in this case, we simply use NumberForm to format all numbers in the expression with no exponent.

1

The two-line formatting you quote in your question is the result of string conversion into OutputForm, which is the default FormatType of ToString. If you use CForm you get something more useful for C: ToString[2.77778*10^11, CForm] "2.77778e11" You can change the default FormatType with SetOptions: SetOptions[ToString, FormatType -> CForm]; ...

2

Since you are converting numbers to strings you presumably have some code for doing this? Since you are not globally converting numbers to strings via an option setting you still require the string conversion step in your process. Therefore why not just make the reformatting of your number part of this code? I think something like this may be what you need. ...

2

Does this fit your needs? RealVector = MatchQ[#, {__Real}] &

4

In Mathematica, Element[1,Reals] returns True since integers are subset of the reals. But Head[1] is Integer. So, since you need to check for Head of each element. One way might be realVector[x_List] := VectorQ[x, NumericQ] && (AllTrue[x, (Head[#] === Real) &]) Now realVector[{1., 2., 3.}] (*True*) realVector[{1, 2, 3}] (*False*) ...

0

You have syntax errors (e.g., no & for making a function). Moreover, there is no need to check if an element is a number if you're also checking whether it is in the set of Reals. This should work for you: realVector[expr_] := VectorQ[expr, # \[Element] Reals &];

3

Couple of additional or summary points. This is a great question for the 21st century. Since the question regards mathematical definitions, "domain" isn't defined (at least by itself, unlike say "integral domain"). Instead should refer to specific categories like Set. Be especially careful with fields, eg non-Archimedean ones. IEEE 754 floating point was ...

10

As noted in post, responses and comments, Real is a Mathematica head and, as such, is distinct from Integer and Rational and Complex. All of these are regarded as "atomic" (notwitstanding that Rational has two Integer "parts", and Complex is comprised of any mix of the other three types). These atomic types are in a sense distinct from the domains one ...

13

In some settings the integers, fractions, rational numbers, reals, and complexes are five distinct systems. Further, for reals and complexes, there are the standard reals and complexes as well as nonstandard systems. There are mappings from some to others, so that a subset of the reals in an isomorphic image of the integers (as rings), and so on for \${\bf ...

Top 50 recent answers are included