This is the code repository for Build Supercomputers with Raspberry Pi 3, published by Packt. It contains all the supporting project files necessary to work through the book from start to finish.
This book's mission is to effectively instruct anyone, with basic computer hardware and software skills, on how to construct an affordable Pi3 supercomputer. If you are looking at performing high-level computation with microchips, then this book is for you.
All of the code is organized into folders. The commands and instructions will look like the following:
#include <math.h> // math library
#include <stdio.h>// Standard Input / Output library
int main(void)
{
long num_rects = 300000;//1000000000;
long i;
double x,height,width,area;
double sum;
width = 1.0/(double)num_rects; // width of a segment
sum = 0;
for(i = 0; i < num_rects; i++)
{
x = (i+0.5) * width; // x: distance to center of i(th) segment
height = 4/(1.0 + x*x);
sum += height; // sum of individual segment heights
}
// approximate area of segment (Pi value)
area = width * sum;
printf("\n");
printf(" Calculated Pi = %.16f\n", area);
printf(" M_PI = %.16f\n", M_PI);
printf("Relative error = %.16f\n", fabs(area - M_PI));
return 0;
}
- Building Smart Homes with Raspberry Pi Zero
- Getting Started with Raspberry Pi Zero
- Raspberry Pi Home Automation with Arduino - Second Edition
Click here if you have any feedback or suggestions.
If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.