Group Abstract Group Abstract

Message Boards Message Boards

0
|
13K Views
|
7 Replies
|
1 Total Like
View groups...
Share
Share this post:

[EIWL] list line plot of the first digits of the first 100 squares ?

Posted 11 years ago
POSTED BY: Peter MacKinnon
7 Replies
POSTED BY: Christian Neel
Posted 2 years ago

This may also be used : ListLinePlot[Table[First[IntegerDigits[n^2]], {n, 100}]]

POSTED BY: Maryam Nk

Since IntegerDigits has attribute Listable, there's no need to Map IntegerDigits onto Range[100]^2. Thus simply;

 ListLinePlot[First /@ IntegerDigits[Range[100]^2]]
POSTED BY: Murray Eisenberg
Posted 11 years ago

Thank-you both Paul and Christian. I shall investigate, and hopefully learn. :)

POSTED BY: Peter MacKinnon

Hello Peter, the ;; is a short form for "All" but is a very simple way to manipulate array without explicit index. have a look at the Mathematica help about Span it is very clearly explained. BTW in that particular case, Paul's proposal is even cleaner because there are no reference to table indexes at all.( /@ being the prefix form for "Map"..see also Map help)

POSTED BY: Christian Neel
Posted 11 years ago

This may also be what you need

ListLinePlot[First /@ IntegerDigits /@ (Range[100]^2)]

Paul.

POSTED BY: Paul Cleary
Posted 11 years ago

Thank-you Christian. Definitely better. Or at least it will be if I can figure out what the [[;; , -1]] is all about.

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