3

1

Negative numbers are not taken into consideration by mathematica's built-in functions.

```
FromDigits["-2"]
```

Gives me this message:

```
FromDigits::nlst: The expression -2 is not a list of digits or a string of valid digits. >>
```

Also:

```
In[2]:=IntegerString[-2]
```

Gives:

```
Out[2]:="2"
```

I was wondering if someone had some code to do this. I'm currently making a small program in mma which will help me enter matrices manually because it's cumbersome to type in every single ,{} for each row/column. Here's what I had in mind:

```
enterMat[x_, y_] := MatrixForm[ReleaseHold[
Table[Hold[FromDigits[InputString[]]], {x}, {y}]]]
```

Gives me a series of popups in which I enter the value 1 by 1 pressing enter after each to pass to the next value. It's faster and more comfortable to do it this way since I can use the numpad instead. My only problem is that it just doesn't work with negative numbers!

If you have a solution or you know a great way to enter/scan/manipulate matrices, I would like to hear it. Thanks!

I think

– Albert Retey – 2014-02-06T15:24:55.183`ToString`

and`ToExpression`

are what you are looking for. As for your matrix-input, you might look at this question1

... and of course this questions and the corresponding answers might also be of interest...

– Albert Retey – 2014-02-06T15:27:04.210A negative integer is not a digit! For a given base

b, the digits are 0, 1, 2, ...,b- 1. – murray – 2014-04-20T20:23:03.137