Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5244

General discussion • Revisiting Pi on the Raspberry Pi: A Decade of Progress in Precision Computing

$
0
0
Back in 2013, there were jokes about the Raspberry Pi struggling to calculate π despite its name,viewtopic.php?t=43867 . Fast forward to today, and even a decade-old Raspberry Pi-2 can compute π to over a million decimal places with tools like PARI/GP.

Here's a simple example using PARI/GP:

pari
Copy code
\p 1000000 \\ Set precision to 1 million decimal places
pi_value = Pi;
write("pi_1M_digits.txt", Str(pi_value)); \\ Save to file

On a Raspberry Pi-2, this computation is entirely feasible, though newer models like the Pi 4 and Pi 400 make it much faster. These advances highlight how far both software optimization and hardware efficiency have come since those early days.

Tools Matter: Modern libraries like PARI/GP, GMP, or MPFR empower precision mathematics even on resource-constrained devices.
Hardware Progress: The Raspberry Pi-2 may not be the fastest, but it can handle serious computations. Newer models excel even further.
π Computing Renaissance: The Raspberry Pi has evolved from being a basic tinkering tool to a capable computational device for enthusiasts and professionals alike.
It's time to retire the old jokes and celebrate how the Raspberry Pi can now handle tasks that seemed improbable a decade ago. Why not try it yourself and share your results?

Code:

Reading GPRC: /etc/gprcGPRC Done.                  GP/PARI CALCULATOR Version 2.15.2 (released)            arm running linux (arm/GMP-6.2.1 kernel) 32-bit version      compiled: Dec 31 2022, gcc version 12.2.0 (Raspbian 12.2.0-10+rpi1)                           threading engine: pthread                (readline v8.2 disabled, extended help enabled)                     Copyright (C) 2000-2022 The PARI GroupPARI/GP is free software, covered by the GNU General Public License, and comesWITHOUT ANY WARRANTY WHATSOEVER.Type ? for help, \q to quit.Type ?18 for how to get moral (and possibly technical) support.parisize = 4000000, primelimit = 500000, nbthreads = 4  ***   Warning: new stack size = 250000000 (238.419 Mbytes).%1 = 1   realprecision = 1000007 significant digits (1000000 digits displayed)  ***   last result: cpu time 3,039 ms, real time 3,060 ms.Goodbye!ubu@raspberrypi:~ $ mcubu@raspberrypi:~ $ inxi -bSystem:  Host: raspberrypi Kernel: 6.6.62+rpt-rpi-v7 arch: armv7l bits: 32 Console: pty pts/0    Distro: Raspbian GNU/Linux 12 (bookworm)Machine:  Type: ARM System: Raspberry Pi 2 Model B Rev 1.1 details: BCM2835 rev: a01041    serial: 000000009dea94a9CPU:  Info: quad core ARMv7 v7l [MCP] speed (MHz): avg: 700 min/max: 600/900Graphics:  Device-1: bcm2835-hdmi driver: vc4_hdmi v: N/A  Device-2: bcm2835-vc4 driver: vc4_drm v: N/A  Display: server: No display server data found. Headless machine? tty: 192x50  API: OpenGL Message: GL data unavailable in console. Try -G --displayNetwork:  Device-1: bcm2835-sdhci driver: N/A  Device-2: Microchip (formerly SMSC) SMSC9512/9514 Fast Ethernet Adapter type: USB    driver: smsc95xxDrives:  Local Storage: total: 29.72 GiB used: 5.13 GiB (17.3%)Info:  Processes: 123 Uptime: 1h 32m Memory: 996.9 MiB used: 193.3 MiB (19.4%) gpu: 76 MiB  Init: systemd target: multi-user (3) Shell: Bash inxi: 3.3.26ubu@raspberrypi:~ $ gp<pim.gp

Statistics: Posted by geev03 — Mon Dec 02, 2024 11:36 am



Viewing all articles
Browse latest Browse all 5244

Trending Articles