100% found this document useful (4 votes)
53 views62 pages

Full Programming For Beginners The Fundamentals Basic Introduction To Programming Concepts With Fractals Bjørn I F Westerheim PDF All Chapters

I

Uploaded by

perrsiboemo14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (4 votes)
53 views62 pages

Full Programming For Beginners The Fundamentals Basic Introduction To Programming Concepts With Fractals Bjørn I F Westerheim PDF All Chapters

I

Uploaded by

perrsiboemo14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

Download the full version of the textbook now at textbookfull.

com

Programming for beginners The fundamentals


Basic introduction to programming concepts
with fractals Bjørn I F Westerheim

https://textbookfull.com/product/programming-for-
beginners-the-fundamentals-basic-introduction-to-
programming-concepts-with-fractals-bjorn-i-f-
westerheim/

Explore and download more textbook at https://textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Introduction to Programming with Fortran Chivers

https://textbookfull.com/product/introduction-to-programming-with-
fortran-chivers/

textbookfull.com

Modern C for Absolute Beginners A Friendly Introduction to


the C Programming Language Slobodan Dmitrovi■

https://textbookfull.com/product/modern-c-for-absolute-beginners-a-
friendly-introduction-to-the-c-programming-language-slobodan-
dmitrovic/
textbookfull.com

Modern C for Absolute Beginners A Friendly Introduction to


the C Programming Language Dmitrovi■ Slobodan

https://textbookfull.com/product/modern-c-for-absolute-beginners-a-
friendly-introduction-to-the-c-programming-language-dmitrovic-
slobodan/
textbookfull.com

Sports Journalism and Women Athletes Coverage of Coming


Out Stories William P. Cassidy

https://textbookfull.com/product/sports-journalism-and-women-athletes-
coverage-of-coming-out-stories-william-p-cassidy/

textbookfull.com
International Relations from the Global South Worlds of
Difference 1st Edition Arlene B Tickner Karen Smith

https://textbookfull.com/product/international-relations-from-the-
global-south-worlds-of-difference-1st-edition-arlene-b-tickner-karen-
smith/
textbookfull.com

African Entrepreneurship Leo-Paul Dana

https://textbookfull.com/product/african-entrepreneurship-leo-paul-
dana/

textbookfull.com

The Palgrave Handbook of Australian and New Zealand


Criminology, Crime and Justice 1st Edition Antje Deckert

https://textbookfull.com/product/the-palgrave-handbook-of-australian-
and-new-zealand-criminology-crime-and-justice-1st-edition-antje-
deckert/
textbookfull.com

7th International Symposium on High Temperature


Metallurgical Processing 1st Edition Jiann-Yang Hwang

https://textbookfull.com/product/7th-international-symposium-on-high-
temperature-metallurgical-processing-1st-edition-jiann-yang-hwang/

textbookfull.com

Routledge Handbook of European Welfare Systems 2nd Edition


Sonja Blum

https://textbookfull.com/product/routledge-handbook-of-european-
welfare-systems-2nd-edition-sonja-blum/

textbookfull.com
Chi-Squared Data Analysis and Model Testing for Beginners
1st Edition Carey Witkov

https://textbookfull.com/product/chi-squared-data-analysis-and-model-
testing-for-beginners-1st-edition-carey-witkov/

textbookfull.com
PROGRAMMING
FOR BEGINNERS,
THE FUNDAMENTALS
Basic programming concepts with Fractals

Volume 1: Theory
PROGRAMMING
FOR BEGINNERS,
THE FUNDAMENTALS
Basic programming concepts with Fractals

Volume 1: Theory
PROGRAMMING FOR BEGINNERS, THE FUNDAMENTALS

2
A Bearing E-Book

PROGRAMMING FOR BEGINNERS, THE FUNDAMENTALS

The information in this text is distributed on an “As Is” basis, without warranty. While every precaution has
been taken in the preparation of this work, the author shall not have any liability to any person or entity
with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information
contained in it.

Product and company names mentioned herein may be the trademarks of their respective owners. In
place of using a trademark symbol with occurrences of trademarked names, I am using the names only in
an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 License.
You can find relevant license information at http://creativecommons.org/licenses/by-nc-sa/4.0/ .

CONTACT

If you have questions, requests, praise, criticism or just feel like saying hi, please email me at:

CONTRIBUTIONS

This book is provided free of charge, but who doesn’t like happy little surprises ? If you feel like
encouraging me to continue writing, I welcome your help in any of the following formats.

(This is entirely up to you ofcourse. If in doubt, do save your cryptocurrency for a rainy day.)

3
PROGRAMMING FOR BEGINNERS, THE FUNDAMENTALS

ATTRIBUTES

