Here's Weierstrass in Python: https://scipython.com/blog/the-weierstrass-function
I wonder what they sound like as audio.
Edit: apparently it sounds like this https://youtu.be/vWmZnlPQK14
I wonder what they sound like as audio.
Edit: apparently it sounds like this https://youtu.be/vWmZnlPQK14
function sum(f: (x: number) => number, upper = 500) {
let sum = 0;
for (let n = 0; n < upper; n++) sum += f(n);
return sum;
}
const weierstrass = (x: number, a = 0.5, b = 3) =>
sum(n => a ** n * Math.cos(b ** n * x));You could even replace the audible part with Chopin (or anything else, even f(x)=0) to get a Weierstrass-like function which sounds like Chopin (or silence) but is still not differentiable anywhere.
At a lower pitch, with some variation in pitch and amplitude, it probably sounds nicer.