the ai cookbook 3
DESCRIPTION
In the AI Cookbook, we established the connection of the building blocks of AI (doped silicon) to the building blocks of organic life (Amino Acids) and, the skeletons of organic life (Arenes, Alkanes, Alkenes, Alkynes) to the skeleton of AI (scandium, a lightweight strong metal). We showed that the recipe and its ingredients are written in Nature’s AI Cookbook. We further suggest AI, is part of a natural process outside of the human endeavor to make it.TRANSCRIPT
� of �1 39
The AI Cookbook 3
By
Ian Beardsley
Copyright © 2016 by Ian Beardsley
ISBN: 978-1-365-22018-0
� of �2 39
In the AI Cookbook, we established the connection of the building blocks of AI (doped silicon) to the building blocks of organic life (Amino Acids) and, the skeletons of organic life (Arenes, Alkanes, Alkenes, Alkynes) to the skeleton of AI (scandium, a lightweight strong metal). We showed that the recipe and its ingredients are written in Nature’s AI Cookbook. We further suggest AI, is part of a natural process outside of the human endeavor to make it.
� of �3 39
Harmonic Mean
Geometric Mean
Arithmetic Mean
� of �4 39
The Golden Ratio
� of �5 39
The AI Building Block
� of �6 39
� of �7 39
� of �8 39
� of �9 39
DNA and Logic Gates
� of �10 39
The instructions of organic life are in the sequencing of four compounds, Adenine (A), Guanine (G), Cytosine (C), Thymine (T), where as the structure of a computer is in a series of switches that are either “on” or “off”, depending on the input. Adenine only combines with Thymine (A=T) and Guanine only combines with Cytosine (G=C). The computer switches that are either on or off are made from logic gates, such as “And” and “Or” gates. The A, G, C, T make up DNA (Deoxyribose Nucleic Acid). They are arranged in pairs of four along a twisted ladder, or “Double Helix”.
� of �11 39
Adenine
NH2 | = C — —N N C = | || C — H H _ C C — = N — — N | H
Guanine
O || C N = — — H — N C = | || C — H H2N—C C — = — — N N | H
Cytosine
NH2 | C = — N C — H | ||O = C || — — C — H N | H
� of �12 39
Thymine
O || C — —H —N C — CH3 | ||O = C C — H — — N | H
� of �13 39
An “Or” gate with one on and one off:
+1.2eV —————|>—————————> out (9.6E-20 J, or 0.6 eV) | | —————|>———| | | R | | —————————
An “And” gate:
A———————<|———————————-> out | | | | | __+__ | — B ———————<|——— | | ————————————————————> out
� of �14 39
cbots
Ian Beardsley
© 2016
� of �15 39
mechanics.c
#include <stdio.h> int main (void) { printf("\n"); float sh, th, hn, n, h,l, part1, part2, foot, upperarm, forearm; printf("Proportions Of Robot in hands\n"); printf("How long is the robot shin? "); scanf("%f", &sh); printf("What is the length of the neck? "); scanf("%f", &n); printf("What is the distance from chin to top of head? "); scanf("%f", &h); th=(2.0/3.0)*sh; hn=(1.0/3.0)*th; l=(sh+th); part1=l+hn; part2=2.0/3.0*(part1+n+h); foot=(1.0/3.0)*sh; upperarm=th; forearm=(3.0/2.0)*upperarm; printf("foot = %.2f ", foot); printf("shin = %.2f ", sh); printf("thigh = %.2f ", th); printf("part one = %.2f ", part1); printf("part two = %.2f\n", part2); printf("height = %.2f ", part1+part2); printf("upper arm = %.2f\n ", upperarm); printf("forearm, elbow to knuckles = %.2f ", forearm); printf("\n"); }
� of �16 39
� of �17 39
cbots.c
#include <stdio.h> int main (void) { printf("\n"); float height, chin, neck, nipples, navel, hips; float knees, feet, shoulders, elbow, wrist, fingertips; printf("proportions of cbot.\n"); printf("Height: "); scanf("%f", &height); chin = (7.0/8.0)*height; neck=(6.75/8.0)*height; nipples = (6.0/8.0)*height; navel = (5.0/8.0)*height; hips = (4.0/8.0)*height; knees = (2.0/8.0)*height; feet = (0.0)*height; shoulders = (6.75/8.0)*height; elbow = (5.0/8.0)*height; wrist = (4.0/8.0)*height; fingertips =(3.0/8.0)*height; printf("feet=%.2f , knees=%.2f , hips=%.2f ", feet, knees, hips); printf("\n"); printf("navel=%.2f , nipples=%.2f , neck=%.2f ", navel, nipples, neck); printf("chin=%.2f\n", chin); printf("shoulders=%.2f , elbows=%.2f , wrists=%.2f", shoulders, elbow, wrist); printf("\n"); printf("fingertips=%.2f", fingertips); printf("\n"); printf("\n"); }
� of �18 39
jharvard@appliance (~): cd Dropbox jharvard@appliance (~/Dropbox): make cbots clang -ggdb3 -O0 -std=c99 -Wall -Werror cbots.c -lcs50 -lm -o cbots jharvard@appliance (~/Dropbox): ./cbots
proportions of cbot. Height: 8 feet=0.00 , knees=2.00 , hips=4.00 navel=5.00 , nipples=6.00 , neck=6.75 chin=7.00 shoulders=6.75 , elbows=5.00 , wrists=4.00 fingertips=3.00
jharvard@appliance (~/Dropbox):
� of �19 39
Computer Science At:
Harvard (C)
MIT (Python)
University of Honk Kong (Java)
� of �20 39
Compsci Homework
CS50
Python
Java
Student: Ian Beardsley
� of �21 39
Programs In C
� of �22 39
Hello World
#include <stdio.h> int main(void) { printf("hello, world\n"); }
� of �23 39
#include <cs50.h> #include <stdio.h> #include <math.h>
int main (void) { float amount=0.01; do { printf("amount owed: "); amount= GetFloat(); } while (amount<=0); float pennies = 100.0*amount; float cents = roundf(pennies); float quarter= 0; float dime= 0; float nickel= 0; float penni= 0; while (cents>0) if (cents>=25.0) { cents=cents-25.0; quarter=quarter+1; } else if (cents>=10.0) { cents=cents-10.0; dime=dime+1; } else if (cents>=5.0) { cents=cents-5.0; nickel=nickel+1; } else if (cents>=1.0) { cents=cents-1.0; penni=penni+1; } int sum = quarter+dime+nickel+penni; printf("%i\n", sum); }
� of �24 39
#include <cs50.h> #include <stdio.h>
int main (void) { printf("amount owed: "); float amount= GetFloat(); float cents= 100.0*amount; float quarter= 0; float dime= 0; float nickel= 0; float penni= 0; while (cents>0) if (cents>=25.0) { cents=cents-25.0; quarter=quarter+1; } else if (cents>=10.0) { cents=cents-10.0; dime=dime+1; } else if (cents>=5.0) { cents=cents-5.0; nickel=nickel+1; } else if (cents>=1.0) { cents=cents-1.0; penni=penni+1; } printf("%f %f %f %f %f\n",quarter,dime,nickel,penni,quarter+dime+nickel+penni);
� of �25 39
#include <cs50.h> #include <stdio.h>
int main(void) { int n; do { printf("Choose a positive number less than or equal to 23: "); n=GetInt(); } while (n<=0 || n>23); for (int j=1; j<=n;j++) { for (int i=1; i<=n;i++) { if (j>=n+1-i) { printf("#"); } else { printf(" "); } } printf("#"); printf("\n"); } }
}
� of �26 39
Caesar’s Cipher
#include <stdio.h> #include <cs50.h> #include <string.h> int main (int argc, string argv[1]) { int k = atoi(argv[1]); if (argc>2 || argc<2) { printf("Give me a single string: "); } else { printf("Give me a word: "); } string s = GetString(); for (int i=0, n=strlen(s); i<n; i++) { printf("%c", s[i]+k); } printf("\n"); }
� of �27 39
Programs In Python
� of �28 39
Hello, World!
print 'hello world' print 'I like 6.00.1x'
Multiply
a=int(raw_input("Give me an int: ")); b=int(raw_input("Give me another int: ")); product=0 while (a>0): a=a-1; product=b+product; print("Product of a and b is: "+str(product))
Name
name=raw_input('Enter your name: '); print('Are you ' +name+ '?'); answer=raw_input('Answer: '); print('Thank you');
Remainder
x=int(raw_input('Enter an int: ')) if x%2 == 0: print(' ') print('even') else: print(' ') print('odd') print('Done with conditional')
Square
y=float(raw_input('Enter a number: ')) print('square of y: ') print(y*y)
� of �29 39
Programs In Java
� of �30 39
public class Lab01 { public static void main(String[] args) { // Please code in the following area // ---------------------------------
System.out.println("Hello, world!"); System.out.println("Hello, beautiful"); System.out.println("Hola, amigo!");
// --------------------------------- } }
� of �31 39
import comp102x.IO;
public class Lab02 { public static void multiply() { // Please write your code after this line System.out.print("Enter an integer, x: "); int x=IO.inputInteger(); System.out.print("Enter an integer, y: "); int y=IO.inputInteger(); int Product=x*y; IO.outputln("Answer = " + Product); } public static void calculateTriangleArea() { // Please write your code after this line System.out.print("Enter the width of the triangle: "); float w=IO.inputFloat(); System.out.print("Enter the height of the triangle: "); float h=IO.inputFloat(); float Area=(w*h)/2; IO.outputln("The triangle area = " + Area); } public static void solveQuadraticEquation() { // Please write your code after this line System.out.print("Enter a: "); double a=IO.inputDouble(); System.out.print("Enter b: "); double b=IO.inputDouble(); System.out.print("Enter c: "); double c=IO.inputDouble(); double square = b*b; double rootOne = (-b+(Math.sqrt(square-4*a*c)))/(2*a); double rootTwo = (-b-(Math.sqrt(square-4*a*c)))/(2*a);
� of �32 39
IO.outputln("First solution for x = " + rootOne); IO.outputln("Second solution for x = " + rootTwo); } }
� of �33 39
jharvard@appliance (~): cd Dropboxjharvard@appliance (~/Dropbox): make runclang -ggdb3 -O0 -std=c99 -Wall -Werror run.c -lcs50 -lm -o runjharvard@appliance (~/Dropbox): ./run 3Give me a word: coorsfrruvhello, worldamount owed: 1.767.000000 0.000000 0.000000 1.000000 8.000000Choose a positive number less than or equal to 23: 5 ## ### #### ###########jharvard@appliance (~/Dropbox):
� of �34 39
� of �35 39
� of �36 39
� of �37 39
#include <stdio.h> #include <cs50.h> #include <string.h> #include <math.h> int main (int argc, string argv[1]) { int k = atoi(argv[1]); if (argc>2 || argc<2) { printf("Give me a single string: "); } else { printf("Give me a word: "); } string s = GetString(); for (int i=0, n=strlen(s); i<n; i++) { printf("%c", s[i]+k); } printf("\n");
printf("hello, world\n"); {
printf("amount owed: "); float amount= GetFloat(); float cents= 100.0*amount; float quarter= 0; float dime= 0; float nickel= 0; float penni= 0; while (cents>0) if (cents>=25.0) { cents=cents-25.0; quarter=quarter+1; } else if (cents>=10.0) { cents=cents-10.0; dime=dime+1;
� of �38 39
} else if (cents>=5.0) { cents=cents-5.0; nickel=nickel+1; } else if (cents>=1.0) { cents=cents-1.0; penni=penni+1; } printf("%f %f %f %f %f\n",quarter,dime,nickel,penni,quarter+dime+nickel+penni); } { int n; do { printf("Choose a positive number less than or equal to 23: "); n=GetInt(); } while (n<=0 || n>23); for (int j=1; j<=n;j++) { for (int i=1; i<=n;i++) { if (j>=n+1-i) { printf("#"); } else { printf(" "); } } printf("#"); printf("\n"); } } }
� of �39 39
The Author