Convergents to rad(2)

I didn’t find anything too interesting.

I’m pretty sure it’s spelled Convergence, but hey, maybe it’s branding.

Q gets to n=21 before hitting the limit. I guess I could look for a most efficient upgrade path for manual buying.
N=zeros(1,100);
D=zeros(1,100);
Q=zeros(1,100);

N(1)=1;
N(2)=3;

D(1)=1;
D(2)=2;

Q(1)=abs(sqrt(2)-N(1)/D(1))^-1;
Q(2)=abs(sqrt(2)-N(2)/D(2))^-1;

for index=3:100
N(index)=2*N(index-1)+N(index-2);
D(index)=2*D(index-1)+D(index-2);
Q(index)=abs(sqrt(2)-N(index)/D(index))^-1;
end

%some random numbers

c1=25;
c2coeff=4;
n=4;

qdot_base=qdotfunc(c1,c2coeff,n,Q);
qdot_C1=qdotfunc(c1+2,c2coeff,n,Q); %note the +2
qdot_C2=qdotfunc(c1,c2coeff+1,n,Q);
qdot_n=qdotfunc(c1,c2coeff,n+1,Q);

%=================================================
%new file
function [qdot] = qdotfunc(c1, c2coeff, n, Q)

m=n*c2coeff;
c2=2^c2coeff;

qdot=c1*c2*Q(m);

%====================================================

I dunno. Am I missing anything?

Leave a Reply