Permalink
Browse files

Code to compute superimposed plots with normal distribution and dist …

…of zero sums.
  • Loading branch information...
1 parent 8ec2883 commit 72c6b83a7292d2825e561d7b3054d896d4e1bfeb @williamstein committed Jan 26, 2013
Showing with 36 additions and 2 deletions.
  1. +5 −2 diary.txt
  2. +31 −0 go2.sage
View
@@ -3,7 +3,10 @@ Fri Jan 18
[x] (17min) start draw plots of S(X,T), but without dividing by log(X)
[x] (26min) recompute the pos/neg ap counts table (page 4) up to 1e9 for all curves.
-[ ] read
+[x] read
+Sat Jan 19
+----------
-
+[ ] plot of normal on top of existing distribution of errors.
+[ ] look at hoa's computation for zeta: https://mail.google.com/mail/u/0/?shva=1#inbox/13c4b5a20cc13b01
View
@@ -240,3 +240,34 @@ def zero_sum_distribution1_mean_std(curves=list1+list2, samples=100000, Xmax=50,
for input, output in f(curves):
print input, output
+def zero_sum_distribution1_normal(curves=list1+list2, samples=100000, bins=1000,
+ Xmax=[5, 50, 1000, 5000], exclude=[0,5]):
+ if not isinstance(Xmax, list):
+ Xmax = [Xmax]
+ if not isinstance(exclude, list):
+ exclude = [exclude]
+
+ path = "plots/zero_sum_distribution1_normal/"
+ if not os.path.exists(path):
+ os.makedirs(path)
+ @parallel(ncpus)
+ def f(lbl, xmax, exclude):
+ base = "%s/%s-Xmax%s-samples%s-bins%s-exclude%s"%(path, lbl, xmax, samples, bins, exclude)
+ fname = base + '.svg'
+ if os.path.exists(fname):
+ return "already done with %s"%lbl
+ v = zero_sum_distribution1(zeros=zeros(lbl)[exclude:], samples=samples, Xmax=xmax)
+ r = EllipticCurve(lbl).rank()
+ t = finance.TimeSeries(v)
+ #save(v, base +'.sobj')
+ g = t.plot_histogram(bins=bins)
+ mean = t.mean(); sd = t.standard_deviation()
+ key = "%s: Xmax=%s, sd=%.2f, mean=%.2f, exclude=%s"%(lbl, xmax, sd, mean, exclude)
+ g += text(key, (-4*sd,1), color='black')
+ pdf(x) = 1/(sd*sqrt(2*pi)) * exp(-(x-mean)^2/(2*sd^2))
+ g += plot(pdf, (x,mean-4*sd,mean+4*sd), color='red', thickness=2)
+ g.save(fname)
+
+ for input, output in f([(lbl,xmax,ex) for lbl in curves for xmax in Xmax for ex in exclude]):
+ print input, output
+

0 comments on commit 72c6b83

Please sign in to comment.