function r = approx_pi(steps) total = 0; for k = 0:steps total = total + ((-1)^k) / ((2*k+1)*3^k); end r = 2 * sqrt(3) * total; end