Group Abstract Group Abstract

Message Boards Message Boards

0
|
6.9K Views
|
9 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Arrays with decimal numbers

Posted 10 years ago

Hello,

I wish to know if it´s possible to use decimal numbers in arrays. The code I have written is the next:

Manipulate[

 Array[# &, a],

 {a, 0, 10}
 ]

enter image description here

With whole numbers, I have no problem. Are there any solution??

Thank you very much.

POSTED BY: Luciano Tresto
9 Replies
In[3]:= Sort[SetAccuracy[RandomReal[{-1, 18}, {37}], 3]]

Out[3]= {-0.69, 0.09, 0.35, 0.73, 1.20, 2.01, 2.57, 2.67, 2.98, 3.93, \
4.09, 4.21, 4.26, 4.69, 5.21, 5.35, 5.55, 5.61, 7.71, 7.71, 7.78, \
7.91, 8.12, 8.51, 8.71, 9.51, 9.98, 10.20, 11.56, 12.28, 14.75, \
15.64, 15.79, 16.59, 17.10, 17.12, 17.14}
POSTED BY: Udo Krause
Posted 10 years ago

Thank you for your response Udo, it was useful.

POSTED BY: Luciano Tresto
Posted 10 years ago

Hello Marco,

Thank you for your response.

I would like to obtain an array like...{0, 0.2, 1.3, 2.6, 3, 4.8....}, every number, whole or decimal number.

Is it possible?

POSTED BY: Luciano Tresto

What should the array be based on? I don't see any logical in the sequence: {0, 0.2, 1.3, 2.6, 3, 4.8....}

POSTED BY: Sander Huisman
Posted 10 years ago

There isn't a specific sequence. I refer to any decimal number. I want the array contains decimal numbers and show them, not only whole numbers.

POSTED BY: Luciano Tresto
Posted 10 years ago
Table[Round[RandomReal[10], 0.01], 7]
{8.17, 1.11, 7.9, 1.88, 2.41, 0.66, 5.42}
POSTED BY: Hans Milton
Posted 10 years ago

Or, sticking to the Array function:

Round[Array[RandomReal, 7, {10}], 0.01]
{8.17, 1.23, 9.47, 2.44, 3.38, 0.99, 8.68}
POSTED BY: Hans Milton
Posted 10 years ago

Thank you very much Hans.

POSTED BY: Luciano Tresto

Hi,

I do not really understand what you want to achieve. Do you mean something like this?

Manipulate[Array[# &, a], {a, 0, 10, 1}]

enter image description here

Cheers,

Marco

POSTED BY: Marco Thiel
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard