Skip to content

Commit

Permalink
Version in maxima.
Browse files Browse the repository at this point in the history
  • Loading branch information
owainkenwayucl committed Dec 12, 2017
1 parent 2183187 commit ac3f203
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions maxima_pi_dir/pi.mac
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
print("Calculating PI using:")$
print(" ", ns, " slices")$
print(" 1 processor")$
p(n) := (4/n)* sum((1/(1+(((i-0.5)/n)^2))),i,0,n);
bg:elapsed_real_time()$
print("Estimated value of PI:", p(ns))$
ed:elapsed_real_time()$
print("Time taken: ", ed-bg, " seconds")$
5 changes: 5 additions & 0 deletions maxima_pi_dir/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

num_threads=${1:-1000000}
com="ns:${num_threads}$ batchload(\"pi.mac\")$"
maxima --very-quiet -r="$com"

0 comments on commit ac3f203

Please sign in to comment.