I have used content from Pixabay ( https://pixabay.com ) for some of the illustrations in this book. All
content were marked « Free for commercial use, no attribution required ». However, I figure it is only fair
to give credit where credit is due. These are [email protected] who have graciously created and made
available content of their own for free:

 openclipart-vectors ( https://pixabay.com/users/openclipart-vectors-30363/ )

 clker-free-vector-images ( https://pixabay.com/users/clker-free-vector-images-3736/ )

 stux ( https://pixabay.com/users/stux-12364/ )

 mahuasarkar ( https://pixabay.com/users/mahuasarkar-5775515/ )

 jjuni ( https://pixabay.com/users/jjuni-27151/ )

 mocho ( https://pixabay.com/users/mocho-156870/ )

 200degrees ( https://pixabay.com/users/200degrees-2051452/ )

 mohamed_hassan ( https://pixabay.com/users/mohamed_hassan-5229782/ )

 pagdev ( https://pixabay.com/users/pagdev-4749277/ )

 tkaucic ( https://pixabay.com/users/tkaucic-1450822/ )

 haticeerol ( https://pixabay.com/users/haticeerol-14967706 )

 mashiromomo ( https://pixabay.com/users/mashiromomo-3944009/ )

 jorgeduardo ( https://pixabay.com/users/jorgeduardo-8516248/ )

 janjf93 ( https://pixabay.com/users/janjf93-3084263/ )

 davidrockdesign ( https://pixabay.com/users/davidrockdesign-2595351/ )

 thedigitalartist ( https://pixabay.com/users/thedigitalartist-202249/ )

 workandpix ( https://pixabay.com/users/wokandapix-614097/ )

 martinelle ( https://pixabay.com/users/martinelle-495565/ )

 ryanmcguire ( https://pixabay.com/users/ryanmcguire-123690/ )

 Startupstockphotos ( https://pixabay.com/users/startupstockphotos-690514/ )

Should you find that the list is incomplete, or that I have made use content that is not free to use, please
contact me with the proper details so I can act accordingly.

Book and Cover design by Bjørn Inge F. Westerheim

Draft version. April 2021, Last updated 10/4/2021.

10 9 8 7 6 5 4 3 2 1

4
A Bearing E-Book

Tell me and I forget.


Teach me and I remember.
Involve me and I learn
- Xun Kuang , Chinese philospoher

5
PROGRAMMING FOR BEGINNERS, THE FUNDAMENTALS

6
A Bearing E-Book

About t he author
Hi there! My name is Bjørn Inge Westerheim. I hold a masters degree in
industrial engineering and am part owner of an IT company in Norway.

I have worked in the field of IT for more than two decades. I was part of the
development team that pioneered conversion to Digital Cinema in Norway,
creating both hardware and software solutions. Over the years, I helped training
cinema technicians in the use of some of these systems and I have helped
people of all ages learn how to build and use computers.

Through work, I tend to get involved in utilitary software development, building


tools, installers and various solutions to help my customers.

Programming is one of my absolute favorite activities, whether for work or


leisure. Over the years, I have dabbled in M68k assembly on the Amiga, X86
Assembly on the PC, Mono on Linux, C/C++, Perl, Javascript, PHP, Python,
Matlab, Visual Basic and more. These days,
Visual C# is where I feel at home, but I am always
looking to learn something new.

I have the fortune of residing in the beautiful and


friendly country of Singapore with my fantastic
family and our three cats: Oggi, Bobbi and Bunni.

About t he book
This book is conceptualized, prewritten, drafted, proofread, illustrated, edited
and published by the author alone. All done purely in my spare time.

I have tried to weed out typos and wordy sentences, but every time I think I am
done, I find another section wordy of rewriting or diagram that needs adjusting.

I feel I have passed the 80%-threshold and reached the point where it is worth
sharing. Otherwise, I am afraid it would never see the light of day.

7
PROGRAMMING FOR BEGINNERS, THE FUNDAMENTALS

Who is this boo k for?


I have written this book with complete beginners in mind. Previous exposure to
programming is not a requirement at all.

Throughout the book, I will touch on basic math to explain certain topics. You
may benefit from having at least a passing knowledge of basic math, but I will
do my best to explain everything in detail.

If you had some previous experience in programming (e.g. you took a basic
course in programming at some point), but you forgot all about it, this course
may be for you as well.

If you are familiar with programming concepts, but feel the urge to get back in
to programming, you may want to quickly skim through this book, and then jump
quickly over to “Volume 2: Creating code”

If you already know the basics, but want to know how to build a basic fractal
image generator, you probably can find a tip or two herein.

What i s in Volume 2?
I have divided the tutorial into two parts. Each part covers the same material,
but from different perspectives.

In the book you are reading now, I will try to expose you to all the basics you
need to get started programming. It contains all the dry theoretical parts.

8
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
A Bearing E-Book

C O N TE NTS

1.1. INTRODUCTION ........................................................................................................................................................................... 2


Fast and furious ...................................................................................................................................................................... 3
Writing code.............................................................................................................................................................................. 3
Programming languages .................................................................................................................................................. 4
Compiling code ....................................................................................................................................................................... 6
1.2. MEMORY ............................................................................................................................................................................................ 8
SLOW MEMORY .................................................................................................................................................................... 8
FAST MEMORY ....................................................................................................................................................................... 9
ACCESSING MEMORY ................................................................................................................................................... 10
SUMMARY................................................................................................................................................................................ 12

2.1. COMMENTS ...................................................................................................................................................................................15


2.2. THE DATA TYPE .........................................................................................................................................................................16
Integers (int) ............................................................................................................................................................................ 17
The decimal (double) ......................................................................................................................................................... 17
The Boolean (bool)............................................................................................................................................................. 18
The object ................................................................................................................................................................................ 18
The string (string)................................................................................................................................................................ 18
The nothing value ................................................................................................................................................................19
The symbols ........................................................................................................................................................................... 20
2.3. THE VARIABLE ............................................................................................................................................................................ 21
Assigning a value ................................................................................................................................................................ 22
The math operators .......................................................................................................................................................... 23
Casting: Forcing a datatype ........................................................................................................................................28
2.4. COLLECTIONS ............................................................................................................................................................................ 33
Introducing List<> ..............................................................................................................................................................34
Invoking List<> .....................................................................................................................................................................35
Sneak peak at functions ................................................................................................................................................38
Accessing collection data ........................................................................................................................................... 40
Multi-dimensional lists ....................................................................................................................................................43
The array datatype ............................................................................................................................................................45
2.5. SUMMARY ..................................................................................................................................................................................... 47

3.1. CODE COMPLEXITY .............................................................................................................................................................. 50


3.2. COMMENTS, PART DEUX ....................................................................................................................................................51
3.3. VARIABLE NAMING ................................................................................................................................................................54

9
PROGRAMMING FOR BEGINNERS, THE FUNDAMENTALS

3.4. INTERMEDIARY VARIABLES .......................................................................................................................................... 55


3.5. THE FUNCTION ..........................................................................................................................................................................57
Function arguments ........................................................................................................................................................ 58
Returning values ................................................................................................................................................................ 60
Splitting up code ................................................................................................................................................................. 61
The black box ....................................................................................................................................................................... 70
3.6. SUMMARY ...........................................................................................................................................................................................71

4.1. MAKING CHOICES ...................................................................................................................................................................74


The condition ......................................................................................................................................................................... 74
The if-else construct ........................................................................................................................................................75
4.2. REPEATING CODE .................................................................................................................................................................. 78
Introducing the loop ........................................................................................................................................................ 78
The while-loop ......................................................................................................................................................................79
The for-loop ............................................................................................................................................................................82
Looping through collections ...................................................................................................................................... 85
The foreach loop ................................................................................................................................................................ 94
4.3. REUSING CODE ..........................................................................................................................................................................97
Functions ..................................................................................................................................................................................97
Libraries .................................................................................................................................................................................... 99
Language Framework ................................................................................................................................................... 101
4.4. SUMMARY ....................................................................................................................................................................................... 102
Summarizing the building blocks.......................................................................................................................... 102
Things we have not covered ................................................................................................................................... 104

5.1. THE CANVAS ............................................................................................................................................................................. 110


The Pixel ................................................................................................................................................................................. 110
The Pixel Color ................................................................................................................................................................... 112
The Screen Buffer ............................................................................................................................................................ 114
5.2. CREATING IMAGES ............................................................................................................................................................... 116
Filling the screen ............................................................................................................................................................... 117
Generating pictures ........................................................................................................................................................ 121
5.3. THE MANDELBROT FRACTAL..................................................................................................................................... 130
The base formula ............................................................................................................................................................. 130
Partial 2-Color Mandelbrot ....................................................................................................................................... 135
The full 2-Color Mandelbrot ..................................................................................................................................... 143
Fractal, V3: monochromatic ..................................................................................................................................... 160
Fractal, V3: full color ...................................................................................................................................................... 165
Some more examples .................................................................................................................................................. 168
5.4. CONCLUSION ........................................................................................................................................................................... 176
Onwards to part 2 .............................................................................................................................................................177

10
A Bearing E-Book

TABLE OF FIGURES
Figure 1-1 Traditional computing devices ............................................................................................................................................ 2
Figure 1-2 Non-traditional computing devices ................................................................................................................................... 2
Figure 1-3 Moving data.................................................................................................................................................................................3
Figure 1-4 The programming vehicle..................................................................................................................................................... 5
Figure 1-5 The compile process ............................................................................................................................................................... 6
Figure 1-6 Snapshot of in memory commands ................................................................................................................................... 7
Figure 1-7 Long term memory storage ................................................................................................................................................... 8
Figure 1-8 QR Code ........................................................................................................................................................................................ 9
Figure 1-9 Saving progress........................................................................................................................................................................ 9
Figure 1-10 Permanent storage fallback ............................................................................................................................................. 10
Figure 1-11 Memory blocks ....................................................................................................................................................................... 10
Figure 1-12 20k memory .............................................................................................................................................................................. 11
Figure 1-13 Storing string data ................................................................................................................................................................ 11
Figure 2-1 The concerns of a computer program ........................................................................................................................... 14
Figure 2-2 Stripping comments during compile process ............................................................................................................ 15
Figure 2-3 String comparison ................................................................................................................................................................. 17
Figure 2-4 Object holding collection of decimal numbers .......................................................................................................... 18
Figure 2-5 The String object .................................................................................................................................................................... 19
Figure 2-6 Empty String object ............................................................................................................................................................... 19
Figure 2-7 Data type symbols ................................................................................................................................................................. 20
Figure 2-8 Symbol usage examples .................................................................................................................................................... 20
Figure 2-9 The variable ............................................................................................................................................................................. 21
Figure 2-10 Storing data in memory through variable assignment ........................................................................................ 21
Figure 2-11 Assigning a value to a variable ...................................................................................................................................... 22
Figure 2-12 Matching data types and variables .............................................................................................................................24
Figure 2-13 Applying formula for circumference of a circle........................................................................................................24
Figure 2-14 Applying division and modulus operations .............................................................................................................25
Figure 2-15 Remainder only result ....................................................................................................................................................... 26
Figure 2-16 Elements of a divison......................................................................................................................................................... 26
Figure 2-17 Storing the wrong data type to a variable ................................................................................................................ 28
Figure 2-18 Automatic cast of integer value to decimal.............................................................................................................. 28
Figure 2-19 Multiplying an integer and decimal with decimal result ..................................................................................... 31
Figure 2-20 Multiplying an integer and decimal value with integer result ..........................................................................32
Figure 2-21 Collection types .................................................................................................................................................................... 33
Figure 2-22 Memory arrangement ...................................................................................................................................................... 35
Figure 2-23 Managing data with List<int> ....................................................................................................................................... 35
Figure 2-24 List containers ..................................................................................................................................................................... 36
Figure 2-25 Managing items with List<int> ......................................................................................................................................37
Figure 2-26 Object function..................................................................................................................................................................... 38
Figure 2-27 The Function definition ..................................................................................................................................................... 39
Figure 2-28 Calling functions on the List<> object ........................................................................................................................ 39
Figure 2-29 Memory arrangment in List object .............................................................................................................................. 40
Figure 2-30 Storing int in List<int> collection ................................................................................................................................... 41
Figure 2-31 Storing and representing 2-dimensional lists ........................................................................................................ 44
Figure 3-1 Documenting code with diagrams................................................................................................................................. 53
Figure 3-2 Function with input and output ........................................................................................................................................57
Figure 3-3 The ‘getPi’ function ............................................................................................................................................................... 58
Figure 3-4 The ‘add’ function with two inputs................................................................................................................................. 59
Figure 3-5 Slope of P1-P2 ......................................................................................................................................................................... 62

11
PROGRAMMING FOR BEGINNERS, THE FUNDAMENTALS

Figure 3-6 Ordinates of x1 and x2 on P1-P2 ......................................................................................................................................64


Figure 3-7 Calculating area of triangle...............................................................................................................................................65
Figure 3-8 Splitting up code in functions ..........................................................................................................................................66
Figure 3-9 Function inputs ....................................................................................................................................................................... 67
Figure 3-10 Black box ................................................................................................................................................................................. 70
Figure 4-1 Code flow for ‘isNegative’ ................................................................................................................................................... 77
Figure 4-2 The for-loop construct ......................................................................................................................................................... 78
Figure 4-3 List indexing ........................................................................................................................................................................... 80
Figure 4-4 Code flow for while-loop.................................................................................................................................................... 80
Figure 4-5 Elements of the for-loop statement ................................................................................................................................ 83
Figure 4-6 Elementwise multiplication of lists of integers..........................................................................................................86
Figure 4-7 Accessing third element by index...................................................................................................................................88
Figure 4-8 Setting the max index......................................................................................................................................................... 90
Figure 4-9 No match on “simon” ............................................................................................................................................................91
Figure 4-10 Returning from a function ................................................................................................................................................ 92
Figure 4-11 Matching on item “sam”....................................................................................................................................................93
Figure 4-12 Elements of foreach ............................................................................................................................................................94
Figure 4-13 The function ‘findTriangleArea’ ..................................................................................................................................... 97
Figure 4-14 An empty string object ......................................................................................................................................................98
Figure 4-15 Utilizing libraries .................................................................................................................................................................99
Figure 4-16 The function ........................................................................................................................................................................ 106
Figure 4-17 The object ............................................................................................................................................................................ 106
Figure 4-18 Function and property interfac eon object ............................................................................................................ 107
Figure 5-1 Screen parameters ............................................................................................................................................................. 110
Figure 5-2 The screen and the pixel ................................................................................................................................................... 111
Figure 5-3 Addressing pixels horizontally ........................................................................................................................................ 111
Figure 5-4 addressing rows...................................................................................................................................................................112
Figure 5-5 Component value .................................................................................................................................................................112
Figure 5-6 Component contributions for various colors ........................................................................................................... 113
Figure 5-7 The screen buffer................................................................................................................................................................. 114
Figure 5-8 Setting a pixel color in the screen buffer .................................................................................................................. 114
Figure 5-9 Modifying the screen buffer ........................................................................................................................................... 115
Figure 5-10 Function of two variables ............................................................................................................................................... 116
Figure 5-11 Algorithmic view of color-plotting ............................................................................................................................... 116
Figure 5-12 Traversing pixels horizontally .......................................................................................................................................117
Figure 5-13 Traversing lines ..................................................................................................................................................................117
Figure 5-14 Finding the max collection index ................................................................................................................................ 119
Figure 5-15 Traversing all pixels with nested for-loops ........................................................................................................... 120
Figure 5-16 Painting the screen black ............................................................................................................................................. 120
Figure 5-17 Painting screen with smoothing function ................................................................................................................ 122
Figure 5-18 Product as a function of position ................................................................................................................................ 123
Figure 5-19 Smooth as function of product p.................................................................................................................................123
Figure 5-20 Analyzing smooth output ...............................................................................................................................................124
Figure 5-21 Using the Math.Round function ................................................................................................................................... 125
Figure 5-22 Rounding decimals ..........................................................................................................................................................125
Figure 5-23 The sine and cosine functions ....................................................................................................................................126
Figure 5-24 Generated image with trigonometric functions ...................................................................................................128
Figure 5-25 More outputs based on trigonometric functions .................................................................................................128
Figure 5-26 The fractal feedback loop............................................................................................................................................. 130
Figure 5-27 Feedback system .............................................................................................................................................................. 133
Figure 5-28 The Mandelbrot feedback system ............................................................................................................................ 133
Figure 5-29 System explosion ............................................................................................................................................................. 134

12
A Bearing E-Book

Figure 5-30 Selecting colors ................................................................................................................................................................ 134


Figure 5-31 initializing the Mandelbrot system ............................................................................................................................ 137
Figure 5-32 Mixing old and new values ......................................................................................................................................... 138
Figure 5-33 The explode threshold .................................................................................................................................................. 138
Figure 5-34 The magnitude of ‘Z’........................................................................................................................................................ 139
Figure 5-35 Pythagoras .......................................................................................................................................................................... 139
Figure 5-36 Code flows for explode and settle scenarios ....................................................................................................... 141
Figure 5-37 Our first Mandelbrot plot ............................................................................................................................................... 142
Figure 5-38 The Mandelbrot system ................................................................................................................................................. 143
Figure 5-39 Seeded Mandelbrot system......................................................................................................................................... 143
Figure 5-40 Simplified Mandelbrot system diagram................................................................................................................. 144
Figure 5-41 The Mandelbrot space ................................................................................................................................................... 144
Figure 5-42 The screen space ............................................................................................................................................................. 145
Figure 5-43 Pixel coordinates.............................................................................................................................................................. 145
Figure 5-44 Mismatched coordinates ............................................................................................................................................. 146
Figure 5-45 Properly matched coordinates ( Screen space  Mandelbrot space ) .............................................. 146
Figure 5-46 Relative traversal in ‘x’ ................................................................................................................................................... 147
Figure 5-47 Relative traversal in ‘y’.................................................................................................................................................... 149
Figure 5-48 ‘getColør’ arguments ....................................................................................................................................................... 151
Figure 5-49 Moving from screen space to Mandelbrot space .............................................................................................. 152
Figure 5-50 Screen space and Mandelbrot space coordinates ................................................................................ 152
Figure 5-51 Ratios screen space to Mandelbrot space ............................................................................................................ 153
Figure 5-52 Coordinates for full Mandelbrot set .......................................................................................................................... 157
Figure 5-53 Output of Mandelbrot program .................................................................................................................................. 157
Figure 5-54 Selecting section of Mandelbrot set with ‘getColor’ .......................................................................................... 158
Figure 5-55 Converting Mandelbrot system output to color .................................................................................................... 161
Figure 5-56 Output of Mandelbrot generator program ............................................................................................................ 164
Figure 5-57 Defining color palette for colorization of Mandelbrot output ........................................................ 165
Figure 5-58 Color components for grey values ............................................................................................................................ 165
Figure 5-59 Output of Mandelbrot generator program , with individual color rates ................................................... 167
Figure 5-60 Output of Mandelbrot generator program , individual color rates, zoomed in ...................................... 167
Figure 5-61 Output of Mandelbrot generator program , adjusted multiplication factors ........................................... 169
Figure 5-62 ................................................................................................................................................................................................... 169
Figure 5-63 Output of Mandelbrot generator program , with relative size calculation ............................................... 170
Figure 5-64 Mandelbrot with explode limit at 150.000 .............................................................................................................. 171
Figure 5-65 Mandelbrot with bad magnitued estimate ........................................................................................................... 173
Figure 5-66 Output of Mandelbrot generator program , with broken magnitude estimate ....................... 173
Figure 5-67 Mandelbrot with trigonemtric calculations added............................................................................................. 175
Figure 5-68 Example output of our fractal image generator .................................................................................................. 175
Figure 5-69 Example output of our fractal image generator .................................................................................................. 176

13
PROGRAMMING FOR BEGINNERS, THE FUNDAMENTALS

14
A Bearing E-Book

Preface, or World, H el lo!


Having read quite a few programming books over the years, a majority of them
open with an example that write the text "Hello, World" to the screen.

The idea behind this approach is to give a


short and simple example of building
something, at least vaguely useful. It is a piece
of code meant to make the student go "hey,
that wasn't so difficult". It gives you a sense of
having created something early on.

Next, authors would provide examples on


simple text or number manipulation, or
perhaps creating a simple input form. Stuff that would find its way into a basic
application such as a calculator or perhaps a text editor.

Not exactly engaging stuff. I always felt an introduction to programming should


start with something visually exciting. Something that would catch your
attention while being so complex that it would take a computer to do so.

Now, where do we find a topic that covers all of this, while also being simple
enough for complete beginners to grasp?

When I set out to learn a new


programming language, the first thing I
will try on my own, is to make a color
plot of a 2D function.

I do not go by a specific function, but


randomly choose some complicated
function. Not for any other reason, but
to create something interesting and
colorful.

Eventually this approach has led me to the wonder of fractals. You have
probably seen them in their various shapes at some point. They come in
different forms, but all have this recognizable complex quality to them.

15
PROGRAMMING FOR BEGINNERS, THE FUNDAMENTALS

The image below shows a section of a fractal known as the Mandelbrot fractal.

It looks like the code needed to create this is very complex. Luckily, that is not
the case at all. In fact, the nice thing about fractals is exactly that. They exhibit
complex properties, but are born from very simple rules.

If you were feeling brave, you could actually do the calculations by hand. The
calculations only require basic math skills, but you would need a lot of extra time
on your hands. A high-resolution image could require hundreds of millions of
calculations. It would take you a lifetime by hand, but with the help of a
computer, you can have the image ready in seconds.

I raised some criteria for what, in my opinion, is a good introductory learning


resource on programming. The undertaking of building a fractal generator
seems to fulfill these:

 I Fractals are complex and colorful.

 It only requires basic math and programming skills

 It gives your computer a run for the money

It sounds a lot more fun than building a calculator app, doesn’t it?

16
A Bearing E-Book

The learning process

Learning can be quite the battle sometimes. Complex


topics explained in books apparently written by mad
scientists. Sometimes there are just too much going on.

Depending on what topic you are trying to learn, it will take


an effort. As well it should, but it would be nice if you could
learn without all the headaches.

A good introductory book should cover everything you


need to know, but no more. It should not be too long. You should have a fighting
chance at completing it over a weekend or two.

The problem with programming is that you need to understand both the big
picture and the small picture all at once.

Without context, programming can seem remarkably alien. With context, it is


quite straightforward. Well, most of the time anyway.

The plan of attack

I firmly believe in learning by It helps you to


understand the theory and to retain what you
have learned.

It may then come as a surprise, that going through


this book; I will not have you write a single line of
code! It may seem contradictory, but bear with
me. There is a method to the madness.

This introdcution to programming spans two volumes or two books:

is the book you are reading now. It aims to introduce you to the basic
concepts of programming as succinctly as possible.

walks you through all material from , but in the context of writing
and executing code.

17
PROGRAMMING FOR BEGINNERS, THE FUNDAMENTALS

There is a lot of ground to cover. We must choose a programming language and


development environment. We have to learn how to compile and run programs.
Chances are your the program does not work, so you will have to learn about
debugging and testing.

In general, there are alot of dependencies. Most of these are possible to learn
just fine, but we want to avoid having to worry about too many details all at once.

That is why I shall save all those gritty details for “Volume 2”. In this book, we
will only focus on the matter at hand; the basics of programming. We want to
explore programming concepts and the language we use to implement them.
We shall do so in the scope of building a graphical application.

The book

Learning should be fun. Making the computer write


‘Hello World’ on the screen is not my idea of fun.
Colors are fun. Graphics are fun.

Therefore, Instead of taking the traditional route, we


shall take a slightly more exciting path. This book is
written around one specific goal; to build a working
“fractal image generator”. Each time we introduce a new concept, it is to
progress towards this goal. Well mostly. I may occasionally broaden the scope
for context, but the aim is to build that generator as quickly as possible.

The examples

Technical books must often convey facts


that belong in some esoteric technical
domain.

Authors may try to make such facts easier to


digest by placing the subject in a familiar
context.

18
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
A Bearing E-Book

The problem with this approach is that I


would have to make assumptions about
what you find familiar or agreeable.

From the perspective of the reader, nothing


is quite as frustrating as having to wade
through examples on laundromats, train
schedules, sewing machines, or some other
mundane topic the author found interesting.

Some books tend to go light-hearted, humorous and somewhat kooky to punch


the material through. The problem is the same. If the author’s sense of humour
does not match yours, it ends up getting in the way rather than help.

The approach in this book is therefore to avoid generalized mundane examples


and kooky writing as much as possible. There is a red thread throughout the
book, which will guide our choice of examples. The occasional pun may sneak
in, but hopefully not enough to sabotage your learning process.

If you hate fractals with a passion, I guess you are out of luck though. My sincere
apologies about that.

The student

You do not have to arm yourself with pen and paper to read this book. Just come
at it casually, but with an openminded attitude and an intention to learn. Try to
focus on the main concepts presented. Most important of all; take your time.

There will be examples and explanations where I use math,


formulas and diagrams to help clarifying topics. They are
there to help you understand.

If you feel they do not help, skip them. Just skim through til
you reach the next paragraph. Try to make a note of the
programming concept being taught, but do not get hung up
on the content of examples.

19
PROGRAMMING FOR BEGINNERS, THE FUNDAMENTALS

Avoid letting frustration derail you. Focus on the big picture and your intention
to learn.

I will repeat myself throughout the book, so chances are you will have more than
one chance at comprehending a specific topic.

The outcome

My goal in this book is simply to expose you to programming concepts. At the


end of the book, you will have seen the most common concepts in use.

Chances are you will not be able to write


working programs yet, but you should be well
prepared for what comes next.

In “Volume 2: Creating code” I will teach you


all you need to know in terms of actually
building the software.

If you find fractals or perhaps graphics as


interesting as I do, chances are you will be well motivated to write code of your
own before you reach the end of the next volume.

What comes next

Once you feel you grokked everything in this book, it is time to get your feet wet.

In “Volume 2: Creating code” I will show you exactly how to get up and running
with your programming environment and producing applications of your own.

Since content in the next volume deal with specifics on creating code, it ties in
with specifics of programming such as choice of programming language and
environment.

Different languages will implement the same concepts in their own way.
Sometimes the only difference is in naming schemes, other times there are
conceptual differences

20
A Bearing E-Book

I have planned multiple language editions of the second volume. Either book will
follow the outline laid in this book, but the chosen language will dictate the final
form of each book.

The first two editions are based around ‘Visual C#’ and ‘Python’. God willing, I
will be able to expand the selection with editions covering more languages and
perhaps on multiple platforms.

21
PROGRAMMING FOR BEGINNERS, THE FUNDAMENTALS

22
CHAPTER 1
The Background
Random documents with unrelated
content Scribd suggests to you:
The Project Gutenberg eBook of Iamblichus'
Life of Pythagoras, or Pythagoric Life
This ebook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this ebook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

Title: Iamblichus' Life of Pythagoras, or Pythagoric Life

Author: Iamblichus

Translator: Thomas Taylor

Release date: September 26, 2020 [eBook #63300]

Language: English

Credits: Produced by MFR, Stephen Hutcheson, and the Online


Distributed Proofreading Team at
https://www.pgdp.net (This
file was produced from images generously made
available
by The Internet Archive)

*** START OF THE PROJECT GUTENBERG EBOOK IAMBLICHUS'


LIFE OF PYTHAGORAS, OR PYTHAGORIC LIFE ***
IAMBLICHUS’
LIFE OF PYTHAGORAS,
OR
PYTHAGORIC LIFE.
ACCOMPANIED BY
FRAGMENTS OF THE ETHICAL WRITINGS
OF CERTAIN PYTHAGOREANS IN THE DORIC DIALECT;
AND A

Collection of Pythagoric Sentences


FROM STOBÆUS AND OTHERS,
WHICH ARE OMITTED BY GALE IN HIS
OPUSCULA MYTHOLOGICA,
AND HAVE NOT BEEN NOTICED BY ANY EDITOR.

TRANSLATED FROM THE GREEK.

BY THOMAS TAYLOR.

Approach ye genuine philosophic few,


The Pythagoric Life belongs to you:
But far, far off ye vulgar herd profane;
For Wisdom’s voice is heard by you in vain:
And you, Mind’s lowest link, and darksome end,
Good Rulers, Customs, Laws, alone can mend.
LONDON:
PRINTED BY A. J. VALPY,
TOOKE’S COURT, CHANCERY LANE;
AND SOLD BY THE AUTHOR,
9, MANOR PLACE, WALWORTH.
1818.
CONTENTS
The Life, &c.
Chap. I 1
Chap. II 2
Chap. III 9
Chap. IV 12
Chap. V 13
Chap. VI 18
Chap. VII 21
Chap. VIII 23
Chap. IX 28
Chap. X 32
Chap. XI 34
Chap. XII 38
Chap. XIII 40
Chap. XIV 41
Chap. XV 43
Chap. XVI 48
Chap. XVII 50
Chap. XVIII 56
Chap. XIX 66
Chap. XX 69
Chap. XXI 71
Chap. XXII 73
Chap. XXIII 75
Chap. XXIV 77
Chap. XXV 80
Chap. XXVI 83
Chap. XXVII 89
Chap. XXVIII 97
Chap. XXIX 114
Chap. XXX 122
Chap. XXXI 135
Chap. XXXII 151
Chap. XXXIII 162
Chap. XXXIV 170
Chap. XXXV 176
Chap. XXXVI 188
Fragments of the Ethical Writings of Certain Pythagoreans 193
From Hippodamus, the Thurian, in his Treatise on Felicity 195
From Euryphamus, in his Treatise Concerning Human Life 202
From Hipparchus, in his Treatise On Tranquillity 207
From Archytas, in his Treatise Concerning the Good and Happy
Man
212
From Theages, in his Treatise On the Virtues 222
From Metopus, in his Treatise Concerning Virtue 227
From Clinias 231
From Theages, in his Treatise On the Virtues 233
From the Treatise of Archytas On Ethical Erudition 242
From Archytas, in his Treatise On the Good and Happy Man 244
From Crito, in his Treatise On Prudence and Prosperity 245
From Archytas, in his Treatise On the Good and Happy Man 250
From Archytas, in his Treatise On Disciplines 252
From Polus, in his Treatise On Justice 254
Pythagoric Ethical Sentences from Stobæus, which are omitted
in the Opuscula Mythologica, &c. of Gale
259
Select Sentences of Sextus the Pythagorean 268
Pythagoric Sentences, from the Protreptics of Iamblichus 278
Additional Notes 281

v
INTRODUCTION.
When it is considered that Pythagoras was the father of philosophy,
authentic memoirs of his life cannot fail to be uncommonly
interesting to every lover of wisdom, and particularly to those who
reverence the doctrines of Plato, the most genuine and the best of
all his disciples. And that the following memoirs of Pythagoras by
Iamblichus are authentic, is acknowledged by all the critics, as they
are for the most part obviously derived from sources of very vi
high antiquity; and where the sources are unknown, there is
every reason to believe, from the great worth and respectability of
the biographer, that the information is perfectly accurate and true.

Of the biographer, indeed, Iamblichus, it is well known to every tyro


in Platonism that he was dignified by all the Platonists that
succeeded him with the epithet of divine; and after the encomium
passed on him by the acute Emperor Julian, “that he was posterior
[1]
indeed in time, but not in genius, to Plato,” all further praise of
him would be as unnecessary, as the defamation of him by vii
certain modern critics is contemptible and idle. For these
homonculi looking solely to his deficiency in point of style, and not to
the magnitude of his intellect, perceive only his little blemishes, but
have not even a glimpse of his surpassing excellence. They minutely
notice the motes that are scattered in the sunbeams of his genius,
but they feel not its invigorating warmth, they see not its dazzling
radiance.

Of this very extraordinary man there is a life extant by Eunapius, the


substance of which I have given in my History of the Restoration of
the Platonic Theology, and to which I refer the English reader. At
present I shall only select from that work the following biographical
particulars respecting our Iamblichus: He was descended of a viii
family equally illustrious, fortunate, and rich. His country was
Chalcis, a city of Syria, which was called Cœle. He associated with
Anatolius who was the second to Porphyry, but he far excelled him in
his attainments, and ascended to the very summit of philosophy. But
after he had been for some time connected with Anatolius, and most
probably found him insufficient to satisfy the vast desires of his soul,
he applied himself to Porphyry, to whom (says Eunapius) he was in
nothing inferior, except in the structure and power of composition.
For his writings were not so elegant and graceful as those of
Porphyry: they were neither agreeable, nor perspicuous; nor free
from impurity of diction. And though they were not entirely involved
in obscurity, and perfectly faulty; yet as Plato formerly said of
Xenocrates, he did not sacrifice to the Mercurial Graces. Hence he is
far from detaining the reader with delight, who merely regards ix
his diction; but will rather avert and dull his attention, and
frustrate his expectation. However, though the surface of his
conceptions is not covered with the flowers of elocution, yet the
depth of them is admirable, and his genius is truly sublime. And
admitting his style to abound in general with those defects, which
have been noticed by the critics, yet it appears to me that the
decision of the anonymous Greek writer respecting his Answer to the
[2]
Epistle of Porphyry, is more or less applicable to all his other
works. For he says, ‘that his diction in that Answer is concise and
definite, and that his conceptions are full of efficacy, are elegant,
[3]
and divine.’

Iamblichus shared in an eminent degree the favor of divinity, on x


account of his cultivation of justice; and obtained a numerous
multitude of associates and disciples, who came from all parts of the
world, for the purpose of participating the streams of wisdom, which
so plentifully flowed from the sacred fountain of his wonderful mind.
[4]
Among these was Sopater the Syrian, who was most skilful both in
speaking and writing; Eustathius the Cappadocian; and of the
Greeks, Theodorus and Euphrasius. All these were excellent for their
virtues and attainments, as well as many other of his disciples, who
were not much inferior to the former in eloquence; so that it xi
seems wonderful how Iamblichus could attend to all of them,
with such gentleness of manners and benignity of disposition as he
continually displayed.

He performed some few particulars relative to the veneration of


divinity by himself, without his associates and disciples; but was
inseparable from his familiars in most of his operations. He imitated
in his diet the frugal simplicity of the most ancient times; and during
his repast, exhilarated those who were present by his behaviour, and
filled them as with nectar by the sweetness of his discourse.

A celebrated philosopher named Alypius, who was deeply skilled in


dialectic, was contemporary with Iamblichus, but was of such a
diminutive stature, that he exhibited the appearance of a xii
pigmy. However, his great abilities amply compensated for this
trifling defect. For his body might be said to be consumed into soul;
just as the great Plato says, that divine bodies, unlike those that are
mortal, are situated in souls. Thus also it might be asserted of
Alypius, that he had migrated into soul, and that he was contained
and governed by a nature superior to man. This Alypius had many
followers, but his mode of philosophizing was confined to private
conference and disputation, without committing any of his dogmas
to writing. Hence his disciples gladly applied themselves to
Iamblichus, desirous to draw abundantly from the exuberant streams
of his inexhaustible mind. The fame therefore of each continually
increasing, they once accidentally met like two refulgent stars, and
were surrounded by so great a crowd of auditors, that it xiii
resembled some mighty musæum. While Iamblichus on this
occasion waited rather to be interrogated, than to propose a
question himself, Alypius, contrary to the expectation of every one,
relinquishing philosophical discussions, and seeing himself
surrounded with a theatre of men, turned to Iamblichus, and said to
him: “Tell me, O philosopher, is either the rich man unjust, or the
heir of the unjust man? For in this case there is no medium.” But
Iamblichus hating the acuteness of the question, replied: “O most
wonderful of all men, this manner of considering, whether some one
excels in externals, is foreign from our method of philosophizing;
since we inquire whether a man abounds in the virtue which it is
proper for him to possess, and which is adapted to a philosopher.”
After he had said this he departed, and at the same time all the
surrounding multitude was immediately dispersed. But xiv
Iamblichus, when he was alone, admired the acuteness of the
question, and often privately resorted to Alypius, whom he very
much applauded for his acumen and sagacity; so that after his
decease, he wrote his life. This Alypius was an Alexandrian by birth,
and died in his own country, worn out with age: and after him
[5]
Iamblichus, leaving behind him many roots and fountains of
philosophy; which through the cultivation of succeeding Platonists,
produced a fair variety of vigorous branches, and copious streams.

For an account of the theological writings of Iamblichus, I refer the


reader to my above-mentioned History of the Restoration of xv
the Platonic Theology; and for accurate critical information
concerning all his works, to the Bibliotheca Græca of Fabricius.

Of the following work, the life of Pythagoras, it is necessary to


observe that the original has been transmitted to us in a very
imperfect state, partly from the numerous verbal errors of the text,
partly from the want of connexion in the things that are narrated,
and partly from many particulars being related in different places, in
the very same words; so that the conjecture of Kuster, one of the
German editors of this work is highly probable, that it had not
received the last hand of Iamblichus, but that others formed this
treatise from the confused materials which they found among his
Manuscripts, after his death. Notwithstanding all its defects, xvi
however, it is, as I have before observed, a most interesting
work; and the benefits are inestimable, which the dissemination of it
is calculated to produce. And as two of the most celebrated critics
among the Germans, Kuster and Kiessling, have given two splendid
editions of this work, it is evident they must have been deeply
impressed with a conviction of its value and importance.

As to the Pythagoric Ethical Fragments, all eulogy of them is


superfluous, when it is considered that, independently of their being
written by very early Pythagoreans, they were some of the sources
from which Aristotle himself derived his consummate knowledge of
morality, as will be at once evident by comparing his Nicomachean
Ethics with these fragments.

With respect to the collection of Pythagoric Sentences in this xvii


volume, it is almost needless to observe that they are
incomparably excellent; and it is deeply to be regretted that the
[6]
Greek original of the Sentences of Sextus being lost, the
fraudulent Latin version of them by the Presbyter Ruffinus alone
remains. I call it a fraudulent version, because Ruffinus, wishing to
persuade the reader that these Sentences were written by a bishop
of the name of Sixtus, has in many places perverted and
contaminated the meaning of the original. In the selection, however,
which I have made from these Sentences, I have endeavoured, and
I trust not in vain, to give the genuine sense of Sextus, xviii
unmingled with the barbarous and polluted interpolations of
Ruffinus. If the English reader has my translation of the Sentences
of Demophilus, and Mr. Bridgman’s translation of the Golden
[7]
Sentences of Democrates, and the Similitudes of Demophilus, he
will then be possessed of all the Pythagoric Sentences that are
extant, those alone of Sextus excepted, which I have not translated,
in consequence of the very impure and spurious state, in which they
at present exist.

I deem it also requisite to observe, that the Pythagoric life which is


here delineated, is a specimen of the greatest perfection in virtue
and wisdom, which can be obtained by man in the present xix
state. Hence, it exhibits piety unadulterated with folly, moral
virtue uncontaminated with vice, science unmingled with sophistry,
dignity of mind and manners unaccompanied with pride, a sublime
magnificence in theory, without any degradation in practice, and a
vigor of intellect, which elevates its possessor to the vision of
divinity, and thus deifies while it exalts.

The original of the engraving of the head of Iamblichus in the title-


page, is to be found at the end of a little volume consisting of Latin
translations of Iamblichus De Mysteriis, Proclus On the First
Alcibiades of Plato, &c. &c. &c. 18mo. Genev. 1607. This engraving
was added because it appeared to me to be probable that the
original was copied from an ancient gem. And as it is not xx
impossible that it was, if it is not genuine, it is at least
ornamental.

1
THE LIFE,
&c.

CHAP. I.

Since it is usual with all men of sound understandings, to call on


divinity, when entering on any philosophic discussion, it is certainly
much more appropriate to do this in the consideration of that
philosophy which justly receives its denomination from the divine
Pythagoras. For as it derives its origin from the Gods, it cannot be
apprehended without their inspiring aid. To which we may also add,
that the beauty and magnitude of it so greatly surpasses human
power, that it is impossible to survey it by a sudden view; but then
alone can any one gradually collect some portion of this philosophy,
when, the Gods being his leaders, he quietly approaches to it. On all
these accounts, therefore, having invoked the Gods as our leaders,
and converting both ourselves and our discussion to them, we shall
acquiesce in whatever they may command us to do. We shall not,
however, make any apology for this sect having been neglected for a
long time, nor for its being concealed by foreign disciplines, and
certain arcane symbols, nor for having been obscured by false 2
and spurious writings, nor for many other such-like difficulties
by which it has been impeded. For the will of the Gods is sufficient
for us, in conjunction with which it is possible to sustain things still
more arduous than these. But after the Gods, we shall unite
ourselves as to a leader, to the prince and father of this divine
philosophy; of whose origin and country we must rise a little higher
in our investigation.

CHAP. II.
It is said, therefore, that Ancæus who dwelt in Samos in
Cephallenia, was begot by Jupiter, whether he derived the fame of
such an honorable descent through virtue, or through a certain
greatness of soul. He surpassed, however, the rest of the
Cephallenians in wisdom and renown. This Ancæus, therefore, was
ordered by the Pythian oracle to form a colony from Arcadia and
Thessaly; and that besides this, taking with him some of the
inhabitants of Athens, Epidaurus, and Chalcis, and placing himself at
their head, he should render an island habitable, which from the
[8]
virtue of the soil and land should be called Melamphyllos; and that
he should call the city Samos, on account of Same in 3
Cephallenia. The oracle, therefore, which was given to him, was
as follows: “I order you, Ancæus, to colonise the marine island
Samos instead of Same, and to call it Phyllas.” But that a colony was
collected from these places, is not only indicated by the honors and
sacrifices of the Gods, transferred into those regions together with
the inhabitants, but also by the kindred families that dwell there,
and the associations of the Samians with each other.

It is said, therefore, that Mnesarchus and Pythaïs, who were the


parents of Pythagoras, descended from the family and alliance of
this Ancæus, who founded the colony. In consequence, however, of
this nobility of birth being celebrated by the citizens, a certain
Samian poet says, that Pythagoras was the son of Apollo. For thus
he sings,

Pythaïs, fairest of the Samian tribe,


Bore from th’embraces of the God of day
Renown’d Pythagoras, the friend of Jove.

It is worth while, however, to relate how this report became so


prevalent. The Pythian oracle then had predicted to this Mnesarchus
(who came to Delphi for the purposes of merchandize, with his wife
not yet apparently pregnant, and who inquired of the God
concerning the event of his voyage to Syria) that his voyage would
be lucrative and most conformable to his wishes, but that his 4
wife was now pregnant, and would bring forth a son surpassing
in beauty and wisdom all that ever lived, and who would be of the
greatest advantage to the human race in every thing pertaining to
the life of man. But, when Mnesarchus considered with himself, that
the God, without being interrogated concerning his son, had
informed him by an oracle, that he would possess an illustrious
prerogative, and a gift truly divine, he immediately named his wife
Pythaïs, from her son and the Delphic prophet, instead of Parthenis,
which was her former appellation; and he called the infant, who was
soon after born at Sidon in Phœnicia, Pythagoras; signifying by this
appellation, that such an offspring was predicted to him by the
Pythian Apollo. For we must not regard the assertions of
Epimenides, Eudoxus, and Xenocrates, who suspect that Apollo at
that time, becoming connected with Parthenis, and causing her to be
pregnant from not being so, had in consequence of this predicted
concerning Pythagoras, by the Delphic prophet: for this is by no
[9]
means to be admitted. Indeed, no one can doubt that the 5
soul of Pythagoras was sent to mankind from the empire of
Apollo, either being an attendant on the God, of co-arranged 6
with him in some other more familiar way: for this may be
inferred both from his birth, and the all-various wisdom of his soul.
And thus much concerning the nativity of Pythagoras.

But after his father Mnesarchus had returned from Syria to Samos,
with great wealth, which he had collected from a prosperous
navigation, he built a temple to Apollo, with the inscription of
Pythius; and took care to have his son nourished with various and
the best disciplines, at one time by Creophilus, at another by
Pherecydes the Syrian, and at another by almost all those who
presided over sacred concerns, to whom he earnestly recommended
Pythagoras, that he might be as much as possible sufficiently
instructed in divine concerns. He, however, was educated in such a
manner, as to be fortunately the most beautiful and godlike of all
those that have been celebrated in the annals of history. On the
death of his father, likewise, though he was still but a youth, his
aspect was most venerable, and his habits most temperate, so that
he was even reverenced and honored by elderly men; and converted
the attention of all who saw and heard him speak, on himself, and
appeared to be an admirable person to every one who beheld 7
him. Hence it was reasonably asserted by many, that he was
the son of a God. But he being corroborated by renown of this kind,
by the education which he had received from his infancy, and by his
natural deiform appearance, in a still greater degree evinced that he
deserved his present prerogatives. He was also adorned by piety and
disciplines, by a mode of living transcendency good, by firmness of
soul, and by a body in due subjection to the mandates of reason. In
all his words and actions, he discovered an inimitable quiet and
serenity, not being subdued at any time by anger, or laughter, or
emulation, or contention, or any other perturbation or precipitation
of conduct; but he dwelt at Samos like some beneficent dæmon.
Hence, while he was yet a youth, his great renown having reached
Thales at Miletus, and Bias at Priene, men illustrious for their
wisdom, it also extended to the neighbouring cities. To all which we
may add, that the youth was every where celebrated as the long-
haired Samian, and was reverenced by the multitude as one under
the influence of divine inspiration. But after he had attained the
eighteenth year of his age, about the period when the tyranny of
Policrates first made its appearance, foreseeing that under such a
government he might receive some impediment in his studies, which
engrossed the whole of his attention, he departed privately by night
with one Hermodamas (whose surname was Creophilus, and 8
who was the grandson of him who had formerly been the host,
friend, and preceptor in all things of Homer the poet,) to
Pherecydes, to Anaximander the natural philosopher, and to Thales
at Miletus. He likewise alternately associated with each of these
philosophers, in such a manner, that they all loved him, admired his
natural endowments, and made him a partaker of their doctrines.
Indeed, after Thales had gladly admitted him to his intimate
confidence, he admired the great difference between him and other
young men, whom Pythagoras left far behind in every
accomplishment. And besides this, Thales increased the reputation
Pythagoras had already acquired, by communicating to him such
disciplines as he was able to impart: and, apologizing for his old age,
and the imbecility of his body, he exhorted him to sail into Egypt,
[10]
and associate with the Memphian and Diospolitan priests. For he
confessed that his own reputation for wisdom, was derived from the
instructions of these priests; but that he was neither naturally, nor
by exercise, endued with those excellent prerogatives, which were
so visibly displayed in the person of Pythagoras. Thales, therefore,
gladly announced to him, from all these circumstances, that he
would become the wisest and most divine of all men, if he
associated with these Egyptian priests.

9
CHAP. III.

Pythagoras, therefore, having been benefited by Thales in other


respects, and especially having learned from him to be sparing of his
time; for the sake of this he entirely abstained from wine and animal
food, and still prior to these from voracity, and confined himself to
such nutriment as was slender and easy of digestion. In
consequence of this, his sleep was short, his soul vigilant and pure,
and his body confirmed in a state of perfect and invariable health. In
possession of such advantages, therefore, he sailed to Sidon, being
persuaded that this was his natural country, and also properly
conceiving that he might easily pass from thence into Egypt. Here he
conversed with the prophets who were the descendants of Mochus
the physiologist, and with others, and also with the Phœnician
hierophants. He was likewise initiated in all the mysteries of Byblus
and Tyre, and in the sacred operations which are performed in many
parts of Syria; not engaging in a thing of this kind for the sake of
superstition, as some one may be led to suppose, but much rather
from a love and desire of contemplation, and from an anxiety that
nothing might escape his observation which deserved to be learnt in
the arcana or mysteries of the Gods. Having been previously
instructed therefore in the mysteries of the Phœnicians, which 10
were derived like a colony and a progeny from the sacred rites
in Egypt, and hoping from this circumstance that he should be a
partaker of more beautiful, divine, and genuine monuments of
erudition in Egypt; joyfully calling to mind also the admonitions of
his preceptor Thales, he immediately embarked for Egypt, through
the means of some Egyptian sailors, who very opportunely at that
time landed on the Phœnician coast under mount Carmelus, in
whose temple Pythagoras, separated from all society, for the most
part dwelt. But the sailors gladly received him, foreseeing that they
should acquire great gain by exposing him to sale. But when, during
the voyage, they perceived with what continence and venerable
gravity he conducted himself, in conformity to the mode of living he
had adopted, they were more benevolently disposed towards him.
Observing, likewise, that there was something greater than what
pertains to human nature in the modesty of the youth, they called to
mind how unexpectedly he had appeared to them on their landing,
when from the summit of mount Carmelus, which they knew was
more sacred than other mountains, and inaccessible to the vulgar,
he leisurely descended without looking back, or suffering any delay
from precipices or opposing stones; and that when he came to the
boat, he said nothing more than, “Are you bound for Egypt?” 11
And farther, that on their answering in the affirmative, he
ascended the ship and sate silent the whole time of the voyage, in
that part of the vessel where he was not likely to incommode the
occupations of the sailors. But Pythagoras remained in one and the
same unmoved state for two nights and three days, neither
partaking of food, nor drink, nor sleep, unless perhaps as he sate in
that firm and tranquil condition, he might sleep for a short time
unobserved by all the sailors. To which we may add, that when the
sailors considered how, contrary to their expectations, their voyage
had been continued and uninterrupted, as if some deity had been
present; putting all these things together, they concluded that a
divine dæmon had in reality passed over with them from Syria into
Egypt. Hence, speaking both to Pythagoras and to each other with
greater decorum and gentleness than before, they completed,
through a most tranquil sea, the remainder of their voyage, and at
length happily landed on the Egyptian coast. Here the sailors
reverently assisted him in descending from the ship; and after they
had placed him on the purest sand, they raised a certain temporary
altar before him, and heaping on it from their present abundance
the fruits of trees, and presenting him as it were with the first fruits
of their freight, they departed from thence, and hastened to their
destined port. But Pythagoras, whose body through such long 12
fasting was become weaker, did not oppose the sailors in
assisting him to descend from the ship, and immediately on their
departure eat as much of the fruits as was requisite to restore his
decayed strength. From thence also he arrived safe at the
neighbouring lands, constantly preserving the same tranquillity and
modesty of behaviour.

CHAP. IV.

But here, while he frequented all the Egyptian temples with the
greatest diligence and with accurate investigation, he was both
admired and loved by the priests and prophets with whom he
associated. And having learnt with the greatest solicitude every
particular, he did not neglect to hear of any transaction that was
celebrated in his own time, or of any man famous for his wisdom, or
any mystery in whatever manner it might be performed; nor did he
omit to visit any place in which he thought something more excellent
might be found. On this account he went to all the priests, by whom
he was furnished with the wisdom which each possessed. He spent
therefore two and twenty years in Egypt, in the adyta of temples,
astronomizing and geometrizing, and was initiated, not in a
superficial or casual manner, in all the mysteries of the Gods, till at
length being taken captive by the soldiers of Cambyses, he 13
was brought to Babylon. Here he gladly associated with the
Magi, was instructed by them in their venerable knowledge, and
learnt from them the most perfect worship of the Gods. Through
their assistance likewise, he arrived at the summit of arithmetic,
music, and other disciplines; and after associating with them twelve
years, he returned to Samos about the fifty-sixth year of his age.

CHAP. V.

On his return to Samos, however, being known by some of the more


aged inhabitants, he was not less admired than before. For he
appeared to them to be more beautiful and wise, and to possess a
divine gracefulness in a more eminent degree. Hence, he was
publicly called upon by his country to benefit all men, by imparting
to them what he knew. Nor was he averse to this request, but
endeavoured to introduce the symbolical mode of teaching, in a way
perfectly similar to the documents by which he had been instructed
in Egypt; though the Samians did not very much admit this mode of
tuition, and did not adhere to him with that according aptitude which
was requisite. Though no one therefore attended to him, and no one
was genuinely desirous of those disciplines which he 14
endeavoured by all means to introduce among the Greeks, yet
he neither despised nor neglected Samos, because it was his
country, and therefore wished to give his fellow-citizens a taste of
the sweetness of the mathematical disciplines, though they were
unwilling to be instructed in them. With a view to this, therefore, he
employed the following method and artifice. Happening to observe a
certain youth, who was a great lover of gymnastic and other
corporeal exercises, but otherwise poor and in difficult
circumstances, playing at ball in the Gymnasium with great aptness
and facility, he thought the young man might easily be persuaded to
attend to him, if he was sufficiently supplied with the necessaries of
life, and freed from the care of procuring them. As soon as the
youth, therefore, left the bath, Pythagoras called him to him, and
promised that he would furnish him with every thing requisite to the
support of his bodily exercise, on condition that he would receive
from him gradually and easily, but continually, so that he might not
be burthened by receiving them at once, certain disciplines, which
he said he had learnt from the Barbarians in his youth, but which
now began to desert him through forgetfulness and the incursions of
old age. But the young man immediately acceded to the conditions,
through the hope of having necessary support. Pythagoras,
therefore, endeavoured to instruct him in the disciplines of
arithmetic and geometry, forming each of his demonstrations 15
in an abacus, and giving the youth three oboli as a reward for
every figure which he learnt. This also he continued to do for a long
time, exciting him to the geometrical theory by the desire of honour;
diligently, and in the best order, giving him (as we have said) three
oboli for every figure which he apprehended. But when the wise
man observed that the elegance, sweetness, and connexion of these
disciplines, to which the youth had been led in a certain orderly
path, had so captivated him that he would not neglect their pursuit
though he should suffer the extremity of want, he pretended
poverty, and an inability of giving him three oboli any longer. But the
youth on hearing this replied, “I am able without these to learn and
receive your disciplines.” Pythagoras then said, “But I have not the
means of procuring sufficient nutriment for myself.” As it is requisite,
therefore, to labour in order to procure daily necessaries and mortal
food, it would not be proper that his attention should be distracted
by the abacus, and by stupid and vain pursuits. The youth, however,
vehemently abhorring the thought of discontinuing his studies,
replied: “I will in future provide for you, and repay your kindness in
a way resembling that of the stork: for I in my turn will give you
three oboli for every figure.” And from this time he was so captivated
by these disciplines, that he alone, of all the Samians, migrated from
his country with Pythagoras, having the same name with him, 16
but being the son of Eratocles. There are said to be three
books of this Samian On Athletics, in which he orders the Athletæ to
feed on flesh instead of dry figs; which books are very improperly
ascribed by some to Pythagoras the son of Mnesarchus. It is likewise
said, that about the same time Pythagoras was admired at Delos,
when he approached to the bloodless altar, as it is called, of the
father Apollo, and worshipped it. After which he went to all the
oracles. He likewise dwelt for some time in Crete and Sparta, for the
purpose of becoming acquainted with their laws; and, having been
an auditor and learner of all these, he returned home in order to
investigate what he had omitted. And in the first place, indeed, he
established a school in the city, which is even now called the
semicircle of Pythagoras; and in which the Samians now consult
about public affairs, conceiving it right to investigate things just and
advantageous in that place which he had constructed who paid
attention to the welfare of all men. He also formed a cavern out of
the city, adapted to his philosophy, in which he spent the greatest
part both of the day and night; employing himself in the
investigation of things useful in disciplines, framing intellectual
conceptions after the same manner as Minos the son of Jupiter.
Indeed, he so much surpassed those who afterwards employed his
disciplines, that they conceived magnificently of themselves, 17
from the knowledge of theorems of small importance; but
Pythagoras gave completion to the science of the celestial orbs, and
unfolded the whole of it by arithmetical and geometrical
demonstrations. He is, however, to be admired in a still greater
degree for what he afterwards accomplished. For when now
philosophy had received a great accession, he was admired by all
Greece, and the best of those who philosophized came to Samos on
his account, in order that they might participate of his erudition. The
citizens likewise employed him in all their embassies, and compelled
him to unite with them in the administration of public affairs.
However, as he easily saw the difficulty of complying with the laws
of his country, and at the same time remaining at home and
philosophizing, and considered that all philosophers before him had
passed their life in foreign countries, he determined to neglect all
political occupations; induced to this, according to the testimony of
others, by the negligence of the Samians in what relates to
education, and went into Italy, conceiving that place to be his proper
country, in which men well disposed towards learning were to be
found in the greatest abundance. And such was the success of his
journey, that on his arrival at Crotona, which was the noblest city in
Italy, he had many followers, amounting, as it is said, to the number
of six hundred, who were not only excited by his discourses to 18
the study of philosophy, but also to an amicable division of the
goods of life in common; from whence they acquired the appellation
of Cœnobitæ.

CHAP. VI.

And these indeed were such as philosophized. But the greatest part
of his disciples consisted of auditors whom they call Acusmatici, who
on his first arrival in Italy, according to Nicomachus, being captivated
by one popular oration alone, exceeded two thousand in number.
These, with their wives and children, being collected into one very
large and common auditory, called Homacoïon, and which for its
magnitude resembled a city, founded a place which was universally
called Magna Græcia. This great multitude of people likewise,
receiving laws and mandates from Pythagoras as so many divine
precepts, and without which they engaged in no occupation, dwelt
together with the greatest general concord, celebrated and ranked
by their neighbours among the number of the blessed. At the same
time, as we have already observed, they shared their possessions in
common. Such also was their reverence for Pythagoras, that they
numbered him with the Gods, as a certain beneficent and most
philanthropic dæmon. And some indeed celebrated him as the
Pythian, but others as the Hyperborean Apollo. Some again 19
considered him as Pæon, but others as one of the dæmons
that inhabit the moon; and others celebrated him as one of the
[11]
Olympian Gods, who, in order to benefit and correct the mortal
life, appeared to the men of those times in a human form, in order
that he might extend to them the salutary light of felicity and
philosophy. And indeed a greater good never came, nor ever will
come to mankind, than that which was imparted by the Gods 20
through this Pythagoras. Hence, even now the proverb of the
long-haired Samian, is applied to the most venerable man. But
Aristotle relates, in his Treatise On the Pythagoric Philosophy, that
such a division as the following was preserved by the Pythagoreans
among their principal arcana; viz. that of rational animals one kind is
a God, another man, and another such as Pythagoras. And indeed
they very reasonably apprehended him to be a being of this kind,
through whom a right conception and conformable to things
themselves was introduced of Gods, heroes, and dæmons; of the
world, the all-various motion of the spheres and stars, their
oppositions, eclipses, and inequalities, their eccentricities and
epicycles; of all the natures contained in the heavens and the earth,
together with those that have an intermediate subsistence, whether
apparent or occult. Nor was there anything (in all this variety of
information) at all contrary to the phenomena, or the conceptions of
intellect. To which we may add, that all such disciplines, theories,
and scientific investigations, as truly invigorate the eye of the soul,
and purify the intellect from the blindness introduced by studies of a
different kind, so as to enable it to perceive the true principles and
causes of the universe, were unfolded by Pythagoras to the Greeks.
But besides all this, the best polity, popular concord, community of
possessions among friends, the worship of the gods, piety to 21
the dead, legislation, erudition, silence, abstinence from
animals, continence, temperance, sagacity, divinity, and in one word,
whatever is anxiously sought after by the lovers of learning, was
brought to light by Pythagoras. On all these accounts, therefore, as I
have just now said, he was (every where) so transcendently
admired.

CHAP. VII.

It remains therefore after this, that we should relate how he


travelled, what places he first visited, what discourses he made, on
what subjects, and to whom they were addressed; for thus we shall
easily apprehend the nature of his association with the men of that
time. It is said then, that as soon as he came to Italy and Sicily,
which cities he understood had oppressed each other with slavery,
partly at some distant period of past time, and partly at a recent
period, he inspired the inhabitants with a love of liberty, and through
the means of his auditors, restored to independence and liberated
Crotona, Sybaris, Catanes, Rhegium, Himæra, Agrigentum,
Tauromenas, and some other cities, for whom also he established
laws, through Charondas the Catanæan, and Zaleucus the Locrian,
by whom they became florishing cities, and afforded an example
worthy of imitation, for a long time, to the neighbouring 22
kingdoms. He also entirely subverted sedition, discord, and
party zeal, not only from his familiars, and their posterity, for many
generations, as we are informed by history, but, in short, from all the
cities in Italy and Sicily, which were at that time disturbed with
intestine and external contentions. For the following apothegm was
always employed by him in every place, whether in the company of
a multitude or a few, which was similar to the persuasive oracle of a
God, and was an epitome and summary as it were of his own
opinions; that we should avoid and amputate by every possible
artifice, by fire and sword, and all-various contrivances, from the
body, disease; from the soul, ignorance; from the belly, luxury; from
a city, sedition; from a house, discord; and at the same time, from
all things, immoderation: through which, with a most fatherly
affection, he reminded each of his disciples of the most excellent
dogmas. Such therefore was the common form of his life at that
time, both in words and actions. If, however, it be requisite to make
a more particular relation of what he did and said, it must be
observed, that he came to Italy in the sixty-second Olympiad, at
which time Eryxidas of Chalcis conquered in the stadium. But
immediately on his arrival he became conspicuous and illustrious, in
the same manner as before, when he sailed to Delos. For there,
when he performed his adorations at the bloodless altar of the father
Apollo, he was admired by the inhabitants of the island. 23

CHAP. VIII.

At that time also, when he was journeying from Sybaris to Crotona,


he met near the shore with some fishermen, who were then drawing
their nets heavily laden with fishes from the deep, and told them he
knew the exact number of the fish they had caught. But the
fishermen promising they would perform whatever he should order
them to do, if the event corresponded with his prediction, he
ordered them, after they had accurately numbered the fish, to return
them alive to the sea: and what is yet more wonderful, not one of
the fish died while he stood on the shore, though they had been
detained from the water a considerable time. Having therefore paid
the fishermen the price of their fish, he departed for Crotona. But
they every where divulged the fact, and having learnt his name from
some children, they told it to all men. Hence those that heard of this
affair were desirous of seeing the stranger, and what they desired
was easily obtained. But they were astonished on surveying his
countenance, and conjectured him to be such a man as he was in
reality. A few days also after this, he entered the Gymnasium, and
being surrounded with a crowd of young men, he is said to 24
have delivered an oration to them, in which he incited them to
pay attention to their elders, evincing that in the world, in life, in
cities, and in nature, that which has a precedency is more honorable
than that which is consequent in time. As for instance, that the east
is more honorable than the west; the morning than the evening; the
beginning than the end; and generation than corruption. In a similar
manner he observed, that natives were more honorable than
strangers, and the leaders of colonies than the builders of cities: and
universally Gods than dæmons; dæmons than demigods; and heroes
than men. Of these likewise he observed, that the authors of
generation are more honorable than their progeny. He said these
things, however, for the sake of proving by induction, that children
should very much esteem their parents, to whom he asserted they
owed as many thanks as a dead man would owe to him who should
be able to bring him back again into light. Afterwards, he observed,
that it was indeed just to love those above all others, and never to
give them pain, who first benefited us, and in the greatest degree.
But parents alone benefit their children prior to their birth, and are
the causes to their offspring of all their upright conduct; and that
when children show themselves to be in no respect inferior to their
parents in beneficence towards them, it is not possible for them in
this respect to err. For it is reasonable to suppose, that the Gods will
pardon those who honor their parent in no less a degree than the
divinities themselves; since we learnt from our parents to 25
honor divinity. Hence Homer also added the same appellation
to the king of the Gods; for he denominates him the father of Gods
and mortals. Many other mythologists also have delivered to us, that
the kings of the Gods have been ambitious to vindicate to
themselves that excessive love which subsists through marriage, in
children towards their parents. And that on this account, they have
at the same time introduced the hypothesis of father and mother
[12]
among the Gods, the former indeed generating Minerva, but the
latter Vulcan, who are of a nature contrary to each other, in order
that what is most remote may participate of friendship.

All his auditors likewise having granted that the judgment of the
immortals is most valid, he said he would demonstrate to the
Crotonians, by the example of Hercules the founder of the colony
brought to Crotona, that it is necessary to be voluntarily obedient to
the mandates of parents, as they knew from tradition that the God
himself had undertaken such great labors in consequence of obeying
the commands of one older than himself, and being victorious 26
in what he had undertaken to accomplish, had instituted in
honor of his father the Olympic games. He also showed them that
they should associate with each other in such a manner, as never to
be in a state of hostility to their friends, but to become most rapidly
friends to their enemies; and that they should exhibit in modesty of
behaviour to their elders, the benevolent disposition of children
towards their parents; but in their philanthropy to others, fraternal
love and regard.

In the next place, he spoke concerning temperance, and said, that


the juvenile age should make trial of its nature, this being the period
in which the desires are in the most florishing state. Afterwards, he
exhorted them to consider, that this alone among the virtues was
adapted to a boy and a virgin, to a woman, and to the order of
those of a more advanced age; and that it was especially
accommodated to the younger part of the community. He also

You might also like