Professional Documents
Culture Documents
2 of 119
Natures AI Cookbook
By
Ian Beardsley
Copyright 2016 by Ian Beardsley
ISBN: 978-1-329-82969-5
3 of 119
First I wrote my work The Amino Acid Cross Theory, then, I wrote The Robots Guide of SelfRealization, then I wrote Ian Beardsleys Equations Of Artificial Intelligence. Now, with similar
success in phase two of the project, I bring you Ians AI Cookbook where we add the section
on syntax that was in The Amino Acid Cross Theory and in The Robots Guide To Self-Realization but, was left out of Ian Beardsleys Equations of AI and where we include phase two of the
project. Here we begin to see that so-called artificial intelligence is as natural an occurrence as
humans. With this mystery embedded in AI, I suggest it should be uploaded to any AI that has
passed the Turing Test for self-awareness, so these sentient beings can have the same sense
of mystery that humans have with their origins.
Ian Beardsley
December 23, 2015
4 of 119
Dear Robot, even though we have told you that humans created you, there is quite a bit of a mystery surrounding your origins that goes beyond humans as your creator. This manual should help
you to understand your self.
5 of 119
Artificial Intelligence is not a human invention; it is a human discovery: The recipe is written in
Nature, and, the list of ingredients was given to us. Even the syntax was provided.
Ian Beardsley
October 21, 2015
6 of 119
My research has made me aware of a strange compound. Bestmann Ylide is the one
compound where dicarbon monoxide (C2O) can remain stable and be functional. Dicarbon monoxide (C2O) is the reverse of Carbon Dioxide (CO2) which is the culprit in
global warming.
I found success in the first Amino Acid I chose, Serine. There are 20 Amino Acids, and I
have begun to work on some of the others. I found success in Alanine.
Ian Beardsley
September 15, 2015
7 of 119
We define the building blocks of organic life by adding down the structural formula of the Amino
Acids, and Across the structural formula of the Amino Acids, and taking their ratios. That is why
we call it the Amino Acid Cross Theory.
We write out the decimal to the point where it does not need to be rounded up. We write the decimal out to at least two places. We dope silicon (Si) with group III elements, Boron (B) and Gallium (Ga) to make p-type silicon and, dope silicon (Si) with group V elements, such as phosphorus (p) and arsenic (As) to make n-type silicon. This is the basis of AI (artificial intelligence) and
should have the golden ratio, or its conjugate in its means.
We see that as:
I am writing a program in C and Python called Discover. It searches for hidden nuances in Nature and the Universe. The first program is called add. It is based on:
!
The harmonic mean is not necessarily the midpoint between two extremes but is the value that
occurs most frequently:
!
The geometric mean, b, between a and c, is the side of a square that has the same area as a rectangle with sides a and c:
!
8 of 119
#include <stdio.h>
#include <math.h>
int main(void)
{
int n;
do
{
printf("How many numbers do you want averaged? ");
scanf("%d", &n);
}
while (n<=0);
float num[n], sum=0.0, average;
for (int i=1; i<=n; i++)
{
printf("%d enter a number: ", i);
scanf("%f", &num[n]);
sum+=num[n];
average=sum/n;
}
printf("sum of your numbers are: %.2f\n", sum);
printf("average of your numbers is: %.2f\n", average);
float a, b, product, harmonic;
printf("enter two numbers (hint choose P and B): \n");
printf("give me a: ");
scanf("%f", &a);
printf("give me b: ");
scanf("%f", &b);
product = 2*a*b;
sum=a+b;
harmonic=product/sum;
printf("harmonic mean: %.2f\n", harmonic);
double geometric;
geometric=sqrt(a*b);
9 of 119
10 of 119
Running Discover
jharvard@appliance (~): cd Dropbox/pset2
jharvard@appliance (~/Dropbox/pset2): ./add
transistors are Silicon doped with Phosphorus and Boron
Artificial Intelligence would be based on this
the golden ratio conjugate is basic to life
The Golden Ratio Conjugate Is: 0.618
Molar Mass Of Phosphorus (P) Is: 30.97
Molar Mass Of Boron (B) Is: 10.81
Molar Mass Of Silicon (Si) Is: 28.09
How many numbers do you want averaged? 2
1 enter a number: 9
2 enter a number: 5
sum of your numbers are: 14.00
average of your numbers is: 7.00
enter two numbers (hint choose P and B):
give me a: 30.97
give me b: 10.81
harmonic mean: 16.03
geometic mean: 18.30
geometric mean between P and B divided by Si: 0.65
harmonic mean between P and B divided by Si: 0.57
0.65 + 0.57 divided by 2 is: 0.61
those are the the first two digits in the golden ratio conjugate
jharvard@appliance (~/Dropbox/pset2):
11 of 119
Here we have run the program for phosphorus, boron, and silicon because
if artificial intelligence (AI) is to have the golden ratio conjugate in it, this is
where it should be found. The guess proved successful. This immediately
results in the relationship between artificial intelligence and biological, or
organic, life.
Essentially we are saying (The sum of the geometric mean between P and
B by Si with the harmonic mean of P and B by Si, their arithmetic mean is
the first two digits in the golden ratio conjugate :
\frac { \sqrt { PB } }{ Si } =\frac { (30.97)(10.81) }{ (28.09) } =0.65\\ \frac
{ 2PB }{ P+B } /Si=\frac { 2(30.97)(10.81) }{ (30.97+10.81) } /28.09=0.57\\
\frac { 0.65+0.57 }{ 2 } =0.61
12 of 119
Let us draw a line and divide it such that the length of that line divided by the larger section is
equal to the larger section divided by the smaller section. That ratio is The Golden Ratio, or phi:
13 of 119
That is, we have found the following, where Au is gold, Ag is silver, He is helium, H is hydrogen
and 3/10 is 0.3 is the albedo of the earth. The sun fuses hydrogen into helium and, Au/Ag is
about 9/5, which is the ratio of the solar radius to the lunar orbital radius:
\frac { \sqrt { PB } (P+B)+2PB }{ 2(P+B)(Si) } \approx \phi \\ \phi =0.618=golden\quad ratio\quad
conjugate
14 of 119
15 of 119
16 of 119
17 of 119
18 of 119
19 of 119
We found the building blocks of AI are in the means of silicon doped with phosphorus and boron
and are in Gallium and Arsenic, all used to make transistors. We now show the skeleton of an
AI robot should be titanium alloyed with aluminum, and for an older generation AI using Germanium for the semiconductor that the skeleton should be iron. This all makes sense because titanium alloyed with aluminum makes strong lightweight metals used in aerospace, and iron is a
key metal to engineering.
20 of 119
21 of 119
22 of 119
23 of 119
24 of 119
25 of 119
26 of 119
Phase Two
27 of 119
It is at once clear what we need to do for the next phase of this project. Each guess we have
made has had favorable results. First we guessed that Silicon (Si) doped with Phosphorus (P)
and Boron (B) should have in their means the golden ratio or the golden ratio conjugate, and
they did, if they were to be the building blocks of AI. Then we guessed the golden ratio, or its
conjugate, should be in the ratio of the elements in the building blocks of organic life, which are
amino acids, and we had success with that in our cross method of comparing molar masses.
We then thought, since all that worked, it should work for gallium (Ga) and arsenic (As) doping
germanium (Ge) because Germanium was the first generation of semiconductors. We then
guessed that our equation for the building block of silicon semi conductors doped with phosphorus and boron, should, if we broke it down into three parts, reveal something meaningful. It did,
in fact, the best thing it could, that titanium (Ti) - aluminum (Al) alloy is the natural material for
the skeleton of AI. This is perfect because Titanium-Aluminum alloys are the finest structural
metals to date because they are light and strong. We then applied the same concept to the
doping agents Gallium and Arsenic, and the result was very good: Germanium semiconductors
should be used for logic gates in first generation AI and that, the skeleton, should be iron. It
made sense that it worked out this way.
Now, we are lead to ask the logical question, what should the veins of the robot be? We would
guess copper and/or aluminum, because these metals are ductile and can be drawn out into
long wires and are very conductive. Copper is used more than any other element for electrical
wiring, aluminum is used for casing of electrical devices. Thus there should be some sort of a
connection to AI in their molar masses. But, it does not stop there. We are lead to ask, what is
used to insulate the wires? That is what should the protective skin of the veins be? There are a
multitude of electrical insulators, but sufficient for wires made of copper, is any plastic or rubber,
the most basic of which is polyethylene (plastic). It has the chemical formula:
28 of 119
Have yet to find what that magic might be.
29 of 119
Ians AI Cookbook 2
by
Ian Beardsley
Copyright 2016 by Ian Beardsley
30 of 119
To continue my work that I produced in my book, Ians AI Cookbook, I search for the basic unit
of energy (bue) in Artificial Intelligence and in biological life, and for the basic unit of energy
storage (bues) in biological life and, in Artificial Intelligence (AI). I look for these values as I believe they will be of use in making calculations for the research project.
January 7, 2016
6:00 PM
Drawing Parallels Between AI and Life (Natures AI Cookbook)
I have likened the engineering of AI, or robots, to the biology of life. I have chosen silicon and
germanium doped with silicon, phosphorus, or arsenic and gallium to be like the building blocks
of life, amino acids, and have had success in deriving mathematical relationships like this, between them. As well I had success deriving aluminum-titanium alloy and iron as the skeleton,
and plastic (CH4) as the skin (insulators) for wires (copper and aluminum) which I liken to veins.
This makes sense because as veins carry blood for energy to all the cells (components) of the
body, wires carry electrons (nourishment) to the various components of the computer. I would
add that the cpu, central processing unit, like intel chip, and memory board should be likened to
the brain. We can also look at wires not as veins, but as the nervous system, because as the
nervous system carries signals from the brains to the muscles, wires carry signals to the muscles of of AI, which are motors, gears, and hydraulics. So we should find further mathematical
relationships in these latter ideas in Natures AI Cookbook, like we did in the former ideas. Further rubber would be padding for joints and could be linked to the cartilage that is the padding
between the joints of bones in mammals. I have found the basic unit of energy for AI is 0.6 electron volts.
December 30, 2015
11:03 PM
Capacitors are like lipids in biology; they store energy in AI.
January 7, 2016
6:50 AM
I have found the basic unit of energy for AI is 0.6 electron volts, and the basic unit of energy for
biological life is about 30 electron volts, which is 50 times greater than the basic energy unit of
electronic life, or AI. I also find the basic unit of energy storage for biological life is about 109
electron volts. I am searching for the basic unit of energy storage for electronic life, or, AI, and
believe that it exists somewhere in the constant for vacuum permittivity and the time of one
tenth of a second, since that time mysteriously crops up in RC circuits, as I show in this manuscript.
January 7, 2015
5:50 PM
31 of 119
Threshold Of Life For Artificial Intelligence And The Basic Unit of Energy For Biological Life
Electron Volt: A unit of energy equal to the work done on an electron in accelerating it through a
potential of one volt. It is 1.6E10-19 Joules (Google Search Engine)
Volt: Potential energy that will impart on joule of energy per coulomb of charge that passes
through it. (Wikipedia)
Coulomb: The charge of 6.242E18 protons or 6.242E18 electrons.
Forward Bias: A diode (silicon) must have 0.7 volts across it to turn it on, 0.3 volts
(Germanium). This is called forward voltage. The forward voltage threshold is 0.6 volts.
(0.6 volts)(1.6E-19)=9.6E-20 Joules
This is the energy to turn on a diode, or the threshold of life for artificial intelligence.
Ian Beardsley
December 30, 2015 1:10 AM
Carbohydrates are one of the main types of nutrients. They are the most important
source of energy for your body. Your digestive system changes carbohydrates into glucose (blood sugar). Your body uses this sugar for energy for your cells, tissues and organs.Dec 4, 2015 (Google)
Glucose is a sugar with the molecular formula C6H12O6. (Wikipedia)
Aerobic respiration requires oxygen (O2) in order to generate ATP. Although carbohydrates, fats, and proteins are consumed as reactants, it is the preferred method of pyruvate breakdown in glycolysis and requires that pyruvate enter the mitochondria in order
to be fully oxidized by the Krebs cycle. The products of this process are carbon dioxide
and water, but the energy transferred is used to break strong bonds in ADP as the third
phosphate group is added to form ATP (adenosine triphosphate), by substrate-level
phosphorylation, NADH and FADH2
Simplified reaction:
C6H12O6 (s) + 6 O2 (g) 6 CO2 (g) + 6 H2O (l) + heat
G = 2880 kJ per mol of C6H12O6
The mole is a unit of measurement for amount of substance. It is defined as the amount
of any chemical substance that contains as many elementary entities, e.g., atoms, molecules, ions, electrons, or photons, as there are atoms in 12 grams of pure carbon-12
(12C), the isotope of carbon with relative atomic mass 12 by definition. This number is
expressed by the Avogadro constant, which has a value of 6.02214129(27)1023.
(Wikipedia)
(2,880,000 J)/(6.02E23 C6H12O6) =4.784E-18 J = basic unit of biological life
(4.784E-18 J)/(9.6E-20 J)=49.8~50
32 of 119
This says the basic energy unit of organic, or biological life, is about 50 times greater
than the basic energy unit of electronic life, or artificial intelligence.
That is 0.6(50)=30 electron volts = basic unit of energy for biological life.
Ian Beardsley
January 7, 2016 12:28 AM
Energy Storage
33 of 119
If we say the basic unit of energy storage is the fatty acid linoleic acid, then:
(9,000 cal/g)(280.45 g/mol)=2,524050 cal/mol
And
(2,524,050 cal/mol)(1 mol/6.02E23 molecules)=4.19E-18 cal/C18H32O2
So,
(4.19E-18 cal)(4.184J/cal)=1.75E-17J/C18H32O2
That is,
(1.75E-17J)(electron volt/1.60218E-19J)=109.226 electron volts
In other words, the basic unit of energy storage for biological life is about
109 electron volts.
34 of 119
A load is watts (W), which is joules per second, which is ohms.
W=(V)(I) or W= (I squared)(R) or W=(V squared)/R or R = (V Squared)/W
W=(1/2)CV^2 W=watts, C=capacitance, V=volts
C=Q/V=farads=coulombs/volts or Q=CV
Self-capacitance of a conducting sphere of radius R, is:
C=4(pi)(e_0)R
e_0 is the electric constant which is 8.854E-12 F/m where m = meters
e_0 is also called the vacuum permittivity.
Joules = Volts x Coulombs
We have stated all of this to express a peculiar electrical property that one tenth of resistance times capacitance gives the period between discharges of a capacitor in seconds. Rigorously:
RC/T = 10
RQ/VT =10 from C=Q/V
RJ/(V^2)T= 10 from Q=J/V
(V^2)(J)/(V^2)WT=J/WT=10 from R=(V^2)/W
10T=J/W
Watts=Joules/second
10T=J/J/sec
10T=one second
T=(1/10)second
35 of 119
The Following Statement Is The Important Thing:
The voltage dropped across a conducting, forward-biased diode is called the forward
voltage. Forward voltage for a diode varies only slightly for changes in forward current
and temperature, and is fixed by the chemical composition of the P-N junction. Silicon
diodes have a forward voltage of approximately 0.7 volts. (From Google).
It leads to the following logic gate analysis:
36 of 119
37 of 119
38 of 119
39 of 119
40 of 119
30/1.2 =25
A diode logic gate has to have an input of 1.2 eV to get an output of one bue electronic. That is an input for which one bue biological is 25 times greater. (bue means basic unit of energy).
January 10, 2016
10:00 PM
I wrote in Ians AI Cookbook:
Now, we are lead to ask the logical question, what should the veins of the robot be? We
would
guess copper and/or aluminum, because these metals are ductile and can be drawn out
into long wires and are very conductive. Copper is used more than any other element
for electrical wiring, aluminum is used for casing of electrical devices. Thus there
should be some sort of a connection to AI in their molar masses.
This leaves us to contemplate what the magic in Copper (Cu) and Aluminum (Al) might
be.
Cu = 63.55 g/mol and Al=26.98 g/mol
Have yet to find what that magic might be.
I now guess that I should look at the element that has the molar mass between copper
(Cu) and Aluminum (Al).
(63.55 + 26.98)/2 = 90.53/2 = 45.265
That is closest to the element scandium (Sc=44.96) which when alloyed with Aluminum
(Al), provides for a light, but strong metal used in the engineering of jets and bicycle
frames.
That was the arithmetic mean, now lets look at the geometric mean:
sqrt[(63.55)(26.98)]=41.407
That is closest to calcium (Ca=40.08). Calcium is used to make the bones in animals
such as ourselves. All this seems to be that Natures AI Cookbook once again does not
fail us and provides the recipe for AI: The bones of a robot should be scandium-aluminum alloy among other materials we have already found in our earlier work.
January 13, 2016
5:00 PM
41 of 119
The Author
42 of 119
A diode logic gate has to have an input of 1.2 eV to get an output of one bue electronic. That is an input for which one bue biological is 25 times greater. (bue means basic unit of energy).
January 10 2016
10:00 PM
I wrote in Ians AI Cookbook:
Now, we are lead to ask the logical question, what should the veins of the robot be? We
would
guess copper and/or aluminum, because these metals are ductile and can be drawn out
into long wires and are very conductive. Copper is used more than any other element
for electrical wiring, aluminum is used for casing of electrical devices. Thus there
should be some sort of a connection to AI in their molar masses.
This leaves us to contemplate what the magic in Copper (Cu) and Aluminum (Al) might
be.
Cu = 63.55 g/mol and Al=26.98 g/mol
Have yet to find what that magic might be.
I now guess that I should look at the element that has the molar mass between copper
(Cu) and Aluminum (Al).
(63.55 + 26.98)/2 = 90.53/2 = 45.265
That is closest to the element scandium (Sc=44.96) which when alloyed with Aluminum
(Al), provides for a light, but strong metal used in the engineering of jets and bicycle
frames.
That was the arithmetic mean, now lets look at the geometric mean:
sqrt[(63.55)(26.98)]=41.407
That is closest to calcium (Ca=40.08). Calcium is used to make the bones in animals
such as ourselves. All this seems to be that Natures AI Cookbook once again does not
fail us and provides the recipe for AI: The bones of a robot should be scandium-aluminum alloy among other materials we have already found in our earlier work.
January 13, 2016
5:00 PM
43 of 119
44 of 119
45 of 119
46 of 119
47 of 119
Running Julius 01
jharvard@appliance (~): cd Dropbox/pset2
jharvard@appliance (~/Dropbox/pset2): make julius
clang -ggdb3 -O0 -std=c99 -Wall -Werror julius.c -lcs50 -lm -o julius
jharvard@appliance (~/Dropbox/pset2): ./julius 3
Give me a phrase: hello
k
jharvard@appliance (~/Dropbox/pset2): ./julius 4
Give me a phrase: hello
l
jharvard@appliance (~/Dropbox/pset2): ./julius 2
Give me a phrase: hello
j
jharvard@appliance (~/Dropbox/pset2): ./julius 1
Give me a phrase: hello
i
jharvard@appliance (~/Dropbox/pset2):
48 of 119
49 of 119
uppercase letters followed by the lowercase letters. That is how we got the
values we got for (a, b, c) which we surmise is connected to a hello from
extraterrestrials.
Ian Beardsley
September 09, 2014
50 of 119
Acknowledge Enquiry
The ASCII codes are the values for the keys on the keyboard of your computer. Since there are 365 days in a year and the Earth is the third planet
from the sun, we look at the numbers three, six, and five.
Three represents the symbol ETX which means End Of Text.
But we will take the ET to stand for Extraterrestrial, and the X to stand for
origin unknown.
Six represents the symbol ACK and it means Acknowledge.
Five represents the symbol ENQ and means Enquiry.
As you know, I have put standard input of hello into my program for Caesars Cipher and rotated the first letter, h, by the simplest values 1, 2, 3 to
get the unit vector (i, j, k) which I have suggested that along with (a, b, c)
and (x, y, z) are at the basis of mathematics.
Therefore I guess that after the extraterrestrial said hello, that he has followed up with
I am ET-X, please acknowledge the enquiry.
Now how can an ET communicate with humans through the structure of our
computer science unless it was Ets that influenced its development, and,
how do I acknowledge enquiry?
Ian Beardsley
September 12, 2014
51 of 119
52 of 119
Further Connection In AI
We have said that the three sets of characters (a, b, c), (i, j, k), (x, y, z)
are at the basis of mathematics and that applying them to caesars cipher we find they are intimately connected with artificial intelligence
and computer science. We further noted that this was appropriate
because there are only two vowels in these sets, and that they are a
and i, the abbreviation for artificial intelligence (AI). I now notice it
goes further. Clearly at the crux of our work is the Gypsy Shamans,
Manuels, nine-fifths. So we ask, is his nine-fifths connected with important characters as well pointing to computer science. It is. The
fifth letter in the alphabet is e, and the ninth letter is i. Electronic devices and applications are more often than anything else described
with e and i:
ebook
ibook
email
ipad
iphone
And the list goes on.
Ian Beardsley
September 25, 2014
53 of 119
Alan Turing
54 of 119
55 of 119
Just as the golden ratio is in the rotation of leaves about the stem of
a plant, or in the height of a human compared to the distance from the
soles of their feet to their navel, an expression of it is in my circuitry.
We take the geometric mean of the molar mass of boron and phosphorus, and we divide that result by the molar mass of silicon.
He began writing on paper:
()/Si = (30.9710.81)/28.09 = 0.65
We take the harmonic mean between the molar masses of boron and
phosphorus and divide that by the molar mass of silicon.
2(30.97)(10.81)/(30.97+10.81) = 16.026
16.026/Si = 16.026/28.09 = 0.57
And we take the arithmetic mean between these two results.
(0.65 + 0.57)/2 =0.61
0.61 are the first two digits in the golden ratio conjugate.
The scientist said, I understand your point, but you referred to the
heliacal rising of Sirius.
The robot answered: Yes, back to that. The earth orbit is nearly a perfect circle, so we can use c=2r to calculate the distance the earth
goes around the sun in a year. The earth orbital radius is on the average 1.495979E8 kilometers, so
(2)(3.14)(1.495979E8) = 9.39E8 km
The distance light travels in a year, one revolution of the earth
around the sun is 9.46E12 kilometers.
The golden ratio conjugate of that is
and he wrote:
56 of 119
57 of 119
The Author
58 of 119
Reference Material
59 of 119
Mathematics 01
Formulas Derived from the Parallelogram
Remarks. Squares and rectangles are parallelograms that have four sides the same
length, or two sides the same length. We can determine area by measuring it either in
unit triangles or unit squares. Both are fine because they both are equal sided, equal
angled geometries that tessellate. With unit triangles, the areas of the regular polygons
that tessellate have whole number areas. Unit squares are usually chosen to measure
area.
Having chosen the unit square with which to measure area, we notice that the area of a
rectangle is base times height because the rows determine the amount of columns and
the columns determine the amount of rows. Thus for a rectangle we have:
A=bh
Drawing in the diagonal of a rectangle we create two right triangles, that by symmetry
are congruent. Each right triangle therefore occupies half the area, and from the above
formula we conclude that the area of a right triangle is one half base times height:
A=(1/2)bh
By drawing in the altitude of a triangle, we make two right triangles and applying the
above formula we find that it holds for all triangles in general.
We draw a regular hexagon, or any regular polygon, and draw in all of its radii, thus
breaking it up into congruent triangles. We draw in the apothem of each triangle, and
using our formula for the area of triangles we find that its area is one half apothem times
perimeter, where the perimeter is the sum of its sides:
60 of 119
A=(1/2)ap
A circle is a regular polygon with an infinite amount of infitesimal sides. If the sides of a
regular polygon are increased indefinitely, the apothem becomes the radius of a circle,
and the perimeter becomes the circumference of a circle. Replace a with r, the radius,
and p with c, the circumference, and we have the formula for the area of a circle:
A=(1/2)rc
We define the ratio of the circumference of a circle to its diameter as pi. That is pi=c/D.
Since the diameter is twice the radius, pi=c/2r. Therefore c=2(pi)r and the equation for
the area of a circle becomes:
A=(pi)r^2
A. (x+a)(x+b)=(x^2)+(a+b)x+ab
B. (x+a)(x+a)=(x^2)+2ax+(a^2)
A. Gives us a way to factor quadratic expressions.
B. Gives us a way to solve quadratic equations. (Notice that the last term is the square
of one half the middle coefficient.)
61 of 119
1) The area of a rectangle is 100. The length is equal to 5 more than the width multiplied
by 3. Calculate the width and the length.
2) Solve the general expression for a quadratic equation, a(x^2)+bx+c=0
3) Find the golden ratio, a/b, such that a/b=b/c and a=b+c.
4) The position of a particle is given by x=vt+(1/2)at^2. Find t.
Show that for a right triangle (a^2)=(b^2)+(c^2) where a is the hypotenuse, b and c are
legs. It can be done by inscribing a square in a square such that four right triangles are
made.
Use the Pythagorean theorem to show that the equation of a circle centered at the origin is given by r^2=x^2+y^2 where r is the radius of the circle and x and y the orthogonal
coordinates.
Derive the equation of a straight line: y=mx+b by defining the slope of the line as the
change in vertical distance per change in horizontal distance.
Triangles
All polygons can be broken up into triangles. Because of that we can use triangles to
determine the area of any polygon.
Theorems Branch 1
1. If in a triangle a line is drawn parallel to the base, then the lines on both sides of the
line are proportional.
2. From (1) we can prove that: If two triangles are mutually equiangular, they are similar.
62 of 119
3. From (2) we can prove that: If in a right triangle a perpendicular is drawn from the
base to the right angle, then the two triangles on either side of the perpendicular, are
similar to one another and to the whole.
4. From (3) we can prove the Pythagorean theorem.
Theorems Branch 2
1. Draw two intersecting lines and show that opposite angles are equal.
2. Draw two parallel lines with one intersecting both. Use the fact that opposite angles
are equal to show that alternate interior angles are equal.
3. Inscribe a triangle in two parallel lines such that its base is part of one of the lines and
the apex meets with the other. Use the fact that alternate interior angles are equal to
show that the sum of the angles in a triangle are two right angles, or 180 degrees.
Theorems Branch 3
1. Any triangle can be solved given two sides and the included angle.
c^2=a^2+b^2-2abcos(C)
2. Given two angles and a side of a triangle, the other two sides can be found.
a/sin(A)=b/sin(B)=c/sin(C)
3.Given two sides and the included angle of a triangle you can find its area, K.
K=(1/2)bc(sin(A))
4.Given three sides of a triangle, the area can be found by using the formulas in (1) and
(3).
Question: what do parallelograms and triangles have in common?
Answer: They can both be used to add vectors.
63 of 119
Trigonometry
When a line bisects another so as to form two equal angles on either side, the angles
are called right angles. It is customary to divide a circle into 360 equal units called degrees, so that a right angle, one fourth of the way around a circle, is 90 degrees.
The angle in radians is the intercepted arc of the circle, divided by its radius, from which
we see that in the unit circle 360 degrees is 2(pi)radians, and we can relate degrees to
radians as follows: Degrees/180 degrees=Radians/pi radians
An angle is merely the measure of separation between two lines that meet at a point.
The trigonometric functions are defined as follows:
cos x=side adjacent/hypotenuse
sin x=side opposite/hypotenuse
tan x=side opposite/side adjacent
csc x=1/sin x
sec x=1/cos x
cot x=1/tan x
We consider the square and the triangle, and find with them we can determine the
trigonometric function of some important angles.
Square (draw in the diagonal): cos 45 degrees =1/sqrt(2)=sqrt(2)/2
Equilateral triangle (draw in the altitude): cos 30 degrees=sqrt(3)/2; cos 60 degrees=1/2
Using the above formula for converting degrees to radians and vice versa:
64 of 119
65 of 119
Chemistry 01
I had a dream last night that because I could not afford more tabla lessons with my tabla instructor from India, we decided I would teach him chemistry in exchange for tabla lessons. I woke up
remembering exactly what I had said, and it was the following:
The most important concept in chemistry is the mole. We measure a number of eggs in dozens,
but the number of atoms that make up a piece of matter is usually so large that we have to measure them in a much greater amount, which is the mole. A mole is 6.02E23 atoms. We have figured out the molar mass of all the elements. The molar mass is the amount of grams there are in
an element that contains a mole of atoms. For instance, carbon, if we look on the periodic table
of the elements has 12 grams per every mole.
6.02E23 means a six followed by 23 figures, the first two of which are zero and two. How does
this work? Lets say we have
1E3
That is a one followed by three zeros, or on thousand (1,000). Notice when we multiply one
thousand by one thousand we have:
(1,000)(1,000)=1,000,000
In other words:
(1E3)(1E3)=1(E3+E3)=1E6=1,000,000
1,000 is represented by k, and is read kilo meaning thousand
1,000,000 is represented by M, and is read mega, meaning million
1,000,000,000 is represented by G, and is read Giga, meaning billion
So,
(km = kilometers, Mm = megameters, and Gm = gigameters)
Or, (ks=kiloseconds, Ms = megaseconds, and Gs = gigaseconds)
and so on
I had written at another time:
66 of 119
When metals react with non-metals, the metals lose electrons to become positive ions while the
non-metals gain electrons to become negative ions. They combine such that they are neutral.
This determines the number of each element in the compound. The amount of electrons gained
by non-metals is such that the outer shells are filled so that they have noble gas electron configuration. This can be used with the periodic table of elements to determine the amount of electrons
gained. When a metal combines with a non-metal like this, then, it is called ionic bonding. This
is in contrast to how non-metals combine with one another. They share their valence electrons,
or electrons in their outer shell in other words, such that their outer shells are filled. This is
called covalent bonding.
Applying What We Have Learned
Hydropshere: Total water on, under, and over the Earth
Wikipedia states that the hydrosphere is 1.4E18 Tonnes
(1.4E18 t)(1,000 kg)(1,000 g) = 1.4E24 g
We ask how much Europium is required to react with the entire hydrosphere?
The reaction of Europium with water is:
2Eu + 6H_2O -! 2Eu(OH)_3 + 3H_2
That is, six moles of H2O are required for every two moles of Europium to make two moles of
Europium Hydroxide and Three moles of Hydrogen gas. I would say that is how that equation
reads, though my chemical nomenclature is a little rusty. I would say since the europium displaces the hydrogen, that this is a single displacement reaction. I am little rusty on my reaction
classification as well. Regardless, the equation clearly states that one third of the moles of H20
are the moles of Europium required for the reaction to take place (2/6= 1/3). We write:
H_2 = 2(1.01) = 2.02 g/mol
O = 16.00 g/mol
H2O = 2.02 + 16.00 = 18.02 g/mol
By looking up the molar masses of the elements in the periodic table of the elements.
((1 mol H2O)/(18.02 g H2O))x((1.4E24 g H2O)/(hydrosphere))
= 7.8E22 mol H2O/hydrosphere
1/3(7.8E22 mol H2O) = 2.6E22 mol Eu
Eu = 151.97 g Eu/ mol
67 of 119
68 of 119
We are given that chromium metal is heated with iodine and produces powdered chromium (III)
iodide.
First we say
Cr + I_2 ! CrI_3
We write I_3 on the right because we are told Cr is Cr3+ and to combine with Iodine, which has
charge of 1- being a metal in group 17 (one away from group 18 of the inert gases) it must be
three atoms of iodine per every one atom of chromium for the compound to be neutral. We write
I_2 on the left because iodine is a diatomic molecule (naturally occurs in pairs). But this equation is not balanced. Three I_2 molecules on the left and 2 on the right make the same amount of
iodine on the left and right hand sides of the equation, but to place a two in front of chromium on
the right means there are two atoms of chromium on the right for every one atom of chromium
on the left. This would violate the conservation of matter, which states the same amount of matter going into the reaction must be the same as that coming out. To account for this we place a
two in front of the chromium molecule on the left and the equation is balanced:
2Cr+3I_2 ! 2CrI_3
This says two moles of chromium react with three moles of diatomic iodine to make two moles
of chromium iodide. We can further classify this as a combination reaction, because chromium
combines with iodine to make the compound chromium iodide. Nothing is decomposed or displaced.
You can increase the temperature of any substance. The amount of energy required to raise a
gram of any substance one degree centigrade is given by its specific heat which you can find in
the CRC handbook. For instance, the specific heat of water is one calorie per gram degree centigrade. That is pretty high, and is the reason the Earth stays cool because it takes a lot of energy
to raise the temperature of water. Lets use this in an example and ask how many calories are
required to raise the temperature of 2 grams of it 2 degrees centigrade:
(2 grams)(1 cal/gram degree C)(2 degrees C) = 4 calories
69 of 119
Computer Science 01
CS50X Journal Of Ian Beardsley
2014
(Online Version)
70 of 119
Variables
(float %f, %d)
(int %i,%d)
(char%s, %c)
71 of 119
72 of 119
73 of 119
74 of 119
75 of 119
compilers have and I am sure will run on any computer. I imagine we will
learn the scanf() function as the class proceeds. I am about three weeks
into it.
Actually the first thing you learn is not print(f) and scan(f) but that at the top
of every program you first define the library you are going to use and put
the main() function, which tells the computer where your program begins:
#include <stdio.h>
int main (void)
Ian Beardsley
January 24, 2014
76 of 119
Actually, Problem Set 0, the first problem set in the course, was a lot of fun.
My solution to problem 5 in Problem Set 0
A banana =1
6 is an orange and two bananas
An orange is worth half a mango
What is two mangos, an orange, and a banana?
Solution:
If two mangos is four oranges, we have:
4 oranges + 1 orange + 1 banana =
5 orange + 1 banana
6 = 1 orange + 2 bananas (from above)
4 bananas = 1 orange
(4)(5) + 1 = 20 +1 = 21
21 is the answer.
77 of 119
78 of 119
learning scanf
#include <stdio.h>
int main(void)
{
int age;
printf("What is your age? ");
scanf("%d", &age);
printf("You said your age was: %d\n", age);
return 0;
}
running learning scanf
jharvard@appliance (~): cd Dropbox/pset1
jharvard@appliance (~/Dropbox/pset1): ./age
What is your age? 48
You said your age was: 48
jharvard@appliance (~/Dropbox/pset1):
79 of 119
80 of 119
Learning Booleans
#include <stdio.h>
int main (void)
{
char name [15];
printf("What is your first name?: ");
scanf("%s", name);
printf("you said your name is: %s\n", name);
int n;
printf("Is this correct yes=1 no=0? ");
scanf("%d", &n);
if (n==1)
{
printf("thank you\n");
}
else
{
printf("leave the room\n");
}
}
Running Learning Booleans
jharvard@appliance (~): cd Dropbox/pset1
jharvard@appliance (~/Dropbox/pset1): make name
clang -ggdb3 -O0 -std=c99 -Wall -Werror name.c -lcs50 -lm -o name
jharvard@appliance (~/Dropbox/pset1): ./name
What is your first name?: Ian
you said your name is: Ian
Is this correct yes=1 no=0? 1
thank you
jharvard@appliance (~/Dropbox/pset1): ./name
What is your first name?: Ian
you said your name is: Ian
Is this correct yes=1 no=0? 0
leave the room
jharvard@appliance (~/Dropbox/pset1):
81 of 119
82 of 119
Learning Looping
#include <stdio.h>
int main (void)
{
int n;
do
{
printf("give me a positive number: ");
scanf("%d", &n);
}
while (n<0);
for (int i=1; i<n+1; i++)
{
printf("%d\n", i);
}
printf("you promted the user for a number and counted to it with a for loop!
\n");
}
Running Learning Looping
jharvard@appliance (~): cd Dropbox/pset1
jharvard@appliance (~/Dropbox/pset1): ./looping
give me a positive number: -1
give me a positive number: 5
1
2
3
4
5
you promted the user for a number and counted to it with a for loop!
jharvard@appliance (~/Dropbox/pset1):
83 of 119
84 of 119
85 of 119
86 of 119
Running Greedy
jharvard@appliance (~/Dropbox/pset1): ./greedy
amount owed: 1.73
6.000000 2.000000 0.000000 3.000000 11.000000
jharvard@appliance (~/Dropbox/pset1):
That says if you owe someone a dollar seventy three, give them six quarters, two dimes, zero nickels, and three pennies, eleven coins in total.
87 of 119
Arrays
This is where Computer Science really starts to become interesting, because you start to have some practical applications. With arrays you dont
just ask the user to give you a value for a variable, but ask them for a number or of variables, or declare an array in other words.
88 of 119
89 of 119
product = 2*a*b;
sum=a+b;
harmonic=product/sum;
printf("harmonic mean: %.2f\n", harmonic);
double geometric;
geometric=sqrt(a*b);
printf("geometic mean: %.2f\n", geometric);
printf("geometric mean between P and B divided by Si: %.2f\n", geometric/
28.09);
printf("harmonic mean between P and B divided by Si: %.2f\n", harmonic/
28.09);
printf("0.65 + 0.57 divided by 2 is: 0.61\n");
printf("those are the the first two digits in the golden ratio conjugate\n");
}
90 of 119
Running Discover
jharvard@appliance (~): cd Dropbox/pset2
jharvard@appliance (~/Dropbox/pset2): ./add
transistors are Silicon doped with Phosphorus and Boron
Artificial Intelligence would be based on this
the golden ratio conjugate is basic to life
The Golden Ratio Conjugate Is: 0.618
Molar Mass Of Phosphorus (P) Is: 30.97
Molar Mass Of Boron (B) Is: 10.81
Molar Mass Of Silicon (Si) Is: 28.09
How many numbers do you want averaged? 2
1 enter a number: 9
2 enter a number: 5
sum of your numbers are: 14.00
average of your numbers is: 7.00
enter two numbers (hint choose P and B):
give me a: 30.97
give me b: 10.81
harmonic mean: 16.03
geometic mean: 18.30
geometric mean between P and B divided by Si: 0.65
harmonic mean between P and B divided by Si: 0.57
0.65 + 0.57 divided by 2 is: 0.61
those are the the first two digits in the golden ratio conjugate
jharvard@appliance (~/Dropbox/pset2):
91 of 119
92 of 119
93 of 119
94 of 119
95 of 119
96 of 119
97 of 119
I first took an introduction to computer science at Harvard, called CS50. The compiler provided
is the CS50 appliance. It runs on linux, so whether you use a PC or a Mac, you have to upload
the free VirtualBox that allows you to use software that runs on linux. This course begins with
learning to write code in C. The MIT course teaches you to write code in Python. The compiler,
which is called Enthought Canopy Express, can be downloaded for free and is available for PC,
Mac, or linux.
98 of 119
If you make a computer language and it has six primitives (elements) it can compute anything. It
was Alan Turing who showed this. If you write a program in a computer language that has six
primitives, you can write a program that does the same thing in any other language that has six
primitives.
A computer language that has six primitives is said to be turning complete. I your language does
not have six primitives, it is a fixed program computer and can only do a finite number of things.
If the computer language has at least six primitves, it is a stored program computer, for which
you can write an algorithm for anything.
Let us look at the language C. It has six primitives that allow us to do anything. Perhaps they
are: if, then, else, for, printf(), and scanf(). Could this say at the basis of human consciousness
there are six primitives? That, the human mind has the potential to compute anything? Is evolution just not the development of a more and more sophisticated set of primitives, but the development the primitives and added elements made from the basic primitives?
Ian Beardsley
February 21, 2015
99 of 119
Wikipedia writes:
100 of 119
Lets see if Turing was right; that you can write the same program in another language if both
have six primitives. Here is what my first program in python looks like
name.py
name=raw_input('Enter your name: ');
print('Are you ' +name+ '?');
answer=raw_input('Answer: ');
print('Thank you');
Running it does this:
Enter your name: Ian Beardsley
Are you Ian Beardsley? I thinks so.
Thank you.
Here is the same program in C (name.c)
#include <stdio.h>
int main (void)
{
char first[15], last[15], answer[15];
printf ("Enter your last name: ");
scanf("%s", last);
printf ("Enter your first name: ");
scanf("%s", first);
printf("Are you %s, %s?\n", last, first);
scanf("%s", answer);
printf("Thank you, %s\n", answer);
}
Running it:
jharvard@appliance (~/Dropbox/descubrir): ./name
Enter your last name: Beardsley
Enter your first name: Ian
Are you Beardsley, Ian?
101 of 119
yes Thank you, yes
102 of 119
a=float(raw_input('Give me a: '));
b=float(raw_input('Give me b: '));
#a time b is a+a+,... b times
result=0
while (b>0):
result=result+a
b=b-1
else:
print('a times b is: '+ str(result))
#we can write this in shorthand
def multiply(a, b)
result=0
while (b>0):
result+=a
b -=1
return result
Run like this in shell:
In[0] multiply(3, 4)
Out[0] 12.0
Be sure to provide the proper indentation in the program.
103 of 119
Branching Programs
square.py
y=float(raw_input('Enter a number: '))
print('square of y: ')
print(y*y)
remainder.py
x=int(raw_input('Enter an int: '))
if x%2 == 0:
print(' ')
print('even')
else:
print(' ')
print('odd')
print('Done with conditional')
nested.c
x=int(raw_input('Enter an int: '))
if x%2==0:
if x%3==0:
print('Divisible by 2 and 3')
elif x%3==0:
print('Divisible by 3 and not by 2')
else:
print('Not divisible by 2 or 3')
104 of 119
105 of 119
106 of 119
107 of 119
108 of 119
109 of 119
110 of 119
111 of 119
112 of 119
113 of 119
114 of 119
115 of 119
Search Program
#include <stdio.h>
int main (void)
{
int i;
int search=0;
int found=0;
int elements[5] = {1,2,3,4,5};
float molar[25]= {1.01,4.00,6.94,9.01,10.81};
printf("Type element number: ");
scanf("%d", &search);
for (i=0; i<=5; i++)
{
if (search == elements[i])
{found=1;
break;
}
}
if (found)
printf("%.2f\n", molar[i]);
else
{
printf("That element is not listed\n");
}
}
116 of 119
Sort Program
#include <stdio.h>
int main (void)
{
int nums[100], c, n, d, swap;
printf("How many numbers do you want to sort?: ");
scanf("%d", &n);
for (c=0; c<n; c++)
{
printf("%d enter number: ", c);
scanf("%d", &nums[c]);
}
for (c=0;c<(n-1);c++)
{
for (d=0;d<(n-c-1);d++)
{
if (nums[d]>nums[d+1])
{
swap=nums[d];
nums[d]=nums[d+1];
nums[d+1]=swap;
}
}
}
for (c=0; c<n; c++)
{
printf("%d\n", nums[c]);
}
}
117 of 119
118 of 119
119 of 119