Skip to content

Instantly share code, notes, and snippets.

View fredrik-johansson's full-sized avatar
🕵️‍♂️
Deep into the code

Fredrik Johansson fredrik-johansson

🕵️‍♂️
Deep into the code
View GitHub Profile
@fredrik-johansson
fredrik-johansson / stats.py
Created August 27, 2015 13:52
Python script to generate scrobbling stats page
# -*- coding: utf-8 -*-
import datetime
import matplotlib
import codecs
# history downloaded with lastexport.py https://gist.github.com/bitmorse/5201491
fp = codecs.open("tracks.txt", "r", "utf8")
albums = {}
@fredrik-johansson
fredrik-johansson / rademacher.py
Created July 28, 2020 18:07
Extended Rademacher series
from flint import fmpq, fmpz
from cmath import *
from mpmath import plot
def dedekind_sum(r, k, _cache={}):
key = (r << 24) | k
if key in _cache:
return _cache[key]
if fmpz(r).gcd(k) != 1:
v = None
#include "acb_dirichlet.h"
/* todo: separate prec, eval_prec... */
void
acb_dirichlet_zeta_zero_refine_illinois(arb_t res, const arf_t ra, const arf_t rb, slong prec)
{
arf_t a, b, fa, fb, c, fc, t;
acb_t z;
slong k;
int asign, bsign, csign;
@fredrik-johansson
fredrik-johansson / Arbdemo.ipynb
Created February 11, 2019 17:18
Arbdemo.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fredrik-johansson
fredrik-johansson / stieltjes.c
Created September 13, 2018 05:09
debug stieltjes.c
/*
Copyright (C) 2018 Fredrik Johansson
This file is part of Arb.
Arb is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. See <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include "acb_calc.h"
#include "flint/profiler.h"
/* the integrand */
int
f_pearcey(acb_ptr res, const acb_t z, void * param, slong order, slong prec)
{
acb_t t, u;
@fredrik-johansson
fredrik-johansson / trapezoid.c
Created September 1, 2016 02:37
Trapezoidal integration with error bounds using Arb
/*
Naive implementation of the trapezoidal rule for integration.
(A non-naive implementation would provide adaptivity, etc.)
WARNING: I have not checked carefully that the code is correct.
Let me know if there is a bug.
*/
#include "arb.h"
#include "arb_poly.h"
#include "arb.h"
#include "acb_hypgeom.h"
void arb_root_ui_algebraic(arb_t res, const arb_t x, ulong k, slong prec);
void
_arb_pow(arb_t res, const arb_t x, const arb_t y, slong prec)
{
slong rootlim;
@fredrik-johansson
fredrik-johansson / gist:8198480
Created December 31, 2013 15:36
mpir/gmp exp(1) benchmark
#include <stdio.h>
#include <math.h>
#include "gmp.h"
#include "time.h"
#define ulong unsigned long
void
mpz_bsplit(mpz_t p, mpz_t q, ulong a, ulong b)
{
if (b - a == 1)
@fredrik-johansson
fredrik-johansson / gist:8198432
Created December 31, 2013 15:33
bsdnt exp(1) benchmark program
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include "nn.h"
#include "test.h"
#include "zz.h"
void
zz_bsplit(zz_t p, zz_t q, ulong a, ulong b)