kmace
kmace

Reputation: 2044

Using scientific notation with real numbers as exponents

I'd like to define a number using scientific notation, such as:

1e-2

Which works, however I can't do this in matlab with non-integer exponents:

1e1.5

1e1.5
      |
Error: Unexpected MATLAB expression.

How can I do this in MATLAB?

Upvotes: 0

Views: 63

Answers (1)

lejlot
lejlot

Reputation: 66805

You can do this by hand.As far as I know, usually programming languages do not support such things (including python etc.), thus

AeB => A*10^B.

I am not entirely sure why such approach was taken, but my best guess is that short notation is used for things computable in constant time, very simple. Exponentation is not that basic, and while eN is easy to compute (it is just 10 with N zeros) eR for real R is much more complex thus it might be reasonable to force user to express it directly. But even in mathematics, it is a very rare use case to have non integer exponent, see even wikipedia article on scientific notation.

Upvotes: 1

Related Questions